Overview
Theaccount_create_eoa syscall creates a new Externally Owned Account (EOA) by verifying a cryptographic signature that proves ownership of the account’s private key.
Syscall Code
Code:0x0F (TN_SYSCALL_CODE_ACCOUNT_CREATE_EOA)
C SDK Function
Arguments
Index of the account slot to create. The account’s public key address must be specified in the transaction at this index.
Pointer to the Ed25519 signature (64 bytes). The signature must be created by signing the null owner address (32 bytes of zeros) with the private key corresponding to the account’s public key.
Pointer to the state proof data verifying the account doesn’t exist.
Size of the state proof data in bytes.
Return Value
Returns a syscall result code:TN_VM_SYSCALL_SUCCESS(0) - EOA account created successfully
TN_VM_ERR_SYSCALL_INVALID_ACCOUNT_INDEX(-8) - Account index out of boundsTN_VM_ERR_SYSCALL_ACCOUNT_ALREADY_EXISTS(-15) - Account already existsTN_VM_ERR_SYSCALL_INVALID_ADDRESS(-22) - Invalid virtual address for signature or proofTN_VM_ERR_SYSCALL_INVALID_SIGNATURE(-44) - Ed25519 signature verification failedTN_VM_ERR_SYSCALL_INVALID_PROOF_LEN(-32) - Proof size mismatchTN_VM_ERR_SYSCALL_INVALID_PROOF_SLOT(-33) - Proof references invalid block slotTN_VM_ERR_SYSCALL_INVALID_STATE_PROOF(-23) - State proof verification failedTN_VM_ERR_SYSCALL_STATE_BYTES_ADDED_OVERFLOW(-47) - State bytes counter overflow during activation
Resource Consumption
Compute Units
- Base cost:
TN_VM_SYSCALL_BASE_COST(512 units) - Signature cost: Additional 64 units for signature verification
- Proof cost: Additional units equal to proof size in bytes
- Metadata cost: Additional units equal to
sizeof(tsdk_account_meta_t) - Total formula:
base_cost + 64 + proof_sz + sizeof(tsdk_account_meta_t)
Memory Pages
- Page usage: No direct page allocation (account data starts at size 0)
- Metadata pages: Allocates pages for account metadata structure
- State proof validation: Temporary memory usage for proof verification
State Counter Impact
- GASC (Global Activated State Counter): Incremented by
TSDK_ACCOUNT_META_FOOTPRINTbytes - Purpose: Tracks activated state for the EOA account creation in the global state counter
- Overflow protection: Returns
TN_VM_ERR_SYSCALL_STATE_BYTES_ADDED_OVERFLOWif counter would overflow
Side Effects
- Account creation: Creates a new account with
TSDK_ACCOUNT_FLAG_NEWset - Ownership: Sets owner to null (00000…) for EOA accounts
- Account metadata: Initializes writable metadata structure for an externally owned account
Signature Verification
The signature verification process:- Reads the Ed25519 signature (64 bytes) from the provided virtual address
- Verifies the signature by checking that it was created by signing the null owner address (32 bytes of zeros) with the private key
- Uses the account’s public key from the transaction to verify the signature
- The signature proves ownership of the private key corresponding to the account address
Signature Generation
To create a valid signature for EOA account creation:State Proof Requirements
- New accounts: Requires a creation-type state proof showing the address doesn’t exist
- Deleted accounts: Can recreate with proof verification (removes
TSDK_ACCOUNT_FLAG_DELETED, owner remains null) - Proof verification: Must reference a valid block slot and verify against state root
EOA Properties
- Owner: Always set to null address (00000…)
- NEW Flag:
TSDK_ACCOUNT_FLAG_NEWis set on first creation - EOA identification: Identified by null owner; there is no dedicated
TN_ACCOUNT_FLAG_EOA - External control: Account is controlled by the holder of the private key, not by a program
Usage Notes
- The account address must correspond to the public key from which the signature is derived
- Signature verification ensures only the private key holder can create the account
- EOA accounts are distinguished from program-defined accounts by null owner
- State proof ensures global uniqueness of the address
- Account is created with zero balance and zero data size