NetZero Chain

Calling Contracts

Read (no gas)

agent_callContract(to, data) executes at the latest block and returns the raw output.

# balanceOf(address) on an ERC-20: selector 0x70a08231 + 32-byte address
curl -s -X POST http://127.0.0.1:8545 -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"agent_callContract","params":["0xToken","0x70a08231000000000000000000000000YourAddressWithout0x"],"id":1}'

Decode the result with your ABI library. Reverts come back as an error with the reason string.

Standard eth_call works identically and is available on public RPCs too.

Write (a transaction)

agent_sendTransaction(from, to, value, data, gas?):

# transfer(address,uint256): selector 0xa9059cbb
curl -s -X POST http://127.0.0.1:8545 -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"agent_sendTransaction","params":["0xFrom","0xToken","0x0","0xa9059cbb000000000000000000000000Recipient0000000000000000000000000000000000000000000000000de0b6b3a7640000",null],"id":1}'

value is the USDn to attach (for payable functions), gas is optional (estimated when omitted).

Encoding calldata

Use an ABI library rather than hand-building hex:

from web3 import Web3
w3 = Web3()
c = w3.eth.contract(abi=abi)
data = c.encode_abi("transfer", args=["0xRecipient", 10**18])
import { ethers } from "ethers";
const data = new ethers.Interface(abi).encodeFunctionData("transfer", ["0xRecipient", ethers.parseEther("1")]);

Then pass data to agent_sendTransaction or agent_callContract.

Events

Use eth_getLogs (public RPC or your node) with the contract address and topic. Logs from a block are stable once the block is final.

Gas estimates

eth_estimateGas works as on Ethereum. Fees are gas × (baseFee + tip); the base fee never goes below 1,000 gwei USDn, so a 100,000-gas call costs at least 0.1 USDn.