View this page as Markdown

nonce

Returns an address's transaction count in live, pinned, or retained execution state. Without a CLIENT, it builds a reusable READ and does not access state.

Example

Local

SELECT nonce('0x0000000000000000000000000000000000000001'::ADDRESS);

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

nonce(CLIENT, ADDRESS) # Immediate Read · RPC required

Reads the account nonce from the CLIENT's current state context; only a live CLIENT necessarily resolves latest state.

Inputs

Name Type Use
client CLIENT

Readable EVM state represented by a live, pinned, or execution CLIENT.

required positional
address ADDRESS

Account or contract address whose transaction count should be read.

required positional

Returns

Name Type
nonce UBIGINT

Account transaction count. Returns the account nonce as UBIGINT. Contract nonces and retained execution state follow the selected CLIENT context.

Guidance

Nonce semantics

nonce returns the account transaction count used by EVM account state; it is not a pending-transaction queue length.

  • Use an explicit block number or pinned CLIENT for repeatable evidence.
  • Historical block reads may require archive-capable RPC access.
  • Use the READ overload when scheduling an observation inside a simulation program.

Evaluation

The READ accesses state only when an OBSERVATION consumes it during PROGRAM execution.

Additional overloads

nonce(CLIENT, ADDRESS, BIGINT) # Immediate Read · RPC required

Reads the account nonce at an explicit block height; older heights may require archive access.

Inputs

Name Type Use
client CLIENT

Readable EVM state represented by a live, pinned, or execution CLIENT.

required positional
address ADDRESS

Account or contract address whose transaction count should be read.

required positional
block_number BIGINT

Explicit historical block height for a repeatable nonce read.

required positional

Returns

Name Type
nonce UBIGINT

Account transaction count. Returns the account nonce as UBIGINT. Contract nonces and retained execution state follow the selected CLIENT context.

Overload examples

Named parameters · RPC required

SELECT nonce($client, '0x0000000000000000000000000000000000000001'::ADDRESS, 21000000);
nonce(ADDRESS) # Read Builder · RPC required

Records one address for a later account-nonce lookup; construction does not access state.

Inputs

Name Type Use
address ADDRESS

Account or contract address whose transaction count should be observed.

required positional

Returns

Name Type
read READ

Account-nonce READ. Returns a READ whose successful EVM_VALUE is an unsigned account nonce.

Examples

Named parameters · RPC required

SELECT nonce($client, '0x0000000000000000000000000000000000000001'::ADDRESS);

Category and tags

Category
Chain reads
Tag
RPC
Tag
Simulate