nexus_getStorageAt
Read contract storage directly.
Contract ID (32-byte hex)
curl -X POST http://localhost:8545 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"nexus_getStorageAt","params":["0x1234...", "0x636f756e746572"],"id":1}'
{
"jsonrpc": "2.0",
"result": "0x2a00000000000000",
"id": 1
}
nexus_getEvents
Query contract events with filters.
Filter Object
| Field | Type | Description |
|---|
contract_id | string | Filter by contract (optional) |
event_name | string | Filter by event name (optional) |
from_block | number | Start block (optional) |
to_block | number | End block (optional) |
curl -X POST http://localhost:8545 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"nexus_getEvents",
"params":[{
"contract_id": "0x1234...",
"event_name": "Transfer",
"from_block": 100,
"to_block": 200
}],
"id":1
}'
{
"jsonrpc": "2.0",
"result": [
{
"contract_id": "0x1234...",
"event_name": "Transfer",
"data": "0xabcd...",
"block_height": 105,
"tx_hash": "0x5678...",
"log_index": 0
}
],
"id": 1
}
nexus_listContracts
List deployed contracts.
Max contracts to return (optional)
curl -X POST http://localhost:8545 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"nexus_listContracts","params":[10],"id":1}'
{
"jsonrpc": "2.0",
"result": [
{
"contract_id": "0x1234...",
"name": "MyToken",
"deployer": "0xabcd...",
"deployed_at": 100,
"code_hash": "0x5678..."
}
],
"id": 1
}
nexus_getProof
Get ZK proof for a block.
curl -X POST http://localhost:8545 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"nexus_getProof","params":["0x64"],"id":1}'
{
"jsonrpc": "2.0",
"result": {
"block_height": 100,
"state_root": "0x1234...",
"proof": "0xabcd...",
"proof_type": "stark"
},
"id": 1
}
nexus_batchViewCall
Execute multiple view calls in one request.
Array of view call objects
Call Object
| Field | Type | Description |
|---|
contract_id | string | Contract ID |
function | string | Function name |
args | string | Hex-encoded arguments |
curl -X POST http://localhost:8545 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"nexus_batchViewCall",
"params":[[
{"contract_id": "0x1234...", "function": "name", "args": ""},
{"contract_id": "0x1234...", "function": "symbol", "args": ""},
{"contract_id": "0x1234...", "function": "decimals", "args": ""}
]],
"id":1
}'
{
"jsonrpc": "2.0",
"result": [
{"success": true, "result": "0x4d79546f6b656e"},
{"success": true, "result": "0x4d544b"},
{"success": true, "result": "0x12"}
],
"id": 1
}
Contract Deployment Flow
- Build WASM - Compile your contract to WASM
- Create Transaction - Build a deploy transaction with the WASM code
- Sign Transaction - Sign with your private key
- Send Transaction - Submit via
nexus_sendRawTransaction
- Get Receipt - Poll
nexus_getTransactionReceipt for contract address
// Example using SDK
const wasm = await fs.readFile('./contract.wasm');
const { contractId } = await client.deployContract(wasm);
Contract Call Flow
- Build Transaction - Create a call transaction
- Sign Transaction - Sign with your private key (for state-changing calls)
- Send/Call - Use
nexus_sendRawTransaction for state changes, nexus_call for views
- Parse Result - Decode the return value
// View call (no signature needed)
const result = await client.queryContract(contractId, 'balanceOf', [address]);
// State-changing call (requires signature)
const txHash = await client.callContract(contractId, 'transfer', [to, amount]);