bitcoin_address

Version, currently master branch1 version
  • master branchlatestAug 11, 2017

github.com/safiire/bitcoin_address_generator

Generate Bitcoin addresses in the Crystal programming language

5 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  bitcoin_address:
    github: safiire/bitcoin_address_generator
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.23.1
License
MIT
Author
Safiire
Target
  • bitcoin_address from src/bitcoin_address.cr

Dependencies

This version declares no dependencies.

README

Bitcoin Address Generator

This program takes a list of phrases and transforms them into working bitcoin addresses. It works by taking the sha256(phrase), and using that as the private key for a bitcoin address.

At one time or another, people were using addresses like this and calling them "BrainWallets", because instead of needing to remember a large private key to access their coins, they could just remember a phrase that could be easily transformed into a working address.

Ultimately people realized that it was easy to "snipe" the money out of addresses constructed this way, and that it's a bad idea to use brainwallets. I've even watched someone announce on Reddit a few years ago, that they'd put 1BTC in an unspecified brainwallet, and whoever can figure out the private key can have the money.

Even with no other information given, the private key was found within minutes.

Realistic uses

This code can also be used to create good bitcoin addresses, if we just allow OpenSSL to create the ECDSA key by itself, or provide it with a good random private key.

This code was actually written in order to test out the Crystal programming language's ability to call into external libraries written in C, in this case OpenSSL. So really, just an excuse to make something in Crystal.