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 failed
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(tn_account_meta_t) - Total formula:
base_cost + 64 + proof_sz + sizeof(tn_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
Side Effects
- Account creation: Creates a new account with NEW and EOA flags set
- Ownership: Sets owner to null (00000โฆ) for EOA accounts
- Account metadata: Initializes writable metadata structure with EOA flag
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 DELETED flag, sets EOA flag)
- Proof verification: Must reference a valid block slot and verify against state root
EOA Properties
- Owner: Always set to null address (00000โฆ)
- EOA Flag:
TN_ACCOUNT_FLAG_EOA(0x80) is set - NEW Flag:
TN_ACCOUNT_FLAG_NEWis set on first creation - 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 the EOA flag
- State proof ensures global uniqueness of the address
- Account is created with zero balance and zero data size