cast rpc
Perform a raw JSON-RPC request
$ cast rpc --help
Usage: cast rpc [OPTIONS] <METHOD> [PARAMS]...
Arguments:
<METHOD>
RPC method name
[PARAMS]...
RPC parameters
Interpreted as JSON:
cast rpc eth_getBlockByNumber 0x123 false => {"method":
"eth_getBlockByNumber", "params": ["0x123", false] ... }
Options:
-w, --raw
Send raw JSON parameters
The first param will be interpreted as a raw JSON array of params. If
no params are given, stdin will be used. For example:
cast rpc eth_getBlockByNumber '["0x123", false]' --raw => {"method":
"eth_getBlockByNumber", "params": ["0x123", false] ... }
-r, --rpc-url <URL>
The RPC endpoint
[env: ETH_RPC_URL=]
--flashbots
Use the Flashbots RPC URL with fast mode
(<https://rpc.flashbots.net/fast>).
This shares the transaction privately with all registered builders.
See:
<https://docs.flashbots.net/flashbots-protect/quick-start#faster-transactions>
--jwt-secret <JWT_SECRET>
JWT Secret for the RPC endpoint.
The JWT secret will be used to create a JWT for a RPC. For example,
the following can be used to simulate a CL `engine_forkchoiceUpdated`
call:
cast rpc --jwt-secret <JWT_SECRET> engine_forkchoiceUpdatedV2
'["0x6bb38c26db65749ab6e472080a3d20a2f35776494e72016d1e339593f21c59bc",
"0x6bb38c26db65749ab6e472080a3d20a2f35776494e72016d1e339593f21c59bc",
"0x6bb38c26db65749ab6e472080a3d20a2f35776494e72016d1e339593f21c59bc"]'
[env: ETH_RPC_JWT_SECRET=]
--rpc-timeout <RPC_TIMEOUT>
Timeout for the RPC request in seconds.
The specified timeout will be used to override the default timeout for
RPC requests.
Default value: 45
[env: ETH_RPC_TIMEOUT=]
--rpc-headers <RPC_HEADERS>
Specify custom headers for RPC requests
[env: ETH_RPC_HEADERS=]
-h, --help
Print help (see a summary with '-h')
-j, --threads <THREADS>
Number of threads to use. Specifying 0 defaults to the number of
logical cores
[aliases: jobs]
Display options:
--color <COLOR>
The color of the log messages
Possible values:
- auto: Intelligently guess whether to use color output (default)
- always: Force color output
- never: Force disable color output
--json
Format log messages as JSON
-q, --quiet
Do not print log messages
-v, --verbosity...
Verbosity level of the log messages.
Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).
Depending on the context the verbosity levels have different meanings.
For example, the verbosity levels of the EVM are:
- 2 (-vv): Print logs for all tests.
- 3 (-vvv): Print execution traces for failing tests.
- 4 (-vvvv): Print execution traces for all tests, and setup traces
for failing tests.
- 5 (-vvvvv): Print execution and setup traces for all tests,
including storage changes.