1
1
I'm trying to generate the address 38DGj87axzmQiZeAd1w1y5FEmuu5a7pfBa in my bitcoin core wallet with code.
First, I dump the private key from the address, then I calculate the address from the private key. As the address is start form m, which is of P2SH bitcoin address type. And the P2SH address is constructed as
base58-encode: [one-byte version][20-byte hash][4-byte checksum]
Here I don't know what the script used to calculate the [20-byte hash] in the bitcoin core wallet?
I use bitcoin core 0.16.0 the latest version. But when I use
getaddressinfoI got "Method not found" – Kris Roofe – 2018-04-08T07:06:04.7431
Oh apologies, I thought it had made it into 0.16, it looks like its still only on the master dev branch. In that case you might have to create the script yourself using the OP_0 + hash160 approach I mentioned, see here for more info: https://bitcoincore.org/en/segwit_wallet_dev/#creation-of-p2sh-p2wpkh-address
– MeshCollider – 2018-04-08T07:18:49.7901Use
validateaddressinstead (the parts ofvalidateaddressthat give address information are moved to a newgetaddressinfocommand for the next major version, 0.17). – Andrew Chow – 2018-04-08T07:21:11.150@AndrewChow does validateaddress output the script? I wasn't sure if it did or if that was new functionality – MeshCollider – 2018-04-08T08:18:07.220
@MeshCollider It does. The RPC was just split up in two in master, but no new functionality was added. – Pieter Wuille – 2018-04-08T12:51:35.847