bip39
Version, currently 0.1.02 versions
- 0.1.1latestAug 3, 2022
- 0.1.0not indexedJan 5, 2023
github.com/q9f/bip39.cr
A native library implementing BIP-0039 mnemonics for the Crystal programming language.
17 stars
0 dependents
License: APLv2
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
bip39:
github: q9f/bip39.cr
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# bip39.cr
[](https://github.com/q9f/bip39.cr/actions)
[](https://codecov.io/gh/q9f/bip39.cr)
[](https://q9f.github.io/bip39.cr/)
[](https://github.com/q9f/bip39.cr/releases/latest)
[](https://github.com/q9f/bip39.cr/search?l=crystal)
[](LICENSE)
a native library implementing `bip-0039` mnemonics purely for the crystal language.
> _this bip (0039) describes the implementation of a mnemonic code or mnemonic sentence -- a group of easy to remember words -- for the generation of deterministic wallets._
>
> _it consists of two parts: generating the mnemonic and converting it into a binary seed. this seed can be later used to generate deterministic wallets using bip-0032 or similar methods._
ref: [bitcoin/bips/bip-0039](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)
# installation
add the `bip39` library to your `shard.yml`
```yaml
dependencies:
bip39:
github: q9f/bip39.cr
version: "~> 0.1"
```
# usage
```crystal
# import bip39
require "bip39"
```
you can generate and recover mnemonics fully adhering to the [bip-0039 specification](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).
```crystal
m0 = Bip0039::Mnemonic.new
# => <Bip0039::Mnemonic:0x7f51769bcd20 @ent=128, @seed=183297182565288719506055787609377395053>
m0.to_words
# => ["measure", "come", "cube", "ostrich", "wide", "inspire", "hello", "essay", "ready", "cute", "reform", "sustain"]
m0.to_hex
# => "89e5c0d5ce7faaea9ab269b2c6d6d16d"
```
the default entropy is of 128 bits. this shard can generate seeds of of 128/160/192/224/256-bit entropy. just initialize mnemonics with the bit-size, e.g., `Bip0039::Mnemonic.new 256`.
it's easily possible to recover bip-0039 mnemonics from a phrase or a seed by simply passing it to the constructor.
```crystal
m1 = Bip0039::Mnemonic.new ["measure", "come", "cube", "ostrich", "wide", "inspire", "hello", "essay", "ready", "cute", "reform", "sustain"]
# => <Bip0039::Mnemonic:0x7f37ca6e4c80 @ent=128, @seed=183297182565288719506055787609377395053>
m1.to_hex
# => "89e5c0d5ce7faaea9ab269b2c6d6d16d"
m2 = Bip0039::Mnemonic.new "89e5c0d5ce7faaea9ab269b2c6d6d16d"
# => <Bip0039::Mnemonic:0x7f37ca6e4be0 @ent=128, @seed=183297182565288719506055787609377395053>
m2.to_words
# => ["measure", "come", "cube", "ostrich", "wide", "inspire", "hello", "essay", "ready", "cute", "reform", "sustain"]
```
# documentation
the full library documentation can be found here: [q9f.github.io/bip39.cr](https://q9f.github.io/bip39.cr/)
generate a local copy with:
```
crystal docs
```
# testing
the library is entirely specified through tests in `./spec`; run:
```bash
crystal spec --verbose
```
# contribute
create a pull request, and make sure tests and linter passes.
license: apache license v2.0
contributors: [**@q9f**](https://github.com/q9f/)
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Jan 5, 2023
- Commit
ba697768b988- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/q9f/bip39.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 2