bitcoinex (OP)
|
|
September 23, 2010, 04:38:29 AM |
|
Is there a way? If not then it should be added, I think. (I would have been easier to do it in CLI)
Why is it necessary:
Working with a database requires send queue to send coins to someone else. (You can not call the bitcoin client directly from the database - transactions can be ROLLBACKed, but sending coins is not.) Hence, the need to address customers' pre-checked against the address format.
Implement this functionality for every developer separately fraught with errors (for example, many languages not contains base58 functions ), better code to test the validity of addresses was one - in bitcoin client (or library). Besides, it gives an opportunity to make small changes to the format of the address in the future if needed.
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
LZ
Legendary
Offline
Activity: 1722
Merit: 1072
P2P Cryptocurrency
|
|
September 23, 2010, 02:30:13 PM Last edit: January 22, 2018, 06:14:40 AM by LZ |
|
What about this? You need Python, Django and PyCrypto.
|
My OpenPGP fingerprint: 5099EB8C0F2E68C63B4ECBB9A9D0993E04143362
|
|
|
nelisky
Legendary
Offline
Activity: 1540
Merit: 1002
|
|
September 23, 2010, 02:46:46 PM |
|
And what about this, which is a slightly tweaked version of that, to just depend on Python 2.5+? # # Stolen from gavinandresen's django field validator # http://bitcointalk.org/index.php?topic=1026.0 #
import re from hashlib import sha256 import math
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' __b58base = len(__b58chars)
def b58encode(v): """ encode v, which is a little-endian string of bytes, to base58. """
long_value = 0L for (i, c) in enumerate(v[::-1]): long_value += (256**i) * ord(c)
result = '' while long_value >= __b58base: div, mod = divmod(long_value, __b58base) result = __b58chars[mod] + result long_value = div result = __b58chars[long_value] + result
# Pad front with Base58-encoded-0 for leading zeros: nPad = int((len(v)*8 / (math.log(58,2))) - len(result))
return (__b58chars[0]*nPad) + result
def b58decode(v, length): """ decode v into a little-endian string of len bytes """ long_value = 0L for (i, c) in enumerate(v[::-1]): long_value += __b58chars.find(c) * (__b58base**i)
result = '' while long_value >= 256: div, mod = divmod(long_value, 256) result = chr(mod) + result long_value = div result = chr(long_value) + result if len(result) < length: n_pad = length-len(result) result = chr(0)*n_pad + result return result
def get_bcaddress_version(strAddress): """ Returns None if strAddress is invalid. Otherwise returns integer version of address. """ addr = b58decode(strAddress,25) version = addr[0] checksum = addr[-4:] vh160 = addr[:-4] # Version plus hash160 is what is checksummed h3=sha256(sha256(vh160).digest()).digest() if h3[0:4] == checksum: return ord(version) return None
def isvalid(value): value = value.strip() if re.match(r"[a-zA-Z1-9]{33,35}$", value) is None: return False return get_bcaddress_version(value) is not None
|
|
|
|
bitcoinex (OP)
|
|
September 23, 2010, 03:26:20 PM |
|
you misunderstood me
the client has already been implemented check, need just the appropriate option besides, it gives an opportunity to make small changes to the format of the address in the future if needed and users also need address check without sending coins to make sure that the address they were told the correct
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
bitcoinex (OP)
|
|
September 23, 2010, 03:27:09 PM |
|
What about pgplsql?
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
nelisky
Legendary
Offline
Activity: 1540
Merit: 1002
|
|
September 23, 2010, 04:51:21 PM |
|
you misunderstood me
the client has already been implemented check, need just the appropriate option besides, it gives an opportunity to make small changes to the format of the address in the future if needed and users also need address check without sending coins to make sure that the address they were told the correct
Now I don't understand you So, how does the above pieces of code not do what you want? You don't need to send coins to check an address, you don't even need bitcoin at all, just the address. And python being very readable you can easily port that to any other language you need and know (yes, including pgplsql, assuming you have the appropriate crypto calls available)
|
|
|
|
LZ
Legendary
Offline
Activity: 1722
Merit: 1072
P2P Cryptocurrency
|
|
September 23, 2010, 05:27:56 PM Last edit: September 23, 2010, 05:39:07 PM by lzsaver |
|
the client has already been implemented check, need just the appropriate option As far as I understand, you want to use a switch which will return true or false... Something like -checkaddress=bitcoin_address. We need a patch for that switch. 2nelisky, thanks for tweaked version.
|
My OpenPGP fingerprint: 5099EB8C0F2E68C63B4ECBB9A9D0993E04143362
|
|
|
bitcoinex (OP)
|
|
September 24, 2010, 01:21:07 AM Last edit: November 23, 2010, 02:10:56 AM by bitcoinex |
|
the client has already been implemented check, need just the appropriate option As far as I understand, you want to use a switch which will return true or false... Something like -checkaddress=bitcoin_address. We need a patch for that switch. yes, we need I can not write a patch, so I just tried to justify it need
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
theymos
Administrator
Legendary
Offline
Activity: 5334
Merit: 13306
|
|
September 24, 2010, 01:58:11 AM |
|
I would be trivial to add a JSON-RPC command to do that. Just use the IsValidBitcoinAddress function.
|
1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
|
|
|
Gavin Andresen
Legendary
Offline
Activity: 1652
Merit: 2300
Chief Scientist
|
|
September 24, 2010, 01:28:43 PM |
|
I would be trivial to add a JSON-RPC command to do that. Just use the IsValidBitcoinAddress function.
For extra credit, give an Object as the return value: { 'isvalid' : true, 'ismine' : true, # true if isvalid and you have the private key (can spend coins sent to this address) 'version' : 0, # ADDRESSVERSION 'address' : '1frt6531....' # might as well echo back the address... }
|
How often do you get the chance to work on a potentially world-changing project?
|
|
|
bitcoinex (OP)
|
|
September 25, 2010, 08:12:18 AM |
|
I would be trivial to add a JSON-RPC command to do that. Just use the IsValidBitcoinAddress function.
For extra credit, give an Object as the return value: { 'isvalid' : true, 'ismine' : true, # true if isvalid and you have the private key (can spend coins sent to this address) 'version' : 0, # ADDRESSVERSION 'address' : '1frt6531....' # might as well echo back the address... } Yes, that's option would be cool!
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
bradford1Merrill
Newbie
Offline
Activity: 2
Merit: 0
|
|
October 02, 2010, 07:51:18 AM |
|
In my work I am asking my self is there way to check e-mail address validity. so please help.
|
|
|
|
LZ
Legendary
Offline
Activity: 1722
Merit: 1072
P2P Cryptocurrency
|
|
October 02, 2010, 08:51:51 AM Last edit: October 02, 2010, 09:10:44 AM by lzsaver |
|
And what are you answering yourself? 1. Validate e-mail using regular expressions. 2. Then check domain exists for that e-mail. Say "helo" to 25 port and you should get "250". 3. Then check that user exists at that domain. Say "rcpt to" and you should get "550" if exists.
|
My OpenPGP fingerprint: 5099EB8C0F2E68C63B4ECBB9A9D0993E04143362
|
|
|
mizerydearia
|
|
October 04, 2010, 02:03:34 AM Last edit: October 04, 2010, 07:25:28 AM by mizerydearia |
|
I will offer 5btc reward for this patch to be produced. +5btc from me
|
|
|
|
bitcoinex (OP)
|
|
October 04, 2010, 05:21:51 AM |
|
I will offer 5btc reward for this patch to be produced.
+5btc from me
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
Gavin Andresen
Legendary
Offline
Activity: 1652
Merit: 2300
Chief Scientist
|
|
October 20, 2010, 07:33:12 PM |
|
I implemented "validateaddress" in svn r169:
$ ./bitcoind validateaddress '1P3rpbSybuGgeL1bRwCJFWbn4yBjRNQrbY' { "isvalid" : true, "address" : "1P3rpbSybuGgeL1bRwCJFWbn4yBjRNQrbY", "ismine" : true } $ ./bitcoind validateaddress '1111111111111111111114oLvT2' { "isvalid" : true, "address" : "1111111111111111111114oLvT2", "ismine" : false } $ ./bitcoind validateaddress 'mwFzbfqePwXUyT28e1kFVVh48uMHDsRzbi' { "isvalid" : false }
No address version number; that wasn't trivial to do, so I didn't do it.
|
How often do you get the chance to work on a potentially world-changing project?
|
|
|
bitcoinex (OP)
|
|
October 20, 2010, 09:24:23 PM |
|
I implemented "validateaddress" in svn r169:
$ ./bitcoind validateaddress '1P3rpbSybuGgeL1bRwCJFWbn4yBjRNQrbY'
Who bitcoind instead of bitcoin? Please write bitcoin address for the payment of this work.
|
New bitcoin lottery: probiwon.com- Moжeт, ты eщё и в Heвидимyю Pyкy Pынкa вepyeшь? - Зaчeм жe вepoвaть в тo, чтo мoжнo нaблюдaть нeпocpeдcтвeннo?
|
|
|
LZ
Legendary
Offline
Activity: 1722
Merit: 1072
P2P Cryptocurrency
|
|
October 21, 2010, 02:26:11 AM Last edit: January 22, 2018, 08:42:49 AM by LZ |
|
Please write bitcoin address for the payment of this work. I think you can send him BitMail.
|
My OpenPGP fingerprint: 5099EB8C0F2E68C63B4ECBB9A9D0993E04143362
|
|
|
Gavin Andresen
Legendary
Offline
Activity: 1652
Merit: 2300
Chief Scientist
|
|
October 21, 2010, 03:33:58 AM |
|
RE: payment: If you really feel compelled to pay, send coins to the Faucet: 15VjRaDX9zpbA8LVnbrCAFzrVzN7ixHNsC
|
How often do you get the chance to work on a potentially world-changing project?
|
|
|
bradford1Merrill
Newbie
Offline
Activity: 2
Merit: 0
|
|
October 23, 2010, 07:45:41 AM |
|
Hi, I am new here. wish everybody have a good time.
How to check address validity in my sql server. i am for got my address can any one help me please.
|
|
|
|
|