On this page

latest contributor to this doc

Last Edit:

@gcharang

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"
  }
}

StructureTypeDescription
coinstringThe coin to sign a message with
messagestringThe message you want to sign

StructureTypeDescription
signaturestringThe signature generated for the message

POST
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
}

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

StructureTypeDescription
coinstringThe coin to sign a message with
messagestringThe message input via the sign_message method sign
signaturestringThe signature generated for the message
addressstringThe address used to sign the message

StructureTypeDescription
is_validbooleantrue is message signature is valid; false if it is not.

POST
verify_message
{
  "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