Signing_and_Verifying_Messages
Cryptographically signed messages are a useful feature which can be used to prove ownership of an address.
If your coins
file contains the correct sign_message_prefix
parameter value for a coin, you can sign messages with the Komodo DeFi Framework API.
{
"coin": "DOC",
"asset": "DOC",
"fname": "DOC (TESTCOIN)",
"sign_message_prefix": "Komodo Signed Message:\n",
"rpcport": 25435,
"txversion": 4,
"overwintered": 1,
"mm2": 1,
"protocol": {
"type": "UTXO"
}
}
Structure | Type | Description |
---|---|---|
coin | string | The coin to sign a message with |
message | string | The message you want to sign |
Structure | Type | Description |
---|---|---|
signature | string | The signature generated for the 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
}
PrefixNotFound: sign_message_prefix is not set in coin config file CoinIsNotFound: Specified coin is not found InvalidRequest: Message signing is not supported by the given coin type InternalError: An internal error occured during the signing process
Structure | Type | Description |
---|---|---|
coin | string | The coin to sign a message with |
message | string | The message input via the sign_message method sign |
signature | string | The signature generated for the message |
address | string | The address used to sign the message |
Structure | Type | Description |
---|---|---|
is_valid | boolean | true is message signature is valid; false if it is not. |
{
"userpass": "RPC_UserP@SSW0RD",
"method": "verify_message",
"mmrpc": "2.0",
"id": 0,
"params": {
"coin": "DOC",
"message": "Between subtle shading and the absence of light lies the nuance illusion",
"signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=",
"address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d"
}
}
{
"mmrpc": "2.0",
"result": {
"is_valid": true
},
"id": 0
}
{
"mmrpc": "2.0",
"result": {
"is_valid": false
},
"id": 0
}
PrefixNotFound: sign_message_prefix is not set in coin config CoinIsNotFound: Specified coin is not found InvalidRequest: Message verification is not supported by the given coin type InternalError: An internal error occured during the verification process SignatureDecodingError: Given signature could not be decoded AddressDecodingError: Given address could not be decoded