My goal is to store all the XDR representing each ledger (aka blocks) and each transaction in IPFS via an IPLD resolver, similar to GitHub - ipld/js-ipld-ethereum: JavaScript Implementation of All Ethereum IPLD formats. 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, theversion-byte
inbase32
is either a:G
for ed25519 public keysS
for ed25519 secret seedsT
for pre-authorized transactions- or
X
for SHA2-256 hashes
My questions are:
- Do I need to write an equivalent of GitHub - ipld/js-ipld-dag-cbor: JavaScript implementation of the IPLD dag-cbor format. 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 ofstellar-key
s be enough? - Do I need a new multicodec for each hash-linkable XDR object?
Any help would be appreciated!