-
Notifications
You must be signed in to change notification settings - Fork 16
BDK Prove Coin Ownership
This function will assist you with creating a login handshake with the visitor (Can very well be used as a Bitcoin address verification function as well). Step 1 is to call the function with the visitors bitcoin address and ask the user to sign the variable called string_to_sign and ask the user to submit it into a single-line textbox. Step 2 is to verify if that information is all valid.
This function takes four parameters(only the first two are required for step 1): bitcoin_address, step, step_2_signature, step_2_original_data
bitcoin_address
- Type: String
step
- Type: Integer
- Notes: tell the function which step we are at
step_2_signature
- Type: String
- Notes: This is the base64 output from the users Bitcoin client.
step_2_original_data
- Type: String
- Notes: This is the message we are checking the Bitcoin Address/Signature pair against
This function outputs an array this array will output return_status, new_address, checksum.
return_status
- Type: Integer
-1 = Failure to collect information on the receipt 1 = Success
100 = Connection to Bitcoin client failed
101 = Creation of random string failed.
102 = In-putted server checksum doesn’t match the local server check sum. Tell user to try again we can't trust this information if the server checksum doesn’t match the data.
103 = The signature may be valid but this token is expired, tell the user to try again, and get a new token to sign.
104 = Bitcoin address was not set, with out the address we can't retrieve any Bitcoin information.
105 = (Same as 104 only different for debugging purposes) Bitcoin address was not set, with out the address we can't retrieve any Bitcoin information
106 = message did not validate, signature should not be trusted
bitcoin_address_authenticated
- Type: Integer
If return_status equals one (1) and in step 2 phase, this variable will return as one (1) if this visitor owns that address.
string_to_sign
- Type: String
If return_status equals one (1) and in step 1 phase, this variable will return the string required to sign