Skip to content
LogoLogo

accounts.getConfigCommitment

Gets the current configuration commitment for an account from the configurable account precompile. Tempo stores this 32-byte hash of the current config, not the config itself.

The commitment is zero until a config is committed: for an ordinary account, or for a derived address that has not registered yet. It becomes nonzero after registration or an upgrade, and changes with each config update.

Usage

import { client } from './viem.config'
 
const commitment = await client.accounts.getConfigCommitment({
  account: '0x7b378778e4b0dfd068bc74979508219e2ba2074c',
})
'0x...'

Standalone Action

import { Actions } from 'viem/tempo'
import { client } from './viem.config'
 
const commitment = await Actions.accounts.getConfigCommitment(client, {
  account: '0x7b378778e4b0dfd068bc74979508219e2ba2074c',
})

Recipes

Compare With a Config

Compute a config's commitment with AccountConfig.getCommitment to check that it is the account's current config. For example, rebuild the config an upgrade installed with AccountConfig.fromUpgrade.

import { AccountConfig } from 'viem/tempo'
import { client } from './viem.config'
 
const address = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
const config = AccountConfig.fromUpgrade(address, {
  owners: [{ owner: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', weight: 1 }],
  threshold: 1,
})
 
const commitment = await client.accounts.getConfigCommitment({ account: address })
 
const isCurrent = commitment === AccountConfig.getCommitment(config)

Return Value

Hex

The current configuration commitment, or 0x0000000000000000000000000000000000000000000000000000000000000000 when no config has been committed.

A chain without the configurable account precompile holds no commitments, so the action returns zero for every account on it.

Parameters

account

  • Type: Address

The account address.

await client.accounts.getConfigCommitment({
  account: '0x7b378778e4b0dfd068bc74979508219e2ba2074c', 
})

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.