Contract
Smart contract operations on the Zetrix blockchain. Covers blob generation, signing, submitting, read-only querying, and invocation history filtering for deployed contracts. Includes both standard (user pays gas) and paymaster-sponsored (gas-free) contract invocations.
Generates a transaction blob for invoking a smart contract method. Either contractKey (a registered alias) or contractAddress (on-chain address) must be provided. If both are given, contractAddress takes precedence.
Flow:
Call this endpoint with contract identifier, method name, and input parameters
Sign the returned
blobusing/contract/sign-blobSubmit via
/contract/submit
Value: For payable contract methods, specify value in drops (1 ZETRIX = 10^6 drops). Use 0 for non-payable methods.
Bearer access token. Include in all requests as: Authorization: Bearer <your_access_token>
API key for authentication. Include in all requests.
ehg7q2i6aN8jY6BbHqN5q42KsHQFRwl260jqAkAURequest to generate a blob for a smart contract invocation.
Registered contract alias. Either this or contractAddress must be provided.
my-token-contractOn-chain contract address. Takes precedence over contractKey if both are given.
ZTX3JK2mN9pQ7rS4tU5vW6xY8zA0bC1dE2fG3hI4Contract method to invoke.
transferAddress of the transaction initiator (pays gas).
ZTX3PGkYe55MJdKLMEQDShy5tR1as7kYJFZbUOptional source address override.
ZTX value in drops to send with the invocation. Use 0 for non-payable methods.
0Contract invocation blob generated. Sign using /contract/sign-blob then submit via /contract/submit.
POST /ztx/contract/generate-blob HTTP/1.1
Host: api-sandbox.zetrix.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-API-Key: text
Content-Type: application/json
Accept: */*
Content-Length: 203
{
"contractKey": "my-token-contract",
"method": "transfer",
"inputParameters": {
"to": "ZTX3TkqopBiDmHFMEBr5U7n9HfNqBa7LBhV2Q",
"amount": "1000000"
},
"txInitiator": "ZTX3PGkYe55MJdKLMEQDShy5tR1as7kYJFZbU",
"value": 0
}Contract invocation blob generated. Sign using /contract/sign-blob then submit via /contract/submit.
{
"success": true,
"object": {
"blob": "0A255A5458334A64656A33434B7443724253547851747456666E6456...",
"hash": "e3ea722dfaf33ca7a970348f55be0ba51abedfbd15e840ffb63fd9d7202b7eb2",
"actualFee": 20000
},
"messages": [],
"timestamp": "2026-01-01T10:00:00Z",
"traceId": "trace-007"
}Signs a contract invocation blob using a single private key. Server-side Ed25519 signing convenience endpoint.
Input:
blob— The hex-encoded blob from/contract/generate-blobprivateKey— A 56-character Ed25519 private key
Output: A SignerEntity list with signBlob (signature) and publicKey. Pass as listSigner to /contract/submit.
Bearer access token. Include in all requests as: Authorization: Bearer <your_access_token>
API key for authentication. Include in all requests.
ehg7q2i6aN8jY6BbHqN5q42KsHQFRwl260jqAkAURequest to sign a contract invocation blob using a single private key.
Hex-encoded contract invocation blob to sign.
0A255A5458334A64656A33434B7443724253547851747456666E6456...56-character Ed25519 private key of the transaction initiator.
privBsRTkj1234567890abcdefghijklmnopqrstuvwxyz12345678Blob signed. Use the returned listSigner array in /contract/submit.
POST /ztx/contract/sign-blob HTTP/1.1
Host: api-sandbox.zetrix.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-API-Key: text
Content-Type: application/json
Accept: */*
Content-Length: 140
{
"blob": "0A255A5458334A64656A33434B7443724253547851747456666E6456...",
"privateKey": "privBsRTkj1234567890abcdefghijklmnopqrstuvwxyz12345678"
}Blob signed. Use the returned listSigner array in /contract/submit.
{
"success": true,
"object": [
{
"signBlob": "b8f4a2c3d1e0f9a8b7c6d5e4f3a2b1c0...",
"publicKey": "b00179b4adb1d3188aa1b98d6977a837..."
}
],
"messages": [],
"timestamp": "2026-01-01T10:00:01Z",
"traceId": "trace-008"
}Submits a signed contract invocation blob to the Zetrix blockchain. Final step in the standard contract invocation flow.
Pre-conditions:
blobfrom/contract/generate-bloblistSignerfrom/contract/sign-blobor your own signerhash— 64-character transaction hash from the generate stepinitiator— 37-character address of the transaction initiator
After Submission: Use the returned hash with /tx/query to confirm on-chain status.
Bearer access token. Include in all requests as: Authorization: Bearer <your_access_token>
API key for authentication. Include in all requests.
ehg7q2i6aN8jY6BbHqN5q42KsHQFRwl260jqAkAURequest to submit a signed contract invocation blob to the blockchain.
Hex-encoded signed blob from /contract/generate-blob.
0A255A5458334A64656A33434B7443724253547851747456666E6456...64-character transaction hash from the generate step.
e3ea722dfaf33ca7a970348f55be0ba51abedfbd15e840ffb63fd9d7202b7eb237-character Zetrix address of the transaction initiator.
ZTX3PGkYe55MJdKLMEQDShy5tR1as7kYJFZbUContract invocation submitted. Use the returned hash to query the result.
POST /ztx/contract/submit HTTP/1.1
Host: api-sandbox.zetrix.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-API-Key: text
Content-Type: application/json
Accept: */*
Content-Length: 312
{
"blob": "0A255A5458334A64656A33434B7443724253547851747456666E6456...",
"hash": "e3ea722dfaf33ca7a970348f55be0ba51abedfbd15e840ffb63fd9d7202b7eb2",
"initiator": "ZTX3PGkYe55MJdKLMEQDShy5tR1as7kYJFZbU",
"listSigner": [
{
"signBlob": "b8f4a2c3d1e0f9a8b7c6d5e4f3a2b1c0...",
"publicKey": "b00179b4adb1d3188aa1b98d6977a837..."
}
]
}Contract invocation submitted. Use the returned hash to query the result.
{
"success": true,
"object": {
"hash": "e3ea722dfaf33ca7a970348f55be0ba51abedfbd15e840ffb63fd9d7202b7eb2"
},
"messages": [],
"timestamp": "2026-01-01T10:00:02Z",
"traceId": "trace-009"
}Performs a read-only query against a deployed smart contract. No transaction is created, no gas is consumed, and no state change occurs.
Use Cases:
Check token balances
Read contract configuration
Verify ownership or access rights
Fetch metadata stored in the contract
Response: The object field contains the raw JSON returned by the contract method. Its structure varies per contract and method.
Bearer access token. Include in all requests as: Authorization: Bearer <your_access_token>
API key for authentication. Include in all requests.
ehg7q2i6aN8jY6BbHqN5q42KsHQFRwl260jqAkAURequest for a read-only smart contract query.
Registered contract alias in the Zetrix platform.
my-token-contractRead-only contract method to call.
balanceOfContract query result. The object field contains the method's return value.
POST /ztx/contract/query HTTP/1.1
Host: api-sandbox.zetrix.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-API-Key: text
Content-Type: application/json
Accept: */*
Content-Length: 126
{
"contractKey": "my-token-contract",
"method": "balanceOf",
"inputParameters": {
"address": "ZTX3PGkYe55MJdKLMEQDShy5tR1as7kYJFZbU"
}
}Contract query result. The object field contains the method's return value.
{
"success": true,
"object": {
"balance": "5000000000"
},
"messages": [],
"timestamp": "2026-01-01T10:00:00Z",
"traceId": "trace-010"
}Retrieves a paginated history of smart contract invocations, filtered by query parameters.
Supported Filter Parameters:
contractKey— Filter by contract aliasmethod— Filter by contract method nametxInitiator— Filter by initiator addressstatus—INITIATEDorSUBMITTEDpage— Page number (1-based)pageSize— Records per page
Example:
GET /contract/history/filter?contractKey=my-token-contract&method=transfer&page=1&pageSize=20Bearer access token. Include in all requests as: Authorization: Bearer <your_access_token>
Filter by contract key (registered alias).
my-token-contractFilter by contract method name.
transferFilter by transaction initiator address.
ZTX3PGkYe55MJdKLMEQDShy5tR1as7kYJFZbUFilter by status.
Page number (1-based).
1Records per page.
20API key for authentication. Include in all requests.
ehg7q2i6aN8jY6BbHqN5q42KsHQFRwl260jqAkAUPaginated contract history returned.
GET /ztx/contract/history/filter?mapParam=[object+Object] HTTP/1.1
Host: api-sandbox.zetrix.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-API-Key: text
Accept: */*
Paginated contract history returned.
{
"success": true,
"object": {
"page": 1,
"pageSize": 20,
"totalPages": 5,
"totalElements": 93,
"content": [
{
"id": 1,
"contractKey": "my-token-contract",
"address": "ZTX3JK2mN9pQ7rS4tU5vW6xY8zA0bC1dE2fG3hI4",
"txInitiator": "ZTX3PGkYe55MJdKLMEQDShy5tR1as7kYJFZbU",
"method": "transfer",
"inputParameters": "{\"to\":\"ZTX3T...\",\"amount\":\"1000000\"}",
"txHash": "e3ea722dfaf33ca7a970348f55be0ba51abedfbd15e840ffb63fd9d7202b7eb2",
"status": "SUBMITTED",
"createdAt": "2026-01-01T09:00:00Z",
"updatedAt": "2026-01-01T09:00:05Z"
}
]
},
"messages": [],
"timestamp": "2026-01-01T10:00:00Z",
"traceId": "trace-013"
}Last updated