Skip to content

An example how to derive new Libra address from master public key and then send coins from this address

Notifications You must be signed in to change notification settings

selevit/libra_bip32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libra BIP32

An example how to derive new Libra address from master public key and then send coins from this address. I spent quite a lot of time to make it work, so just sharing. All the stuff is in the send_transaction.py. Feel free to ping me for any questions.

What is this for?

Libra uses ed25519 scheme for transaction signing. Most libra wallet implementations use HKDF scheme for derivation of “children” private keys. But HKDF doesn’t give you a way to use a master public key for addresses generation (like e.g. BIP32).

There is an article written by Dmitry Khovratovich and Jason Law Describing the way how to use the BIP32 derivation scheme within ed25519. Someone created the implementation of their algorithm in Ocaml.

The other brave guy ported this to Python (with custom Blake2b hash-function): It looks not very "pythonic" but I didn't find any different alternative. I've vendored it and changed the hash function to SHA512 to make it compatible with "normal" ed25519.

Usage (tested on python 3.7)

pip install pipenv
git clone https://github.com/selevit/libra_bip32
cd libra_bip32
pipenv install
pipenv shell
python send_transaction.py

Expected result:

About

An example how to derive new Libra address from master public key and then send coins from this address

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages