Documentation
Loading...
CLI

Contract Inspection

Fetch source code, ABIs, and verify smart contracts

Inspect and verify smart contracts deployed to a BuildBear sandbox. Fetch verified source code, retrieve ABIs, or submit contracts for verification.


contract source

Get the verified source code for a contract deployed in a sandbox.

buildbear contract source <rpcUrl> --address <contractAddress> [options]

Arguments:

ArgumentRequiredDescription
rpcUrlYesBuildBear RPC URL

Options:

FlagTypeRequiredDescription
--address <contractAddress>stringYesContract address
--jsonflagNoOutput as JSON
--quietflagNoSuppress output except errors

Example:

buildbear contract source https://rpc.buildbear.io/my-sandbox-id \
  --address 0xContractAddress

Returns the verified Solidity source code for the contract, including imports and compiler settings if available.


contract abi

Get the ABI for a contract deployed in a sandbox.

buildbear contract abi <rpcUrl> --address <contractAddress> [options]

Arguments:

ArgumentRequiredDescription
rpcUrlYesBuildBear RPC URL

Options:

FlagTypeRequiredDescription
--address <contractAddress>stringYesContract address
--jsonflagNoOutput as JSON
--quietflagNoSuppress output except errors

Example:

buildbear contract abi https://rpc.buildbear.io/my-sandbox-id \
  --address 0xContractAddress

Example — pipe ABI into another tool:

buildbear contract abi https://rpc.buildbear.io/my-sandbox-id \
  --address 0xContractAddress \
  --json | jq '.[].name'

contract verify

Verify a smart contract on a BuildBear sandbox. This acts as a passthrough to the BuildBear verification endpoint, making it compatible with Foundry and Hardhat verify plugins.

buildbear contract verify <rpcUrl> --address <contractAddress> [options]

Arguments:

ArgumentRequiredDescription
rpcUrlYesBuildBear RPC URL

Options:

FlagTypeDefaultRequiredDescription
--address <contractAddress>stringYesContract address to verify
--type <type>stringetherscanNoVerification type: etherscan or sourcify
--jsonflagNoOutput as JSON
--quietflagNoSuppress output except errors

Example — Etherscan-style verification:

buildbear contract verify https://rpc.buildbear.io/my-sandbox-id \
  --address 0xYourContractAddress \
  --type etherscan

Example — Sourcify verification:

buildbear contract verify https://rpc.buildbear.io/my-sandbox-id \
  --address 0xYourContractAddress \
  --type sourcify

Verification endpoints

The CLI submits verification requests to:

TypeEndpoint
etherscanhttps://rpc.buildbear.io/verify/etherscan/<sandbox-id>
sourcifyhttps://rpc.buildbear.io/verify/sourcify/server/<sandbox-id>

These endpoints are compatible with Foundry's forge verify-contract --verifier flag and Hardhat's hardhat-etherscan plugin. Point your tool's verifier URL at the appropriate endpoint for your sandbox.


Using with Foundry

forge verify-contract \
  0xYourContractAddress \
  src/MyContract.sol:MyContract \
  --verifier etherscan \
  --verifier-url https://rpc.buildbear.io/verify/etherscan/my-sandbox-id \
  --etherscan-api-key placeholder