9

I'd like to know if there's a way to sign a message? Any help would be appreciated. Thanks!

10

All that ledger knows how to do is to offer signatures of different kinds of messages the client app sends it. So in that sense your question refers more to capability of the Tezos client you are connecting your Ledger to (full node, tezbox etc...).

At the moment unfortunately the option is not offered in either client to sign regular string messages (similarly to say in the bitcoin standard gui wallet) so the answer to your question is "no". The closest thing that is available is with the full node to sign bytes messages with the command

./tezos-client sign bytes <data> for <src>

which would request a signature from your ledger is that one controls src

That being said it is a useful feature to have and worth requesting to various wallet developpers!

4

You can actually convince the ledger to sign arbitrary things right now. It will display a "Sign Unverified?" prompt:

tezos-client sign bytes 0x03$(echo "hi there!" | xxd -ps | tr -d '\n') for <account>

But having a fully supported solution to this where the ledger actually shows you the message (or some verifiable version of it) would be ideal.

1

There are no very convenient tezos-client commands or RPCs to help with this yet, but one can currently sign a Micheline expression in a conventional way like this:

$ tezos-client hash data '"hello, world"' of type string | grep 'Raw packed data:' | cut -d: -f2
 0x05010000000c68656c6c6f2c20776f726c64
$ tezos-client unpack michelson data 0x05010000000c68656c6c6f2c20776f726c64
"hello, world"
$ tezos-client sign bytes 0x05010000000c68656c6c6f2c20776f726c64 for key
...

Such a signature will be accepted, for example, by a contract doing {PUSH string "hello, world"; PACK; BLAKE2B; PUSH signature ...; PUSH key ...; CHECK_SIGNATURE; ASSERT}.

This convention is used for example by the genesis multisig vesting contracts.

As of today the Ledger wallet app will not confirm such a signature, displaying "Sign Unverified". Maybe someday it will display the hash displayed by hash data.

I don't feel comfortable describing this without providing a warning:

It can be dangerous to sign Micheline expressions.

(Even ignoring the current lack of confirmation on the Ledger.)

Generally, always take care which messages you sign with which keys.

Remember that your signatures are valid forever, so future situations are relevant too.

See also two relevant Michelson anti-patterns, which start to hint at related complexity here (from the contract author's perspective): Signatures alone do not prevent replay attacks, Do not assume users will use a unique key for every smart contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.