Author

Topic: Implement Payment Protocol on shop side (Read 925 times)

legendary
Activity: 2912
Merit: 1060
August 21, 2014, 12:12:27 AM
#3
Chain.com might be worth a look
newbie
Activity: 2
Merit: 0
August 13, 2014, 05:20:15 AM
#2
It looks like I tried to solve the problem from opposite direction Smiley - I don't have to compute pubkey hash from public key. I can decode bitcoin base58 address to pubkey hash https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses

To extract pubkey hash I  used DecodeBase58 function from src/bitcoin.cpp file in bitcoind sources .

Thanks!
newbie
Activity: 2
Merit: 0
August 12, 2014, 06:32:24 AM
#1
Hi,

I try to implement creation of Payment Request structure based on: https://bitcoin.org/en/developer-examples#code-variables .
I have set up environment(bitcoind, python CGI) and now I want to receive payment via P2PKH (as presented in the example). To do so I have to generate pubKeyHash for each invoice.
Based on what I have read pubKeyHash is a RIPEMD-160( SHA256( full/uncompressed ECDSA public key ) ).
Unfortunately I didn't find any RPC call to get pubKeyHash .

So my guess is that to compute such a hash I have to perform the following steps:
 1. call, via RPC, getnewaddress, it will return new address for given shop payment
 2. call, via RPC, validateaddress, from returned json I can extract compressed public ECDSA key
 3. compute uncompressed public ECDSA key based on methods which can be found on the Internet
 4. compute (using openssl) SHA256 and RIPEMD-160 of the uncompressed key, result is a pubKeyHash which I have to put to Request Payment structure

Is approach presented above correct ? Or maybe there is easier way to get the pubKeyHash ?

Thanks in advance !!
Jump to: