↑ ↓ navigate↵ open

Accounts and transactions

Address derivation, wire format v3, ids, units, validation errors, mempool rules and statuses.

On this page · 6
  1. 01Accounts and addresses
  2. 02Wire format (v3)
  3. 03Validation (applyTx)
  4. 04Units and supply
  5. 05Mempool admission
  6. 06Status

Accounts and addresses

address
address = SHA3-256("leansvm/address/v1/mldsa44" ‖ public_key)      // 32 bytes
FieldTypeNotes
balanceu64units
nonceu64count of applied transactions sent; max 2^64 − 1
keyOption<PublicKey>bound by the first outgoing transaction, immutable afterwards

The address is the map key and is not stored in the account. Accounts that have only received have no key; GET /account reports it as key_bound.

Wire format (v3)

first transaction3,838 bytes
every later one2,526 bytes
version · 1 B
always 3
signed fields · 104 B
chain id, sender, recipient, amount, nonce, both fee limits
has_pubkey · 1 B
0 or 1
public key · 1,312 B
first transaction of an account only
signature · 2,420 B
ML-DSA-44 over the signed fields
transaction
offset  size   field
0       1      version = 3
1       8      chain_id                u64 LE ┐
9       32     sender                         │
41      32     recipient                      │ signed bytes (104)
73      8      amount                  u64 LE │
81      8      nonce                   u64 LE │
89      8      max_fee_per_byte        u64 LE │
97      8      priority_fee_per_byte   u64 LE ┘
105     1      has_pubkey (0 | 1)
106     1312   public_key              only if has_pubkey = 1
106|1418 2420  signature               ML-DSA-44, context "leansvm/tx/v1"
size
106 + |pk| + 2,420
normal
2,526 B
with key (MAX_TX_SIZE)
3,838 B
tx id
SHA3-256(signed bytes ‖ signature)
signature context
leansvm/tx/v1
signing
ML-DSA-44, hedged

The id and the signature do not cover the version byte, the key flag or the key. A key is therefore only accepted when the account has none: otherwise a relay could attach a key to a signed transaction and raise its size, and fee, by 1,312 bytes. applyTx_canonical proves an applied transaction carried a key exactly when it bound one. Rust builds the format with TxBody and Tx::to_bytes (core-ffi/src/ledger.rs).

Validation (applyTx)

Checks in evaluation order. The code is what leansvm_apply_tx returns; the name appears in rejected statuses and API errors.

CodeErrorCondition
1WrongChaintx.chain_id ≠ chain id
2WrongAccountaccount records passed in do not match sender / recipient
3SelfTransfersender = recipient
4BadNoncetx.nonce ≠ sender.nonce
5NonceExhaustedsender.nonce = 2^64 − 1
11FeeTooLowmax_fee_per_byte < base_fee
12UnexpectedPubkeykey already bound and the tx carries one
6MissingPubkeyno key bound and the tx carries none
7PubkeyMismatchaddress of the carried key ≠ sender
8BadSignatureML-DSA-44 verify fails under the bound or carried key
9InsufficientBalancebalance < amount + fee
10RecipientOverflowrecipient balance + amount ≥ 2^64
255(malformed)input could not be decoded; Rust treats it as a bug and stops

On success the core returns both accounts, the fee and whether a key was bound (TxEffect). An error changes nothing.

Units and supply

UNITS_PER_TOKEN
10^9
DECIMALS
9
TOTAL_SUPPLY
10^15 units
minting
none
supply change
− burned fees
invariant
supply + burned = 10^15

Mempool admission

Ledger::precheck runs on POST /tx. It is not binding (the core decides when the block runs), and a differential test checks it accepts exactly what applyTx accepts.

RuleValue
Capacity10,000 txs (--mempool-size)
Per-account window64; nonce must equal next_nonce (no gaps)
Balance checkcovers all waiting txs of the account at the current base fee
Effective tipmin(max_fee − base_fee, priority_fee); 0 if max_fee < base_fee
Admission when fulltip ≥ victim + max(victim / 10, 1)
Eviction victimlast tx of another account, lowest tip, newest on tie
Replacement (same nonce)both fees ≥ old + max(old / 10, 1)
TTL3,600 slots; later txs of the account dropped with it
Failure in blocklater txs of the account dropped; account resumes at the failed nonce
Persistencenone; resubmit after a restart
Error (HTTP 400)Cause
could not decode the transactionbody is not a valid v3 transaction
transaction already knownsame id in the mempool or already applied
transaction larger than a blocksize > 2 × block_target_bytes
BadNonce: the account’s next nonce is Ngap or reused nonce
UnexpectedPubkey: an earlier transaction in the mempool carries the keykey sent twice
InsufficientBalance: the account’s waiting transactions already need N unitsbalance rule
a replacement must raise both fees by a tenth: …replacement rule
mempool full: offer a priority fee of at least N units/byteadmission rule
WrongChain, BadSignature, FeeTooLow, …precheck error names, as above

Status

statusKeptFields
pendingwhile waitingid, sender, recipient, amount, nonce, max_fee_per_byte, priority_fee_per_byte, size
appliedforever (index)+ height, slot, index, fee
rejectedone snapshot intervalreason: error name
droppedone snapshot intervalreason: evicted | replaced | expired

Lookup order for GET /tx/<id>: mempool, remembered statuses, chain index, else 404. See HTTP API.