I tried out ipfs pubsub
with the suggested ipfs pubsub sub foo
and ipfs pubsub pub foo "hello world"
and it worked great. Then I tried ipfs pubsub sub --encoding json foo
and once again published “hello world”.
{"from":"EiDLdl0RJLAxxBwLSZISChtzTkFp1CggnKW2nbxjN55qMQ==","data":"aGVsbG8gd29ybGQ=","seqno":"FSzcm/r0Jr4=","topicIDs":["foo"]}
Great! It shows the “from” address there? That’ll let me know who’s publishing what! Except… who the heck is EiDLdl
?
$ ipfs key list -l
Qmc2t9rdUJUAGco7syubbzEGipeqq4rvBpiC7RsKjbZM3E self
Qmc2t9
is certainly not EiDLdl
even though I watched myself publish “hello world.” Is there some way to convert between EiDLdl
and Qmc2t9
? Is EiDLdl
just a useless session key or something? I tried base64 decoding EiDLdl
but it was just binary data, not Qmc2t9
.
also ipfs id
gives "ID": "Qmc2t9rdUJUAGco7syubbzEGipeqq4rvBpiC7RsKjbZM3E",
as might be expected. I’m just puzzled where EiDLdl
is coming from. In the go-libp2p-floodsub module, it says it’s “p.host.ID()” where p.host is a host.Host for go-libp2p-host. And in the latter module, it says Host is an object participating in a p2p network, which implements protocols or provides services.
So is “from” just some sort of a hash of my ipfs node’s IP address, unrelated to ipfs id
?
I guess you have to publish /ipns/ URLs with pubsub, if you want each publication to be associated with a key.
That’s the peer from which the message was received. Unfortunately, it looks like we’re base64 encoding it instead of base58 encoding it. Please file a bug.
FYI, you can work around this by base64 decoding it and then bas58 encoding it.
Oh, right, base58. That’s what’s going on. I forgot peers IDs were base58 encoded for display. Thanks stebalien!