Documentation
Loading...
CLI

RPC Passthrough

Send raw JSON-RPC calls directly to a sandbox

Send any JSON-RPC method call directly to a BuildBear sandbox and print the result. Useful for debugging, inspecting chain state, or invoking BuildBear-specific RPC extensions without writing custom scripts.

buildbear rpc [rpcUrl] --method <method> [--params <json>] [options]

Arguments:

ArgumentRequiredDescription
rpcUrlNoBuildBear RPC URL. If omitted, reads from .buildbear.json

Options:

FlagTypeRequiredDescription
--method <method>stringYesJSON-RPC method name (e.g. eth_blockNumber)
--params <json>stringNoJSON array of parameters, or @path/to/file.json to read params from a file. Defaults to []
--quietflagNoSuppress output except errors

[!NOTE] buildbear rpc always outputs JSON — the --json flag is implicit and cannot be disabled.


Examples

Get the current block number:

buildbear rpc --method eth_blockNumber
{
  "method": "eth_blockNumber",
  "result": "0x140A2E0"
}

Get the balance of an address:

buildbear rpc --method eth_getBalance \
  --params '["0xYourWalletAddress", "latest"]'
{
  "method": "eth_getBalance",
  "result": "0x8AC7230489E80000"
}

Call a contract function (raw eth_call):

buildbear rpc --method eth_call \
  --params '[{"to": "0xContractAddress", "data": "0x06fdde03"}, "latest"]'

Read params from a file:

cat params.json
["0xYourWalletAddress", "latest"]

buildbear rpc --method eth_getBalance --params @params.json

Use an explicit RPC URL:

buildbear rpc https://rpc.buildbear.io/my-sandbox-id \
  --method eth_chainId

Common JSON-RPC methods

MethodDescription
eth_blockNumberLatest block number
eth_chainIdChain ID of the sandbox
eth_getBalanceNative token balance of an address
eth_callCall a contract function without a transaction
eth_gasPriceCurrent gas price
net_versionNetwork version

BuildBear-specific RPC methods

BuildBear sandboxes extend the standard JSON-RPC API with custom methods:

MethodDescription
buildbear_nativeFaucetFund native tokens to an address
buildbear_ERC20FaucetMint ERC-20 tokens to an address
evm_snapshotTake a state snapshot
evm_revertRevert to a snapshot

The buildbear faucet and buildbear snapshot commands are wrappers around these methods. Use buildbear rpc when you need direct access or when building custom tooling.


Output format

The output is always a JSON object with two keys:

{
  "method": "<the method you called>",
  "result": "<the raw JSON-RPC result>"
}