Skip to main content

nexus_getStorageAt

Read contract storage directly.
params[0]
string
required
Contract ID (32-byte hex)
params[1]
string
required
Storage key (hex)
result
string
Storage value (hex)
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_getStorageAt","params":["0x1234...", "0x636f756e746572"],"id":1}'
Response
{
  "jsonrpc": "2.0",
  "result": "0x2a00000000000000",
  "id": 1
}

nexus_getEvents

Query contract events with filters.
params[0]
object
required
Event filter object

Filter Object

FieldTypeDescription
contract_idstringFilter by contract (optional)
event_namestringFilter by event name (optional)
from_blocknumberStart block (optional)
to_blocknumberEnd block (optional)
result
array
Matching events
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
  }'
Response
{
  "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.
params[0]
number
Max contracts to return (optional)
result
array
Contract metadata
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_listContracts","params":[10],"id":1}'
Response
{
  "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.
params[0]
string
required
Hex block number
result
object
Proof data
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"nexus_getProof","params":["0x64"],"id":1}'
Response
{
  "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.
params[0]
array
required
Array of view call objects

Call Object

FieldTypeDescription
contract_idstringContract ID
functionstringFunction name
argsstringHex-encoded arguments
result
array
Results for each call
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
  }'
Response
{
  "jsonrpc": "2.0",
  "result": [
    {"success": true, "result": "0x4d79546f6b656e"},
    {"success": true, "result": "0x4d544b"},
    {"success": true, "result": "0x12"}
  ],
  "id": 1
}

Contract Deployment Flow

  1. Build WASM - Compile your contract to WASM
  2. Create Transaction - Build a deploy transaction with the WASM code
  3. Sign Transaction - Sign with your private key
  4. Send Transaction - Submit via nexus_sendRawTransaction
  5. 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

  1. Build Transaction - Create a call transaction
  2. Sign Transaction - Sign with your private key (for state-changing calls)
  3. Send/Call - Use nexus_sendRawTransaction for state changes, nexus_call for views
  4. 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]);