Usage of mempool API for wallets #211
-
I'm looking into using the mempool API provided by Ogmios for usage in wallets. However, I couldn't find answers to these three questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Ho, hi there!
|
Beta Was this translation helpful? Give feedback.
-
{
hash: string,
txs: string[] // string is cbor
} Then I can use a hash function over the cbor array where the order of data matters. That way, a client can paginate based off the index in the txs and if the hash changes part-way through the pagination, it can restart the pagination from index 0. |
Beta Was this translation helpful? Give feedback.
-
@SebastienGllmt I am not sure to get your point about pagination here 🤔 ? Surely, it's a mempool so there won't be many transactions in it. Somewhere between few hundreds and a couple and the whole size is bounded: ~180kb of raw binary data, so maybe triple that with the JSON overhead + hex encoding; so really not something that isn't manageable by a client to ingest all at once I suppose. Otherwise, yes, paginating the mempool here is a bit tricky since it's by essence a volatile list-like data-structure where things can be removed at arbitrary position in the list. You could definitely get a hash as kind of checksum or, perhaps also consider having the client explicitly acquire some state? For example, have a way for the client to "acquire" this hash (e.g. via an endpoint) and have it provide this hash as a request argument for any paginated request. If the hash ever changes, then the server can properly fail with a relevant error message. This make the burden of checking on the server, so that client won't forget and be surprised later because they forgot to check the hash in responses. |
Beta Was this translation helpful? Give feedback.
Ho, hi there!
Only valid transaction (from the perspective of the local node) will go in the mempool. The server performs both phase 1 and phase 2 validations, and reject the transaction should any fails.
Yes, but only on master currently. I'll publish the new version as soon as I am done reworking the API reference documentation (which should seemingly make the this kind of details easier to find). On master, every transaction now includes an new field
raw
which corresponds to the raw tx CBOR: https://github.com/CardanoSolutions/ogmios/blob/master/docs/static/ogmios.wsp.json#L5669That is a good question. The protocol certainly does not enforce that so, the only correct answer woul…