Learn the best practices for handling nonces when building smart contract accounts on Abstract.
As outlined in the transaction flow, a call to validateNonceUsage
is made to the NonceHolder system contract
before each transaction starts, in order to check whether the provided nonce
of a transaction has already been used or not.
The bootloader enforces that the nonce:
As mentioned above, you must “use” the nonce in the validation step. To mark a nonce as used there are two options:
minNonce
: All nonces less than minNonce
will become used.setValueUnderNonce
.A convenience method, incrementMinNonceIfEquals
is exposed
from the NonceHolder
system contract. For example, inside of your smart contract wallet,
you can use it to increment the minNonce
of your account.
In order to use the NonceHolder system contract,
the isSystem
flag must be set to true
in the transaction, which can be done by using the SystemContractsCaller
library shown below.
Learn more about using system contracts.
Learn the best practices for handling nonces when building smart contract accounts on Abstract.
As outlined in the transaction flow, a call to validateNonceUsage
is made to the NonceHolder system contract
before each transaction starts, in order to check whether the provided nonce
of a transaction has already been used or not.
The bootloader enforces that the nonce:
As mentioned above, you must “use” the nonce in the validation step. To mark a nonce as used there are two options:
minNonce
: All nonces less than minNonce
will become used.setValueUnderNonce
.A convenience method, incrementMinNonceIfEquals
is exposed
from the NonceHolder
system contract. For example, inside of your smart contract wallet,
you can use it to increment the minNonce
of your account.
In order to use the NonceHolder system contract,
the isSystem
flag must be set to true
in the transaction, which can be done by using the SystemContractsCaller
library shown below.
Learn more about using system contracts.