register_contract
Register custom smart contract definitions to query them by name. Provide the contract index and JSON function schemas for automatic encoding and decoding.
Instructions
Register a custom smart contract definition for use with query_contract.
Provide the contract's on-chain index and a JSON array of function definitions describing the binary input/output layout. Once registered, you can query the contract by name with automatic encoding and decoding.
Supported field types: uint8, uint16, uint32, uint64, int8, int16, int32, int64, identity (32-byte pubkey ↔ 60-char address), padding (skipped bytes).
Fields support "count" for arrays (e.g., 8 recipients) and "enum" for value→label mapping.
Example functions JSON: [{ "name": "getGateCount", "inputType": 6, "input": [], "output": [ { "name": "totalGates", "type": "uint64" }, { "name": "activeGates", "type": "uint64" } ] }]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Contract name (e.g., QGate) | |
| identity | No | Contract's 60-character Qubic identity (optional, informational) | |
| functions | Yes | JSON array of function definitions with input/output field schemas | |
| description | No | Human-readable description of the contract | |
| contractIndex | Yes | On-chain contract index |