Skip to content

Bitcoin Verify Message

Xenland edited this page Dec 20, 2012 · 22 revisions

Back to API Call Index

Purpose

  • This function will verify if a signed message is valid.

  • Notes: By default this function will bdk_encode_message() the incoming plain-text before comparing signatures, to turn this feature off you can set the parameter enable_consistency_filter to zero (0).

Why did we choose to have a consistency filter enabled by default?

  • Testing and past experience tells us that with out a consistency filter developers will carelessly compare signatures with out thinking about hidden characters(causing users to output signatures to return false when they are in fact valid);

  • The consistency filter helps assist developers not run into these same problems as I have before in the past. The only down-side of a consistency filter enabled by default is the developer needs to be educated of this fact if they are not then perhaps ALL signatures will return false and might think this library is broken or could get insecure about their coding methods; Either way frustration and self-examination is not our goal so if you already reading these wiki pages you are already educated, great job!

Parameter(s)

This function takes four parameters which are bitcoin_address , signature, message, enable_consistency_filter the last one is the only one considered optional, the rest are considered required but will soft-error if not provided.

Output | Type: Array

This function outputs an array this array will output return_status , message_valid, original_message, filtered_message.

return_status

  • Type: Integer

-1 = Failure to verify address

1 = Success

100 = Bitcoin connection was unable to be established

101 = Query failed

message_valid

  • Type: Integer (Valid Values: -1, 0, 1)

-1 = not changed

0 = message not vaild

1 = message valid

original_message

  • Type: String
  • Notes: This is the originally in-putted message (always non-filtered and un-touched)

The original message that was in-putted Untouched to verify a signature.

filtered_message

  • Type: String
  • Notes: This is the filtered message after it has been encoded, this message is only filtered when enable_consistency_filter is equal to one (1).

The filtered message if filter is enabled