My goal is to store all the XDR representing each ledger (aka blocks) and each transaction in IPFS via an IPLD resolver, similar to https://github.com/ipld/js-ipld-ethereum. The problem I'm having is that I'm not sure what multiformats need to be added (if any), given that the hashes within these XDR objects are themselves base32 and "stellar-key" encoded before being written into and linked to each ledger.
I can see that a CID is
<multibase-prefix><cid-version><multicodec-content-type><multihash-content-address> of some given content.
In the Stellar-verse:
- the base objects are all stored as XDR
- the hashes (used when referencing transactions or ledger headers) of any XDR objects are encoded like this:
base32(<version-byte><raw-data><CRC16-XModem-checksum>). As you can see here, the
base32 is either a:
G for ed25519 public keys
S for ed25519 secret seeds
T for pre-authorized transactions
X for SHA2-256 hashes
My questions are:
- Do I need to write an equivalent of https://github.com/ipld/js-ipld-dag-cbor for XDR?
- Do I need a new multihash (to represent the encoded hashes)?
- Do I need a new multicodec for each
version-byte, or can one that encompasses the 4 types of
stellar-keys be enough?
- Do I need a new multicodec for each hash-linkable XDR object?
Any help would be appreciated!