Prove API
API Endpoints
1. Request Log Proof
Endpoint: proof.testnet.polymer.zone
Method: POST
Request Header
Authorization: Bearer <token>
Request Body
{
"jsonrpc": "2.0",
"id": 1,
"method": "polymer_requestProof",
"params": [{
"srcChainId": 11155420,
"srcBlockNumber": 26421705,
"globalLogIndex": 15
}]
}
Request Parameters in order
The parameters are now enclosed in a single object (instead of an array of separate values):
Parameter | Type | Description |
---|---|---|
srcChainId | int64 | Source chain ID where the event occurred |
srcBlockNumber | int64 | Block number on the source chain containing the event |
globalLogIndex | int64 | Index of the log in the block (as per standard API response) |
Response Body (Success)
{
"jsonrpc": "2.0",
"id": 1,
"result": jobID
}
The response contains a jobID that uniquely identifies your request.
Response Fields
Parameter | Type | Description |
---|---|---|
jobID | int64 | The jobID returned by the proof request. |
2. Query Proof Status
Endpoint: proof.testnet.polymer.zone
Method: POST
Request Body
To query the status of a proof job, use the polymer_queryProof
method:
{
"jsonrpc": "2.0",
"id": 1,
"method": "polymer_queryProof",
"params": ["jobID"]
}
Response Body (Success)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"status": "complete",
"proof": "base64EncodedProofData..."
}
}
Response Fields
Parameter | Description |
---|---|
proof | Basee64 Encoded bytes payload containing the IAVL proof of the application's log stored in the Polymer Rollup. |
status | Indicates the current status of the proof (complete , error , pending ). |
Note: Proof bytes are base64
encodes at the moment, application must decode and then convert to hex
in order to pass it as call data to the application contract on-chain.
Usage Example
const response = await axios.post(
"<https://proof.testnet.polymer.zone/>",
{
jsonrpc: "2.0",
id: 1,
method: "polymer_requestProof",
params: [{
srcChainId: 11155420,
srcBlockNumber: 26421705,
globalLogIndex: 15
}]
},
{
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}
);
const jobId = response.data.result;
console.log(`Job ID: ${jobId}`);
Advanced Methods
Endpoint: proof.testnet.polymer.zone
Request Method: POST
Proof Request Body:
{
“jsonrpc”: “2.0”,
“id”: 1,
"method": "log_requestProof",
"params": [uint32, uint64, uint32, uint32]
}
Parameter | Type | Description |
---|---|---|
srcChainId | unit32 | The chain ID of the chain that emitted the log. |
srcBlockNumber | unit32 | Block number on the source chain where the log was emitted. |
txIndex | unit32 | Index of the transaction (receipt belongs to) in the array of all transactions in that block. |
localLogIndex | unit32 | Index of the event in the logs array of the receipt i.e local to your transaction. Note: This is not the global log index. |
Query Proof Body
{
"jsonrpc": "2.0",
"id": 1,
"method": "log_queryProof",
"params": [jobID]
}
Parameter | Type | Description |
---|---|---|
jobID | int64 | The jobID returned by the proof request. |