Account Subquery
Description
Account subqueries provide data about an Ethereum account at a specific block.
Limits
Maximum of 128 account subqueries.
Usage
To access data about an Ethereum account with address address
at the block number blockNumber
, you must first construct an Account
object using the getAccount
function:
const getAccount = (
blockNumber: number | CircuitValue,
address: string | CircuitValue
) => Readonly<Account>;
The returned Account
is an interface with the functions below.
Note that all functions in the interface are async.
Example Usage
Here is an example of how to use the Account
interface:
const account: Account = getAccount(blockNumber, address);
const nonce: CircuitValue256 = await account.nonce();
Account
Interface
nonce: () => Promise<CircuitValue256>;
Returns the nonce of the account.
balance: () => Promise<CircuitValue256>;
Returns the balance of the account.
storageRoot: () => Promise<CircuitValue256>;
Returns the root of the storage trie of the account. If the account is an EOA or does not exist, the storage root is the empty root keccak(rlp(0x)) = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
.
codeHash: () => Promise<CircuitValue256>;
Returns the code hash of the account. This follows the behavior of the EXTCODEHASH
EVM opcode, particularly in how EOAs and non-existing accounts are handled.