1
I am new in bitcoin. I want to implement a bitcoin payment system. I am using blockcypher's API. Suppose we have an hd wallet "myhdwallet" and we have driven 2 addresses using xpub for my hd wallet. (address A=> m/0/1 ,address B=>m/0/2,...). I want to create a transaction and send some bitcoins from my wallet's addresses to destination address C. How can I do that? I was successful in sending bitcoin using private keys. But here I do not have any private key for addresses. I just have wallet name and xpub. How can I do that using blockcypher's API?
Thank you for your answer. When I create a HD wallet, I use my xpub. I have generated xpub somewhere and it generates addresses with pubKeys and privKeys too. But the address which has been generated by the same xpub are not same with blockcypher's derivation. So how can I spend money in addresses in derived addresses in HD wallet? :( – Meysam Valuyan – 2018-01-18T17:47:25.487
I think you’ve mixed something up slightly, you cannot use an xpub to derive private keys, to do that you need the xpriv. I just took a look at BlockCypher’s wallet API docs (https://www.blockcypher.com/dev/bitcoin/#hierarchical-deterministic-hd-wallets), and it seems they use a different derivation scheme than the standard BIP32 layout. So you’ll need to find a way to derive the correct keys for the xpub you’ve provided to blockcypher, by following the blockcypher derivation scheme, from the xpub you provided.
– chytrik – 2018-01-18T19:37:26.110