Sign Message
The sign_message method allows you to prove ownership of a specific wallet address. A unique digital signature is provided for the message being signed. This signature, along with the original message and the wallet address, can then be verified, confirming that the message originated from the owner of the address and has not been altered.
| Parameter* = required | Type | Description |
|---|---|---|
| coin* | string | The coin to sign a message with. |
| message* | string | The message you want to sign. |
| address | string | Optional. HD wallets only. A standard AddressPath object. The path to the address for signing the message. If not provided, the account_id, chain, and address_id will default to 0. |
| Parameter* = required | Type | Description |
|---|---|---|
| signature* | string | The signature generated for the message. |
Sign Message
{
"userpass": "RPC_UserP@SSW0RD",
"method": "sign_message",
"mmrpc": "2.0",
"id": 0,
"params": {
"coin": "DOC",
"message": "Between subtle shading and the absence of light lies the nuance illusion"
}
}
{
"mmrpc": "2.0",
"result": {
"signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY="
},
"id": 0
}
Sign Message (HD Wallet)
{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "sign_message",
"params": {
"coin": "KMD",
"message": "Very little worth knowing is taught by fear.",
"address": {
"derivation_path": "m/84'/2'/0'/0/1"
}
},
"id": 2
}
{
"mmrpc": "2.0",
"result": {
"signature": "H8Jk+O21IJ0ob3pchrBkJdlXeObrMAKuABlCtW4JySOUUfxg7K8Vl/H3E4gdtwXqhbCu7vv+NYoIhq/bmjtBlkc="
},
"id": 2
}
HD Wallet with Account and Address ID
{
"userpass": "RPC_UserP@SSW0RD",
"mmrpc": "2.0",
"method": "sign_message",
"params": {
"coin": "KMD",
"message": "Very little worth knowing is taught by fear.",
"address": {
"account_id": 0,
"chain": "External",
"address_id": 1
}
},
"id": 2
}
{
"mmrpc": "2.0",
"result": {
"signature": "H8Jk+O21IJ0ob3pchrBkJdlXeObrMAKuABlCtW4JySOUUfxg7K8Vl/H3E4gdtwXqhbCu7vv+NYoIhq/bmjtBlkc="
},
"id": 2
}
For HD wallets, if the address parameter is not provided, the root derivation path will be used, for example, m/84'/2'/0'/0/0.
The two examples above point to the same address. The derivation path follows the format m/44'/COIN_ID'/ACCOUNT_ID'/CHAIN/ADDRESS_ID (or m/84'/COIN_ID'/ACCOUNT_ID'/CHAIN/ADDRESS_ID for segwit coins).
The account_id and address_id are the indices of the account and address in the wallet, starting from 0.
The chain is either External or Internal, and is expressed as an integer with External being 0 and Internal being 1.
| Parameter* = required | Type | Description |
|---|---|---|
| CoinIsNotFound | string | Optional. Specified coin is not found |
| InternalError | string | Optional. An internal error occurred during the signing process |
| InvalidRequest | string | Optional. Message signing is not supported by the given coin type |
| PrefixNotFound | string | Optional. sign_message_prefix is not set in coin config file |
| SigningError | string | Optional. Error attempting to sign message |
{
"mmrpc": "2.0",
"error": "sign_message_prefix is not set in coin config",
"error_path": "eth",
"error_trace": "eth:2332]",
"error_type": "PrefixNotFound",
"id": null
}
{
"mmrpc": "2.0",
"error": "Internal error: No such coin: as",
"error_path": "lp_coins",
"error_trace": "lp_coins:5122] lp_coins:5034]",
"error_type": "InternalError",
"error_data": "No such coin: SHEKEL",
"id": null
}