-
Notifications
You must be signed in to change notification settings - Fork 16
Bitcoin Validate Address
This function will verify if a Bitcoin address is valid and capable of send/receiving Bitcoins.
This function takes one parameter which is bitcoin_address and is optional but should be considered required. For instance if you are looking through a list of Bitcoin addresses and for what/ever reason there is a blank row this function will "soft" error so you can handle it in the code as if the Bitcoin address was invalid; However, if instead we required this parameter, PHP would hard-error on such an event and will break your smooth code(or so you intended). Enjoy these tid-bits that make your life easier!
This function outputs an array this array will output return_status , isvalid, ismine, isscript, pubkey, iscompressed, label
return_status
- Type: Integer
-1 = Failure to validate address
1 = Success (Command was successfully executed, This Does not mean this is a valid address!, It just means you can trust the returned information is true)
100 = Failure to connect to Bitcoin
isvalid
- Type: Binary (1 or 0)
On return_status equals 1, this returns either a one or zero (1 or 0)
ismine
- Type: Binary (1 or 0)
On return_status equals 1, this returns either a one or zero (1 or 0)
isscript
- Type: Binary (1 or 0)
On return_status equals 1, this returns either a one or zero (1 or 0)
pubkey
- Type: String
- Notes: This is the HASH160 of the Bitcoin address
On return_status equals 1, this returns a string of a hash160 of the Bitcoin Address that underwent validation.
iscompressed
- Type: Binary (1 or 0)
- Notes: If 1 then this address uses the compressed format
On return_status equals 1, this returns either a one or zero (1 or 0)
label
- Type: String
On return_status equals 1, this returns a string of the label/account attached to this Bitcoin Address