Skip to main content

Usage

dokrypt chain <subcommand> [flags]

Persistent Flags

FlagTypeDefaultDescription
--chainstringTarget chain (for multi-chain setups)

Subcommands

SubcommandDescription
mineMine blocks
set-balanceSet account balance
time-travelAdvance chain time
set-gas-priceSet base gas price
impersonateImpersonate an account
stop-impersonatingStop impersonating
resetReset chain to genesis or fork
infoShow chain information

mine

Mine one or more blocks.
dokrypt chain mine [n]
ArgumentRequiredDefaultDescription
nNo1Number of blocks to mine
Uses anvil_mine (or falls back to calling evm_mine in a loop).

Examples

# Mine 1 block
dokrypt chain mine

# Mine 10 blocks
dokrypt chain mine 10

# Mine 100 blocks on a specific chain
dokrypt chain mine 100 --chain polygon

set-balance

Set an account’s ETH balance.
dokrypt chain set-balance <address> <amount-eth>
ArgumentRequiredDescription
addressYesAccount address (0x-prefixed)
amount-ethYesBalance in ETH (e.g., 500, 10.5)
Converts ETH to wei and calls anvil_setBalance (or hardhat_setBalance).

Examples

dokrypt chain set-balance 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 500

time-travel

Advance the chain’s block timestamp into the future.
dokrypt chain time-travel <duration>
ArgumentRequiredDescription
durationYesTime to advance

Supported Duration Formats

FormatExampleDescription
Go duration1h30mStandard Go duration
Days7d7 days
Hours24h24 hours
Minutes30m30 minutes
Seconds3600Raw seconds (no suffix)
Calls evm_increaseTime then mines a block to apply the timestamp change.

Examples

# Advance 1 hour
dokrypt chain time-travel 1h

# Advance 7 days
dokrypt chain time-travel 7d

# Advance 3600 seconds
dokrypt chain time-travel 3600
Time-travel is essential for testing vesting schedules, timelocks, and any time-dependent smart contract logic.

set-gas-price

Set the base gas price for the next blocks.
dokrypt chain set-gas-price <gwei>
ArgumentRequiredDescription
gweiYesGas price in gwei
Calls anvil_setMinGasPrice or hardhat_setNextBlockBaseFeePerGas.

Examples

dokrypt chain set-gas-price 50

impersonate

Start impersonating an account. Transactions from this address will succeed without requiring the private key.
dokrypt chain impersonate <address>
ArgumentRequiredDescription
addressYesAddress to impersonate
Calls anvil_impersonateAccount or hardhat_impersonateAccount.

Examples

# Impersonate a Uniswap governance address
dokrypt chain impersonate 0x1a9C8182C09F50C8318d769245beA52c32BE35BC

stop-impersonating

Stop impersonating an account.
dokrypt chain stop-impersonating <address>

Examples

dokrypt chain stop-impersonating 0x1a9C8182C09F50C8318d769245beA52c32BE35BC

reset

Reset the chain to genesis state or to a new fork.
dokrypt chain reset [flags]
FlagTypeDefaultDescription
--forkstringFork URL to reset to
--blockuint640Fork at a specific block number

Examples

# Reset to genesis
dokrypt chain reset

# Reset to a mainnet fork
dokrypt chain reset --fork https://eth.llamarpc.com --block 18000000

info

Display chain information including chain ID, RPC URL, current block, and block timestamp.
dokrypt chain info

Example Output

Chain: ethereum
  Chain ID:    31337
  RPC URL:     http://localhost:8545
  Block:       42
  Timestamp:   1705312200

Multi-chain

dokrypt chain info --chain polygon