Skip to content

Without Hardhat (CLI) ​

The node binary can send a wrapped EVM call directly. This is useful for scripts, for operators, and for understanding what the SDK does.

Prerequisites ​

  • BKCd built from source (Repositories) — the binary is the CLI as well as the node.
  • A funded key in a keyring: BKCd keys add deployer --recover (mnemonic) or a key you created.
  • Compiled bytecode, e.g. solc --optimize --bin MyToken.sol.

Deploy a contract ​

An empty --to means contract creation; --data is the init code in hex without 0x.

bash
ADDR=$(BKCd keys show deployer -a)
SEQ=$(curl -s https://api.bkc.network/cosmos/auth/v1beta1/accounts/$ADDR | jq -r .account.sequence)

BKCd tx bkc execute-evm-call \
  --from deployer \
  --chain-id bkc-testnet \
  --node https://comet-rpc.bkc.network:443 \
  --call-nonce "$SEQ" \
  --data "$(cat MyToken.bin)" \
  --value 0 \
  --gas-limit 1500000 \
  --max-fee-per-gas 10000000 \
  --max-priority-fee-per-gas 0 \
  --gas 2100000 \
  --gas-prices 5000000bkc \
  -y -o json
FlagMeaning
--call-noncethe account's current Cosmos sequence
--gas-limitEVM gas budget
--gasCosmos gas — must be ≥ --gas-limit; add ~600,000 for the signed envelope
--max-fee-per-gas / --max-priority-fee-per-gaswhat GASPRICE reports inside the EVM; not charged a second time
--totarget contract for a call; omit for creation
--valuewei to send

--gas auto does not work: BKC cannot simulate transactions.

Find the contract address ​

The broadcast returns the Cosmos hash. The EVM hash is in the ethereum_tx event, and the receipt carries the address:

bash
COSMOS_HASH=…
ETH_HASH=$(curl -s https://api.bkc.network/cosmos/tx/v1beta1/txs/$COSMOS_HASH \
  | jq -r '.tx_response.events[] | select(.type=="ethereum_tx") | .attributes[] | select(.key=="ethereumTxHash") | .value')

curl -s -X POST https://rpc.bkc.network -H 'content-type: application/json' \
  --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"$ETH_HASH\"],\"id\":1}" \
  | jq '.result | {status, contractAddress, gasUsed}'

Call a contract ​

Encode calldata with any ABI tool (cast calldata, ethers interface.encodeFunctionData) and pass the target:

bash
BKCd tx bkc execute-evm-call --from deployer --chain-id bkc-testnet \
  --node https://comet-rpc.bkc.network:443 \
  --to 0xYourContract \
  --data a9059cbb000000000000000000000000…   # transfer(address,uint256), no 0x
  --call-nonce "$SEQ" --value 0 --gas-limit 100000 \
  --max-fee-per-gas 10000000 --max-priority-fee-per-gas 0 \
  --gas 700000 --gas-prices 5000000bkc -y

Reads need no transaction — use eth_call on the JSON-RPC.

Native transfers ​

Native BKC moves with the bank module, or over the EVM with an empty --data and a --value. The EVM path is what the explorer indexes as a transfer with its own page:

bash
BKCd tx bank send deployer bkc1recipient… 1000000000000000000bkc \
  --chain-id bkc-testnet --node https://comet-rpc.bkc.network:443 \
  --gas 300000 --gas-prices 5000000bkc -y

BKC testnet is unaudited. Do not hold value on it.