Skip to content

An exercice for practice hierarchical addresses generation

Notifications You must be signed in to change notification settings

charonne/hierarchical-exercice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Hierarchical exercice

An exercice to practice hierarchical addresses.
With one passphrase, you can generate multiples addresses.

Installation

Install composer

Install curl
apt-get update && apt-get install curl php5 php5-gmp git
Execute
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Install bitcoinECDSA

Log as user
Git clone this project and execute
cd hierarchical-exercice/
composer require bitcoin-php/bitcoin-ecdsa
composer install

Test script

Execute
php index.php
Or got to http://localhost/hierarchical-exercice/index.php
You should see
Public: 1EbKLRDDcW9HRnAcDxDtgrBJNFFGFaumRT
Private: e8b8cb723816e654c9ad0b465ec64028c929faf0595ccad6485eb3afcb4ce103
...

Test random generation of addresses

The // Random addresses block illustrates that you can have random addresses, or predetermined addresses with passphrases

Exercice

Purpose

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

Details

  • 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

About

An exercice for practice hierarchical addresses generation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages