1

I'm generating multiple children using one extended key. I have no problem generating public addresses:

$master = HierarchicalKeyFactory::fromExtended(myKey);
$key = $master->deriveChild(1);
$publicAddress = $key->getPublicKey()->getAddress()->getAddress();

In order to sign a transaction, I need the public address' private key. How do I generate / extract the private key of a derived child? I'm assuming I'm not using the extended key for that.

1
  • Why is getAddress() called twice?
    – James C.
    Dec 5, 2018 at 13:01

1 Answer 1

0

Did a bit of digging and in order to extract the private key, you can use: $privateKey = $key->getPrivateKey()->toWif(); And then sign the transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.