deriveChild and signing transactions using Bit-Wasp

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.

user2298995

Posted 2017-12-10T12:02:18.627

Reputation: 113

Why is getAddress() called twice?James C. 2018-12-05T13:01:26.497

Answers

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.

user2298995

Posted 2017-12-10T12:02:18.627

Reputation: 113