Bitcoin Forum
November 18, 2024, 06:56:47 AM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Implement Payment Protocol on shop side  (Read 924 times)
mikl (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 12, 2014, 11: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 !!
mikl (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 13, 2014, 10: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!
bitpop
Legendary
*
Offline Offline

Activity: 2912
Merit: 1060



View Profile WWW
August 21, 2014, 05:12:27 AM
 #3

Chain.com might be worth a look

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!