This CLI tool allows you to interact with the Intmax2 network. It provides a comprehensive set of commands for managing assets, transactions, and account operations on the Intmax2 rollup.
- Account Management: Generate keys, check balances, view transaction history
- Asset Operations: Deposit, transfer, and withdraw assets
- Multi-Asset Support: Native tokens, ERC20, ERC721, ERC1155
- Batch Operations: Process multiple transfers in a single transaction
- Withdrawal Management: Sync, claim, and check status of withdrawals
- Mining Operations: View mining status and manage mining rewards
- Key Derivation: Generate Intmax2 keys from Ethereum private keys or backup keys
- Backup & Restore: Create and incorporate account history backups
- Rust and Cargo installed
- Environment variables properly configured
Copy the .env.example file to .env and configure it for your environment:
cp .env.example .envL1_RPC_URL: Ethereum RPC URL (e.g., Alchemy API endpoint for Sepolia)L2_RPC_URL: Layer 2 RPC URL (e.g., Scroll Sepolia)INDEXER_BASE_URL: URL for the Intmax2 indexer serviceSTORE_VAULT_SERVER_BASE_URL: URL for the store vault serverBALANCE_PROVER_BASE_URL: URL for the balance prover serviceVALIDITY_PROVER_BASE_URL: URL for the validity prover serviceWITHDRAWAL_SERVER_BASE_URL: URL for the withdrawal serverWALLET_KEY_VAULT_BASE_URL: URL for the wallet key vault service
The .env.example file contains default configurations for both staging testnet and local development environments.
To update the CLI tool to the latest version, pull the latest changes from the repository:
git pullAfter pulling the latest changes, rebuild the tool:
cargo build -rYou can see all commands and options by running:
cargo run -r -- --helpgenerate-key: Generate a new key pairpublic-key: Get a public key from a private keykey-from-eth: Derive an Intmax2 key from an Ethereum private keykey-from-backup-key: Derive an Intmax2 key from a backup keytransfer: Send a single transfer transactionbatch-transfer: Process multiple transfers from a CSV filedeposit: Deposit assets into the rollupwithdrawal: Initiate a withdrawal from the rollupbalance: Check account balanceuser-data: Get user data for an accounthistory: View transaction historywithdrawal-status: Check withdrawal statusmining-list: View mining status and rewardsclaim-status: Check claim statusclaim-withdrawals: Claim processed withdrawalsclaim-builder-reward: Claim block builder rewardssync-withdrawals: Synchronize withdrawal datasync-claims: Synchronize claim dataresync: Resynchronize account datapayment-memos: Get payment memos by namemake-backup: Create a backup of account historyincorporate-backup: Incorporate a backup into the local storecheck-validity-prover: Check the status of the validity prover
Generate a new key pair:
cargo run -r -- generate-keyGet a public key from a private key:
cargo run -r -- public-key --private-key 0x...Derive an Intmax2 key from an Ethereum private key:
cargo run -r -- key-from-eth --eth-private-key 0x...With custom redeposit and wallet indices:
cargo run -r -- key-from-eth --eth-private-key 0x... --redeposit-index 1 --wallet-index 2Derive an Intmax2 key from a backup key:
cargo run -r -- key-from-backup-key --backup-key 0x...cargo run -r -- balance --private-key 0x...Without syncing:
cargo run -r -- balance --private-key 0x... --without-sync cargo run -r -- user-data --private-key 0x...cargo run -r -- history --private-key 0x...With ordering and pagination:
cargo run -r -- history --private-key 0x... --order desc --from 1712345678Native token:
cargo run -r -- deposit \
--eth-private-key 0x... \
--private-key 0x... \
--token-type NATIVE \
--amount 100000000ERC20 token:
cargo run -r -- deposit \
--eth-private-key 0x... \
--private-key 0x... \
--token-type ERC20 \
--amount 20000000 \
--token-address 0x...ERC721 token:
cargo run -r -- deposit \
--eth-private-key 0x... \
--private-key 0x... \
--token-type ERC721 \
--token-address 0x... \
--token-id 0ERC1155 token:
cargo run -r -- deposit \
--eth-private-key 0x... \
--private-key 0x... \
--token-type ERC1155 \
--amount 3 \
--token-address 0x... \
--token-id 0Mining deposit:
cargo run -r -- deposit \
--eth-private-key 0x... \
--private-key 0x... \
--token-type NATIVE \
--amount 100000000000000000 \ # only O.1 ETH, 1 ETH, 10 ETH, and 100 ETH are allowed
--mining Single transfer:
cargo run -r -- transfer \
--private-key 0x... \
--to 0x... \ # recipient's intmax2 public key
--amount 100 \
--token-index 0 \
--wait true # wait for transaction to be settled onchainWith fee token specification:
cargo run -r -- transfer \
--private-key 0x... \
--to 0x... \
--amount 100 \
--token-index 0 \
--fee-token-index 1Using CSV file:
cargo run -r -- batch-transfer \
--private-key 0x... \
--csv-path "transfers.csv" \
--fee-token-index 0Example CSV format (transfers.csv):
recipient,amount,tokenIndex
0x123...,100,1
0x456...,200,2
0x789...,300,3Note: Batch transfers are limited to a maximum of 63 transfers per transaction.
Initiate a withdrawal:
cargo run -r -- withdrawal \
--private-key 0x... \
--to 0x... \
--amount 100 \
--token-index 0 \
--wait trueWith claim fee:
cargo run -r -- withdrawal \
--private-key 0x... \
--to 0x... \
--amount 100 \
--token-index 0 \
--with-claim-fee truecargo run -r -- withdrawal-status --private-key 0x...cargo run -r -- sync-withdrawals --private-key 0x...With fee token specification:
cargo run -r -- sync-withdrawals --private-key 0x... --fee-token-index 1cargo run -r -- claim-withdrawals \
--eth-private-key 0x... \
--private-key 0x...cargo run -r -- mining-list --private-key 0x...cargo run -r -- claim-status --private-key 0x...cargo run -r -- sync-claims \
--private-key 0x... \
--recipient 0x... \
--fee-token-index 0cargo run -r -- claim-builder-reward --eth-private-key 0x...Resync account data:
cargo run -r -- resync --private-key 0x...Deep resync (regenerate all balance proofs):
cargo run -r -- resync --private-key 0x... --deep trueGet payment memos by name:
cargo run -r -- payment-memos --private-key 0x... --name "memo-name"Create a backup of account history:
cargo run -r -- make-backup --private-key 0x...With custom directory and starting point:
cargo run -r -- make-backup --private-key 0x... --dir "/path/to/backup" --from 1712345678Incorporate a backup into the local store:
cargo run -r -- incorporate-backup --path "/path/to/backup/file"- For all commands that require private keys, ensure you're using the correct format (0x-prefixed hexadecimal).
- When using the
waitflag, the command will wait for the transaction to be processed before returning. - The
fee-token-indexparameter is optional for most commands. If not specified, the default token will be used for fees. - For security reasons, avoid storing private keys in plaintext files or environment variables in production environments.
- The wallet key vault service is used for deriving Intmax2 keys from Ethereum private keys. Make sure the
WALLET_KEY_VAULT_BASE_URLis properly configured in your.envfile to use this feature.