libp2p / go-libp2p-examples

Example libp2p applications
MIT License
338 stars 145 forks source link

send signature as b58 string to avoid "invalid UTF-8 string" error #5

Closed strobus closed 6 years ago

strobus commented 6 years ago

Trying to run the "multipro" example, I was receiving an "invalid UTF-8 string" error. I turned out that the message encoder did not like the signature cast directly to string with string(signature). When I changed to encode/decode as base 58 string with the github.com/mr-tron/base58/base58 library, it worked fine.

I also changed all the log messages to output the full node ID instead of the first 6 characters. The first 6 characters were always the same, so not useful in showing what was really happening.

Stebalien commented 6 years ago

Trying to run the "multipro" example, I was receiving an "invalid UTF-8 string" error.

I believe the correct fix here is to modify the protobuf to use the bytes type instead of the string type.

I also changed all the log messages to output the full node ID instead of the first 6 characters. The first 6 characters were always the same, so not useful in showing what was really happening.

The issue here is that we added a new peer ID format. Does https://github.com/libp2p/go-libp2p-peer/pull/35 improve the displayed peer IDs?

raulk commented 6 years ago

Bumped into this as well, and I'd be happy to help push the fix through. @strobus – let me know if you need anything else.

Stebalien commented 6 years ago

@strobus @raulk how does https://github.com/libp2p/go-libp2p-examples/pull/8 look?

raulk commented 6 years ago

Was waiting for @strobus's answer, but glad it's sorted now 👍