I have generated bitcoin address using bitcoinjs library see below code
return bitcoin.payments.p2pkh({ pubkey: node.publicKey, network }).address
The above code returns address see below
1FYtPnUZZ2ZJL2fZ6XehGtkHfujUHkqK3T
But for signing raw transaction I need privatekey of this address 1FYtPnUZZ2ZJL2fZ6XehGtkHfujUHkqK3T
What should I do to get address and its privatekey?
I now how to generate address using derivation path from mnemonic.
For derivation path m/44'/0/0/0 I is generated 1FYtPnUZZ2ZJL2fZ6XehGtkHfujUHkqK3T address.
Now I need to now how can get privatekey for this derivation path m/44'/0/0/0
Top comments (2)
I think you have some conception misunderstanding here. The bitcoin address is just a hash of a public key in base58 encoding. You can't generate a private key from an address because a hash function is a one-way function. You can't even generate a public key from an address for the same reason.
The right flow would be:
I think you didn't get my question, My question was is there any method to get privatekey
For Example i generated an address using below method
bitcoin.payments.p2pkh({ pubkey: node.publicKey, network }).address
but for signing raw transaction I need privatekey of this address 1FYtPnUZZ2ZJL2fZ6XehGtkHfujUHkqK3T
This is what i am asking, What should I do to get address and its privatekey?