Best practices
Handle blocklist and pause
Your stablecoin has two safety controls managed by Coinbase that your integration must handle gracefully.- Ethereum Virtual Machine
- Solana Virtual Machine
Check both before sending a transaction to avoid unnecessary gas costs on a revert:
Token decimals
- Ethereum Virtual Machine
- Solana Virtual Machine
Always read decimals from the contract rather than hardcoding. Your stablecoin’s decimals are set at deployment and can be between 6 and 18.
ERC-20 approvals (Base only)
When building a contract that pulls tokens from users (for example, a payment processor), preferpermit or ERC-3009 over requiring a prior approve transaction — this reduces friction and the number of on-chain steps for your users.
If you do use approve, avoid approving MaxUint256 in production:
Memo security
Signed transfer security
- Ethereum Virtual Machine
- Solana Virtual Machine
When accepting signed ERC-3009 authorizations from users:
- Always verify
authorizationState(from, nonce)isfalsebefore presenting a transaction for signature — do not show users a “sign” prompt for a nonce that is already used - Set a reasonable
validBefore(minutes to hours, not days) to limit exposure if a signature is compromised - Use
receiveWithAuthorizationinstead oftransferWithAuthorizationwhen only the recipient should be able to submit the transaction
Security considerations
Verify addresses
Verify addresses
- Confirm the contract or mint address against Key Addresses before sending transactions
- Validate all user-supplied addresses before using them as transfer recipients
- Check
isBlocklistedon user addresses before building transactions that include them — this prevents predictable reverts
Test thoroughly
Test thoroughly
- Test on testnet first with small amounts
- Cover error paths — blocklisted address, paused contract, expired permit, insufficient balance
- Verify memo encoding/decoding end-to-end if your integration uses memos
Handle failures gracefully
Handle failures gracefully
- Never assume success — always wait for confirmation and check the transaction receipt
- Distinguish validation errors (do not retry) from transient network errors (safe to retry with backoff)
- Provide clear error messages to users — the Troubleshooting guide maps on-chain errors to user-facing messages
Monitor on-chain events
Monitor on-chain events
Subscribe to relevant events to keep your off-chain systems in sync:
| Event | Action |
|---|---|
Transfer | Update balance records |
Memo | Correlate with off-chain orders |
Paused | Halt outgoing transfers, surface status to users |
Unpaused | Resume transfers |
BlocklistStatusUpdated | Re-check affected addresses |
Pre-flight checklist
Before sending a transaction in production, verify:- Ethereum Virtual Machine
- Solana Virtual Machine
- Sender has sufficient token balance
- Sender has sufficient ETH for gas
- Neither the sender nor recipient is blocklisted (
isBlocklisted) - Transfers are not paused
- If using
transferFrom: the spender’s allowance covers the amount - If using
permit: the nonce matchesnonces(owner)and the deadline is in the future - If using ERC-3009: the nonce has not been used (
authorizationState) andvalidBeforeis in the future - Contract address matches Key Addresses
What to read next
Troubleshooting
Common errors and solutions
Examples
Code samples for common scenarios
Reference
Full function and program reference
Quickstart
Back to quickstart