Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emaringolo/pharo-bip39mnemonic
Simple implementation of Bitcoin's BIP39 mnemonic and seed generator
https://github.com/emaringolo/pharo-bip39mnemonic
bitcoin pharo smalltalk
Last synced: 20 days ago
JSON representation
Simple implementation of Bitcoin's BIP39 mnemonic and seed generator
- Host: GitHub
- URL: https://github.com/emaringolo/pharo-bip39mnemonic
- Owner: eMaringolo
- License: mit
- Created: 2018-03-04T13:41:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-17T21:25:48.000Z (over 2 years ago)
- Last Synced: 2024-10-09T13:25:11.478Z (about 1 month ago)
- Topics: bitcoin, pharo, smalltalk
- Language: Smalltalk
- Size: 35.2 KB
- Stars: 8
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pharo-bip39mnemonic
Simple implementation of Bitcoin's BIP39 mnemonic and seed generator using the [reference implementation](https://github.com/trezor/python-mnemonic) as guide.*Personal disclaimer*: This is a personal experimentation to learn by practice how the entropy, mnemonic, seeds, etc., works internally. It includes passing tests taken from the reference implementation as well (vectors, checksum, instantiation from different sources, languages, etc.).
## Installation
Run:
```Smalltalk
Metacello new
baseline: 'BIP39Mnemonic';
repository: 'github://eMaringolo/pharo-bip39mnemonic/src';
load.
```## Examples
### Creating a new one
```Smalltalk
| m |
"Creating a mnemonic from Pharo's weak PRNG"
m := BIP39Mnemonic generate."Getting its mnemonic words"
m words. "#('argue' 'snap' 'this' 'common' 'cube' 'length'
'abandon' 'abandon' 'abandon' 'abandon' 'abandon' 'ability')""Generating a seed with
m seedForPassphrase: 'Pharo'. "'154ad96ab7ad44d2c47beb3801e278b37b82fe9fc3...'"
```### Instantiating from existing words
```Smalltalk
BIP39Mnemonic fromWords: 'legal winner thank year wave sausage worth useful legal winner thank yellow'.BIP39Mnemonic fromWords: #('legal' 'winner' 'thank' 'year' 'wave' 'sausage'
'worth' 'useful' 'legal' 'winner' 'thank' 'yellow')
```