Proofing

Some of the Flex Liquidity Pool takers rely on Flex Proof protocol. The proof protocol provides a way to verify an event occurrence on other chain.

The fastest way to prove an event for the pool protocol is using signature proof variant. This proof can be issued by Flex Node, which is hosted at https://node.swaps.io . It supports the following HTTP API:

  • Get Chain Proof Info

    • GET /api/v0/proof/chain/<chain> , where:

    • <chain> (path param) - chain ID to get proof info of

  • Get Event Proof

    • GET /api/v0/proof?chain=<chain>&hash=<hash>&log=<log> , where:

    • <chain> (query param) - chain ID of the event

    • <hash> (query param) - hash of the event transaction

    • <log> (query param) - log index in the transaction

Request & response examples:

# Get proof info for Optimism chain (ID 10):
curl 'https://node.swaps.io/api/v0/proof/chain/10'

# Example of successful chain proof info response:
{
  "chain": 10,
  "latestBlock": 138194551,
  "minConfirmations": 30,
  "provableBlock": 138194521,
  "signer": "0xb0baabc608dd2d1704d190ccdeecca624104c6ac"
}


# Get proof of Arbitrum chain (ID 42161) event occured in transaction with hash
# "0xd97a2a1306bfbdde8c0b929c2aa85fae38699af3d1ec581258bd6a936fe50f46" at index #0:
curl 'https://node.swaps.io/api/v0/proof?chain=42161&hash=0xd97a2a1306bfbdde8c0b929c2aa85fae38699af3d1ec581258bd6a936fe50f46&log=0'

# Example of successful event proof response:
{
  "chain": 42161,
  "hash": "0xd97a2a1306bfbdde8c0b929c2aa85fae38699af3d1ec581258bd6a936fe50f46",
  "log": 0,
  "block": 350395852,
  "confirmations": 5180366,
  "minConfirmations": 240,
  "emitter": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
  "topics": [
    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
    "0x0000000000000000000000009f6d65052ad5818768fcbac3b799a67f2b8e7170",
    "0x000000000000000000000000b58b4060745ec6377ea0b65c9f2eb4e1c4068374"
  ],
  "data": "0x0000000000000000000000000000000000000000000000000000000028351f10",
  "proof": "0x000000000000000000000000000000000000000000000000000000000000012c8ad459dfe203ceeec8eed289d95a9c81dc8c810a74dd647f2b9df98b305900a1356b3ee37ac75b752167cbf41427933bf9be4bd15c67680277ea2ddb9eb43f9f1c",
  "signature": "0x8ad459dfe203ceeec8eed289d95a9c81dc8c810a74dd647f2b9df98b305900a1356b3ee37ac75b752167cbf41427933bf9be4bd15c67680277ea2ddb9eb43f9f1c",
  "signer": "0xb0baabc608dd2d1704d190ccdeecca624104c6ac"
}


# Example of an error response (note "error" field presented):
{
  "error": "Block 355577210 of transaction 42161/0x64d1d125349bf365fb42064763274df23c5f21c40bc09a49868bae5d2ec6a4df has only 69 confirmations - at least 240 required to prove log #1 (wait 171 more blocks)"
}

The result proof value can then be passed as bytes to a taker that requires it - for example, giveProof param of TransferTaker.

Last updated