Documentation
Loading...
CLI

Project Initialization

Initialize a project with buildbear init

Interactive project initialization. Runs a wizard that creates a new sandbox and writes a .buildbear.json file in the current directory so that other CLI commands can find your sandbox without requiring an explicit RPC URL argument.

buildbear init

Options:

FlagDescription
--jsonOutput as JSON after initialization

What it does

  1. Checks whether .buildbear.json already exists in the current directory. If it does, prompts you to confirm overwrite.
  2. Fetches the list of supported networks so you can pick a chain.
  3. Walks you through the configuration interactively:
PromptRequiredNotes
Chain IDYesNumeric chain ID of the network to fork (e.g. 1 for Ethereum)
Fork block numberNoLeave blank to fork from the latest block
Custom chain IDNoOverride the chain ID inside the sandbox (defaults to the network default)
Prefund addressesNoComma-separated wallet addresses to pre-fund on creation
  1. Creates the sandbox and writes .buildbear.json:
{
  "rpcUrl": "https://rpc.buildbear.io/<sandbox-id>",
  "network": "Ethereum",
  "chainId": 1,
  "forkChainId": 1,
  "explorerUrl": "https://explorer.buildbear.io/<sandbox-id>"
}

After init

Any command that accepts an optional [rpcUrl] argument will automatically read from .buildbear.json if no URL is provided. For example:

# With .buildbear.json present — no URL needed
buildbear status
buildbear faucet native --address 0xYourAddress

# Without .buildbear.json — pass the URL explicitly
buildbear status https://rpc.buildbear.io/my-sandbox-id

Example session

$ buildbear init

? Enter chain ID: 1
? Enter fork block number (leave blank for latest):
? Enter custom chain ID (leave blank for default):
? Enter addresses to prefund (comma-separated, leave blank to skip):

 Sandbox created.
  RPC URL:     https://rpc.buildbear.io/my-sandbox-id
  Explorer:    https://explorer.buildbear.io/my-sandbox-id
  Config file: .buildbear.json

Committing .buildbear.json

.buildbear.json stores a personal sandbox URL — it is safe to commit for team-shared sandboxes, but keep in mind that each developer on your team may prefer their own sandbox. A common pattern is to add .buildbear.json to .gitignore and let each developer run buildbear init locally.