Message Signing
Functions to sign messages and type data.
Functions for signing messages on the Ledger device.
- ledgereth.messages.sign_message(message: str | bytes, sender_path: str = "44'/60'/0'/0/0", dongle: Dongle | None = None) SignedMessage[source]
Sign a simple text message.
The message will be prefixed by the Ethereum app on the Ledger device according to EIP-191.
- Parameters:
message – (
str|bytes) - A bit of text to signsender_path – (
str) - HD derivation path for the account to sign with.dongle – (
ledgerblue.Dongle.Dongle) - The Web3 instance to use
- Returns:
- ledgereth.messages.sign_typed_data_draft(domain_hash: str | bytes, message_hash: str | bytes, sender_path: str = "44'/60'/0'/0/0", dongle: Dongle | None = None) SignedTypedMessage[source]
Sign EIP-721 typed data.
Danger
EIP-712 is still in DRAFT status and APIs may change, including the Ledger app-ethereum implementation.
- Parameters:
domain_hash – (
str) - Hash of the EIP-712 domainmessage_hash – (
str) - Hash of the messagesender_path – (
str) - HD derivation path for the account to sign with. Defaults to first account in the derivation path.dongle – (
ledgerblue.Dongle.Dongle) - The Dongle instance to use to communicate with the Ledger device
- Returns:
ledgereth.objects.SignedTypedMessageSigned message object
For a real example of usage, see how this is used with eth_account in ledgereth’s unit tests.