Skip to content

Latest commit

 

History

History
72 lines (63 loc) · 1.54 KB

ethereumSignMessage.md

File metadata and controls

72 lines (63 loc) · 1.54 KB

Ethereum: sign message

Asks device to sign a message using the private key derived by given BIP32 path.

ES6

const result = await TrezorConnect.ethereumSignMessage(params);

CommonJS

TrezorConnect.ethereumSignMessage(params).then(function(result) {

});

Params

Optional common params

  • pathobligatory string | Array<number> minimum length is 3. read more
  • message - obligatory string message to sign in plain text
  • hex - optional boolean convert message from hex

Example

TrezorConnect.ethereumSignMessage({
    path: "m/44'/60'/0'",
    message: "example message"
});

Result

{
    success: true,
    payload: {
        address: string,
        signature: string,
    }
}

Error

{
    success: false,
    payload: {
        error: string // error message
    }
}

Migration from older version

version 4 and below

TrezorConnect.ethereumSignMessage("m/44'/60'/0'", "example message", function(result) {
    result.address  // address without "0x" prefix
    result.signature
});

version 5

// params are key-value pairs inside Object
TrezorConnect.ethereumSignMessage({ 
    path: "m/44'/60'/0'",
    message: "example message"
}).then(function(result) {
    result.address   // address with "0x" prefix and checksum
    result.signature // no change
})