An exercice to practice hierarchical addresses.
With one passphrase, you can generate multiples addresses.
apt-get update && apt-get install curl php5 php5-gmp gitExecute
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composerLog as user
Git clone this project and execute
cd hierarchical-exercice/ composer require bitcoin-php/bitcoin-ecdsa composer installExecute
php index.phpOr got to http://localhost/hierarchical-exercice/index.php
You should see
Public: 1EbKLRDDcW9HRnAcDxDtgrBJNFFGFaumRT Private: e8b8cb723816e654c9ad0b465ec64028c929faf0595ccad6485eb3afcb4ce103 ...The
// Random addresses
block illustrates that you can have random addresses, or predetermined addresses with passphrases
To create a function based on hierarchical to retrieve a private key from a public key, you have to:
- Set up a hierarchical system
- Create a function to retrieve a private key from this hierarchical system
- Comment or remove the random block
- Use the for loop on the Passphrase block, and change the limit to 20
for($i = 0; $i <= 20; $i++) {}
- Concatenate the $i at the end of the passphrase on each iteration
$passphrase . $i
- Store the 16th public key on a variable
- Create a function which take the public key parameter, and retrieve the private key associated