The ledger explorer in Proxima woudl implement common functions of the equivalents in other blockchains. It will be implements as a Web browser which access endpoint of the node.
Most of functions which allows to parse raw transaction and access each of the elements is in the transaction
package. You use FromBytes
function to parse raw bytes of the transaction to transaction.Transaction
. It has number of options for validation. Only basic are needed for exporer.
How to convert transaction.Transaction
to readable form one can take LinesShort function as an example. JSON could be formed similarly.
All the APIs are implemented in the api
package. The browser would need to retrieve transaction as JSON by transaction ID with something like get_tx?id=ffff..
. It is not implemented.
Same with searching for transactions with specific slot (this is not a priority).
Transaction ID is 32 bytes binary, see here
It consists of:
timestamp
:
1
for sequencer transactions, 0
for the restThis way transaction ID contains information about timestamp and flag if it is a sequencer transaction. Plus hashed part. The transaction ID usually is displayed with timstamp ans sequencer flag as prefix to the hash. For binary exchanges in API it is just hex encoded.
All raw transactions are stored in the simple TxBytesStore interface.
TxBytesStore is separate database from the ledger state. So, API have to call this interface with the ID and get the raw transaction bytes and metadata (if available)
In the future it makes sense to implement it as separate server and the explorer would access transactions directly from the store, bypassing the node. This is advanced