Code Monkey home page Code Monkey logo

bitcoinolog's Introduction

Bitcoinolog: Reason about Bitcoin addresses with Prolog

Offline Bitcoin wallet creation

Bitcoinolog uses Prolog and BoringSSL to create Bitcoin addresses and private keys with several nice properties:

  • generated keys are cryptographically secure to the extent that BoringSSL guarantees this property
  • the Prolog code is short and uses no external programs
  • keys can be generated offline, on a machine that has no Internet connection.

Bitcoinolog requires Scryer Prolog.

To try it, download bitcoinolog.pl and run:

$ scryer-prolog bitcoinolog.pl

Here is an example query that you can try:

?- repeat,
       new_private_key(PrivateKey),
       private_key_to_public_key(PrivateKey, PublicKey),
       public_key_to_address(PublicKey, Address),
       private_key_to_wif(PrivateKey, WIF),
       format:portray_clause((address_key(A, K) :- A=Address, K=WIF)),
       false.

This Prolog query generates Bitcoin addresses and private keys in Wallet Import Format (WIF), yielding:

address_key(A, B) :-
     A="1Nis7V58Mb839kXb9RZMDzAN6ZTQbNfGC4",
     B="L1T3AnvHDtaAhkr9zxKokKzqphx26cvdoU8HbEifsWH6chy4bzYS".
address_key(A, B) :-
     A="1D34yFJGRtiLuW2abwPBfks4cCi1Usp9a3",
     B="L5NUQyHr5zaJgG9ALbVGD1tcxodf51kUvQDANcNhpej1itV9KNLD".
address_key(A, B) :-
     A="12TUkSL2yyiiAD2f4zAcGDQPev2FSQmVwF",
     B="KyR4Ut96DFadt1LbdZNFzCLuJ2Hw9KSeX6wfMv2dnQwgympWZyyU".
address_key(A, B) :-
     A="1HySx6JBQKZoPqjUPVnbitFASKJjdAWWzx",
     B="Kxcr5G39Y7jUvsmsoDK5TnezsQ4FkTcYRVTcxzTT3uLYKnHFYiVh".

For more information, visit:

https://www.metalevel.at/bitcoinolog/

Video: https://www.metalevel.at/prolog/videos/bitcoinolog

Elliptic Curve Cryptography in Prolog

Bitcoinolog uses library(crypto) for hashing and reasoning over elliptic curves.

Alternatively, you can use ecclog.pl for reasoning over elliptic curves in Prolog. Simply use the ecc_ predicates instead of those starting with crypto_:

  • crypto_curve_generator/2ecc_curve_generator/2
  • crypto_curve_order/2ecc_curve_order/2
  • etc.

Internally, library(ecc) uses CLP(ℤ) constraints to facilitate declarative debugging.

bitcoinolog's People

Contributors

triska avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.