⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

bridge_messages_getProof - JSON-RPC Method

Description

bridge_messages_getProof builds a Merkle proof for messages stored in a bridge outbound lane. Relayers use this proof together with the corresponding GRANDPA finality proof to deliver XCM or Snowbridge messages to destination networks.

The response bundles lane state, pending message commitments, and proof nodes so the target chain can independently verify inclusion without trusting the relayer.

Parameters

ParameterTypeRequiredDescription
bridgestringYesBridge instance to query ("westend", "polkadot_bulletin", "snowbridge").
laneIdstringYesHex-encoded 64-bit lane identifier (e.g., "0x0000000000000000" for lane 0).
beginnumberYesFirst outbound message nonce to include (inclusive).
endnumberYesLast outbound message nonce to include (inclusive).

Returns

FieldTypeDescription
laneStateobjectSnapshot of the outbound lane (latest generated, confirmed, and received nonces).
messagesarraySCALE-encoded outbound messages (payload + metadata).
proofarrayMerkle proof nodes required to verify each message on the destination chain.
bridgedHeaderHashstringThe bridged relay-chain header hash the proof is derived from.

Request Example

{
"jsonrpc": "2.0",
"method": "bridge_messages_getProof",
"params": [
{
"bridge": "snowbridge",
"laneId": "0x0000000000000000",
"begin": 1,
"end": 5
}
],
"id": 7
}

Response Example

{
"jsonrpc": "2.0",
"id": 7,
"result": {
"laneState": {
"latest_generated_nonce": 12,
"latest_received_nonce": 9,
"latest_confirmed_nonce": 9
},
"messages": [
"0x5804...",
"0x5a04..."
],
"proof": [
"0x1234...",
"0xabcd..."
],
"bridgedHeaderHash": "0x8cf2d8b30b86c7a8123ed5a3b92fe74195117cf1999440db0b9c7df24b5e70f1"
}
}

Code Examples

cURL

curl https://api-bridge-hub-polkadot.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "bridge_messages_getProof",
"params": [{
"bridge": "snowbridge",
"laneId": "0x0000000000000000",
"begin": 1,
"end": 5
}],
"id": 7
}'

JavaScript (polkadot.js)

import { ApiPromise, WsProvider } from '@polkadot/api';

const api = await ApiPromise.create({
provider: new WsProvider('wss://api-bridge-hub-polkadot.n.dwellir.com/YOUR_API_KEY')
});

const proof = await api.rpc.bridgeMessages.getProof({
bridge: 'snowbridge',
laneId: '0x0000000000000000',
begin: 1,
end: 5
});

console.log('Lane state:', proof.laneState.toHuman());
console.log('Proof nodes:', proof.proof.length);

Python (substrate-interface)

from substrateinterface import SubstrateInterface

substrate = SubstrateInterface(
url="wss://api-bridge-hub-polkadot.n.dwellir.com/YOUR_API_KEY"
)

payload = {
"bridge": "snowbridge",
"laneId": "0x0000000000000000",
"begin": 1,
"end": 5
}

result = substrate.rpc_request("bridge_messages_getProof", [payload])

lane_state = result['result']['laneState']
print("Latest generated nonce:", lane_state['latest_generated_nonce'])
print("Proof nodes:", len(result['result']['proof']))

Rust (jsonrpsee)

use jsonrpsee::{rpc_params, ws_client::WsClientBuilder};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = WsClientBuilder::default()
.build("wss://api-bridge-hub-polkadot.n.dwellir.com/YOUR_API_KEY")
.await?;

let response: serde_json::Value = client
.request(
"bridge_messages_getProof",
rpc_params![{"bridge": "snowbridge", "laneId": "0x0000000000000000", "begin": 1, "end": 5}]
)
.await?;

println!("Message proof: {response:#?}");
Ok(())
}

Usage Notes

  • Pair this proof with the GRANDPA finality proof from bridge_grandpa_getProof so the destination chain can authenticate the outbound lane updates.
  • Keep the nonce interval tight. Large ranges increase proof size and transaction weight on the target chain.
  • Acknowledge delivered messages by monitoring inbound lane confirmations to avoid resubmitting stale proofs.