Dag put http api: cid link not working

Hello!

I have been studying IPFS for a bit and I tried to follow some tutorials about the IPLD data model and programming in IPFS on proto school.

However, I can’t say it’s everything clear to me. In particular, during my journey of exploring IPLD, unfortunately, I got stuck very quickly. The problem is that the DAG objects I create do not work as expected for cid links are not recognized as such.

I am running an ipfs node with the following docker-compose file

Blockquote
version: “3”
services:
ipfs-daemon:
image: ipfs/go-ipfs:latest
command: [“daemon”, “–enable-pubsub-experiment”]
container_name: ipfs-daemon
volumes:
- /home/$USER/ipfs-docker:/data/ipfs
ports:
- 8080:8080
- 5001:5001
- 4001:4001

Then I tried to create a DAG object with the dag/put API, both from CLI and HTTP API. To do that I passed to the DAG API a JSON object and the execution of the command returned me the CID of the DAG object I created:

docker-compose exec ipfs-daemon ipfs dag put my_file.json 
bafyreignblg2i5iz3ibo5s76kw5l45ujnuqzpbhuqqcpt6ctpvrdu24soe

docker-compose exec ipfs-daemon ipfs dag get 
bafyreignblg2i5iz3ibo5s76kw5l45ujnuqzpbhuqqcpt6ctpvrdu24soe 
[returns my JSON object]

Finally, I tried to create a new dag object which points to the previously created one.
The CID of this object is
bafyreib2hwajflpkoqcxke4uj22ygx2dsrn4vbvppljngjtoaafc3exzfu

and the object is something like this:
{"author":"bafyreignblg2i5iz3ibo5s76kw5l45ujnuqzpbhuqqcpt6ctpvrdu24soe","signature":"blahblah"}

Unfortunately, the IPDL explorer does not recognize the keyword author to contain a CID, it’s just a string. Why is that? I think I am doing something wrong though I do not understand how to fix thix.

To me, it seems that the only difference between my code and the examples I am following (see https://proto.school/blog) is that I am NOT using the JS implementation of IPFS. Is that just it?

Do I have to use the JS implementation?

Thank you in advance for your time and patience, I will appreciate any comment and I wish you all a good day

1 Like

I’ve just got it.

"{\"auth\":{\"\\/\":\"bafyreibiomlked3bdfcecevzlqgfxmlwzytu42bq2m7ktielnwpqnmpqte\"},\"val\":\"foo\"}"

A Link is an object that has the key / whose value is a CID.
It took me a while to figure it out, is there a place where I can find a kind of list of those specs? I tried from the IPDL website though I was not able to find what I was looking for

1 Like