arrow_back_ios 2024w03: MyCRUD generic app backend – WordPress plugin menu group

2024w03: MyCRUD generic app backend – WordPress plugin

Results on projects I have been working on in the past week:

  • MyCRUD generic structured data storage backend
  • Passed exam in History of Ideas (Idehistorie)
  • Prepared and submitted "Idehistorie"-notes as book for printing
  • Prepared supporting documents for accountant for annual financial report for my companies
  • Read up on IPFS Merkel DAG and Protocol Buffer specifications

Key takeaways:

  • Learned protocol buffers, IPFS CIDv0 and dag-pb
  • sqlite filename "query" > ...
  • Prompt useful when not a native speaker + git diff for learning feedback: Please rewrite the above, fixing grammatical errors but keeping the wording and exact same content, without elaboration. Just return the rewritten text.
  • Brushed up on WordPress coding

Simple IPFS-compatible Merkel DAG

I have some ideas where I might use a Merkel DAG, – and in that case, it might be useful to generate IPFS-compatible hashes and blocks. The simplest IPFS-compatible Merkel DAG format is DAG-PB and SHA-256 CIDv0, – both of these has been superseeded by newer (backward-compatible) specifications.

A SHA-256 CIDv0 consist of 34 bytes: 0x12 (SHA-256 identifier) 0x20 (32 bytes hash length) [32 bytes SHA-256]. (These bytes are often Base58 encoded, and then starts with "Qm").

A DAG-PB(protocol buffer) consist of a set of links, and some binary data, encoded with protocol buffers. It is documented here. In protocol buffers unsigned integers are LEB128 encoded.

I believe a minimal message with a list of CIDv0 would be:

  • For each link:
    • 0x12 2 << 3 | 2 Encoding of "Links" (2<<3) and that is a "string, bytes, embedded messages, packed repeated fields" (2)
    • 0x24 36 Length of the Links field
    • 0x0A 1 << 3 | 2 Encoding of a Hash (1<<3) and that it is "string, bytes, embedded messages, packed repeated fields" (2)
    • 0x22 34 Length of the bytes
    • 0x12 0x20 [32 bytes SHA-256] binary CIDv0
    • (Optionals IPLD: Name and TSize skipped)
  • For the data, if present:
    • 0x0A 1 << 3 | 2 Encoding of a Hash (1<<3) and that it is "string, bytes, embedded messages, packed repeated fields" (2)
    • [LEB128 encoded number of bytes in data]
    • [actual data]

The above is made by hand from spec, and has not been tested yet. Future work include to generate an actual merkel-tree as above, and then test that it is interoperable with IPFS.