Skip to content
LogoLogo

tevm set-code

tevm set-code runs this operation: Set bytecode at an address in local state. Reach for it when you need the operation from a terminal, CI job, or shell script.

Working example

The commands below were run with @tevm/cli@1.0.0-rc.151. They create their own local prerequisites or use the named public endpoint, so no hidden process is required.

npm install --global @tevm/cli@1.0.0-rc.151
tevm session docs --local --json
tevm set-code --address 0x1000000000000000000000000000000000000001 --bytecode 0x6080604052348015600e575f5ffd5b50600436106030575f3560e01c80633fb5c1cb1460345780638381f58a146045575b5f5ffd5b6043603f3660046098565b605e565b005b604c5f5481565b60405190815260200160405180910390f35b5f8190556040518181527f2fd81fd19d3c5c4b396dd13f451dafc8bcac1b3094c49c5fa90e68456323f0e39060200160405180910390a150565b5f6020828403121560a7575f5ffd5b503591905056fea26469706673582212203ef1a75b09ee91fb7f995d62885094508a883f40d776c10ba4f1d1427a64bd8b64736f6c63430008230033 --session docs --run --json

Output captured from the final command:

{
  "ok": true,
  "command": "set-code",
  "result": {},
  "session": "docs"
}

Arguments and flags

The command schema in packages/tevm-cli/src/commands/setCode.tsx exposes:

KindSyntaxDescription
Flag--address [address]Contract address to set bytecode for (env: TEVM_ADDRESS)
Flag--bytecode [bytecode]Bytecode to set at the address (env: TEVM_BYTECODE)
Flag-r, --runRun directly without interactive parameter editing (env: TEVM_RUN) (default: false)
Flag--rpc [rpc]RPC endpoint (env: TEVM_RPC)
Flag--jsonEmit the stable machine-readable JSON envelope (env: TEVM_JSON) (default: false)
Flag-h, --helpShow help

--json and --session <name> are global options accepted before routing. See the CLI overview for their environment-variable forms and execution model.

Neighbours

CLI overview · tevm set-account · tevm set-nonce