Back to Diem

Method Get Events With Proofs

json-rpc/docs/method_get_events_with_proofs.md

latest5.5 KB
Original Source

Method get_events_with_proof

Description

Fetch the events for a given event stream along with the necessary cryptographic proofs required to validate them.

Parameters

NameTypeDescription
keystringGlobally unique identifier of an event stream
startunsigned int64The start of the event with this sequence number
limitunsigned int64The maximum number of events retrieved

Note:

  1. For sentpayment and receivedpayment events, call get_account to get the event key of the event treams for a given user account.
  2. For currency related events, call get_currencies to get the event keys (for example: to LBR xchange rate change event key).
  3. Since this runs against the latest known version of the server, a batched call with get_state_proof is recommended in order to be able to validate the proofs. See the integration tests for an example.

In order to see an example of how to verify the proofs, please refer to the integration tests.

Returns

Returns an array of hex encoded strings of raw BCS bytes of EventWithProof type for the requested version (or the latest known version at the moment of the call if none is provided).

Notice this requires a BCS decoder implementing the EventWithProof type in order to decode the return values.

Example JSON-RPC response:


{
  "id": 1,
  "jsonrpc": "2.0",
  "diem_chain_id": 4,
  "diem_ledger_timestampusec": 1608143037098724,
  "diem_ledger_version": 100,
  "result": [
        {
            "event_with_proof": "00000000000000000000000000000000001800000000000000000000000000000000000000000a550c18000000000000000007000000000000000000000000000000010b4469656d4163636f756e74124372656174654163636f756e744576656e7400180000000000000000000000000a550c18000000000000000007205ea5bec9fcf7db9ca734b48ff2c30d333a47b265124e8f8d82c5933e99d38f4e20e2671b124cdd8bc5fdfdf9c3f385791c1e8e4b36cb9b7faa75a0aceffd2dc55420056518b61548197ec9cfdef5ccc9df06d7fbf9a65929ca6a001a6ba3e94e29f62057304aafb410c2e4903517fa60a60b644adac57a3531a647bffcf4f31370174c20cd295ff537e3415397ffcf822d89dd024be06c98c66ce1dd20c0452aab8e21bd201323a27e3b440505760f098720f643944b57516dff978701849ab53c6ccb6ab420cd150532557fe95d883e30dbd2723f41f85384de0993a24b81098a6d141fcd4020284bcdb5381519e4bd76634814026598babc7629d4f9ba827e4c6ae25557d25e209f181a5a463b39e5be659ebc0f5174936f3b8f34a443b98239ffeb43f5ec79a32063935d32737f16a01bf69f5a2df0fed9e1e659a1ac66a421cc7515884a24b61d00000000000000000004204d70a96fb83a2dcf437dd9e3dc9fb80d671a6ea84cd91aa047d7039d56383ad220b0068256b82f6f2cd8056967798b4c7a589ac1f8062a39d227b4ceb3530a8ff420d222a263f1142ed5089ddf8694b9fa98e981e891e63fd28f05d8d80f03a207de2000a98c24050c7371aa9ddde3f8b4263f83c41b94781b181a96db4b61e2ecdf19"
        },
        {
            "event_with_proof": "00000000000000000100000000000000001800000000000000000000000000000000000000000a550c18010000000000000007000000000000000000000000000000010b4469656d4163636f756e74124372656174654163636f756e744576656e7400180000000000000000000000000b1e55ed010000000000000007205ea5bec9fcf7db9ca734b48ff2c30d333a47b265124e8f8d82c5933e99d38f4e20e2671b124cdd8bc5fdfdf9c3f385791c1e8e4b36cb9b7faa75a0aceffd2dc55420056518b61548197ec9cfdef5ccc9df06d7fbf9a65929ca6a001a6ba3e94e29f62057304aafb410c2e4903517fa60a60b644adac57a3531a647bffcf4f31370174c20cd295ff537e3415397ffcf822d89dd024be06c98c66ce1dd20c0452aab8e21bd201323a27e3b440505760f098720f643944b57516dff978701849ab53c6ccb6ab420cd150532557fe95d883e30dbd2723f41f85384de0993a24b81098a6d141fcd4020284bcdb5381519e4bd76634814026598babc7629d4f9ba827e4c6ae25557d25e209f181a5a463b39e5be659ebc0f5174936f3b8f34a443b98239ffeb43f5ec79a32063935d32737f16a01bf69f5a2df0fed9e1e659a1ac66a421cc7515884a24b61d00000000000000000004203296918711e9dfa27434d4bff7b9d489947392bad89d55eea0361c6d5884582f20b0068256b82f6f2cd8056967798b4c7a589ac1f8062a39d227b4ceb3530a8ff420d222a263f1142ed5089ddf8694b9fa98e981e891e63fd28f05d8d80f03a207de2000a98c24050c7371aa9ddde3f8b4263f83c41b94781b181a96db4b61e2ecdf19"
        },
        {
            "event_with_proof": "00000000000000000200000000000000001800000000000000000000000000000000000000000a550c18020000000000000007000000000000000000000000000000010b4469656d4163636f756e74124372656174654163636f756e744576656e740018b5b333aabbf92e78524e2129b722eaca030000000000000007205ea5bec9fcf7db9ca734b48ff2c30d333a47b265124e8f8d82c5933e99d38f4e20e2671b124cdd8bc5fdfdf9c3f385791c1e8e4b36cb9b7faa75a0aceffd2dc55420056518b61548197ec9cfdef5ccc9df06d7fbf9a65929ca6a001a6ba3e94e29f62057304aafb410c2e4903517fa60a60b644adac57a3531a647bffcf4f31370174c20cd295ff537e3415397ffcf822d89dd024be06c98c66ce1dd20c0452aab8e21bd201323a27e3b440505760f098720f643944b57516dff978701849ab53c6ccb6ab420cd150532557fe95d883e30dbd2723f41f85384de0993a24b81098a6d141fcd4020284bcdb5381519e4bd76634814026598babc7629d4f9ba827e4c6ae25557d25e209f181a5a463b39e5be659ebc0f5174936f3b8f34a443b98239ffeb43f5ec79a32063935d32737f16a01bf69f5a2df0fed9e1e659a1ac66a421cc7515884a24b61d0000000000000000000420235cffb4a169efa7079e0f525485e1a15814dc7837c58b23cb957de765d3245720c3f7508f672153ca6689abb7b0a5c5e7249f492ba82aefeabd4bba44b56e35d020d222a263f1142ed5089ddf8694b9fa98e981e891e63fd28f05d8d80f03a207de2000a98c24050c7371aa9ddde3f8b4263f83c41b94781b181a96db4b61e2ecdf19"
        }
    ]
}