Converting blobs from candid response to hex

I’m getting back

opt blob "\1ah\fb^\13\ea;\13\ed\d5\8f\9b\e3r\cc\cfS\f9\09t\b1d\f1\e2\1c\14\a8\a4\18R\96\86"

from query_blocks for a parent hash. How do I convert that to hex?

No good tooling at the moment. You can try didc decode -f blob 'blob "\1ah\fb^\13\ea;\13\ed\d5\8f\9b\e3r\cc\cfS\f9\09t\b1d\f1\e2\1c\14\a8\a4\18R\96\86"'. Then in the error message, you get the hex string…

Error: Cannot parse header 1a68fb5e13ea3b13edd58f9be372cccf53f90974b164f1e21c14a8a418529686

I made a thing: Motoko Playground - DFINITY. Once you deploy it you can dfx canister --network ic call yourcanister say ‘(blob “djldjfsajklfajklfjdfjd”)’

2 Likes