Code Monkey home page Code Monkey logo

bitcoin-key-generator's Introduction

Bitcoin-key-generator

The goal of this project is to create the necessary functions to generate Bitcoin keys, both public and private, and calculate their corresponding addresses. It will also allow us to generate private keys in WIF format that can be imported into standard wallets.

Public key to bitcoin address: conversion of a public key into a bitcoin address. From Mastering Bitcoin: Programming the Open Blockchain

Key pair generation function

Function that generates a key pair (private key / public key) that can be used in the Bitcoin system. The function does not receive any input parameters and generates a random private key. The function returns a two value vector:

  • The first value will be the private key and will be represented as an integer of the ring in which the secp256k1 curve works
  • The second value of the vector will be the public key and will be represented as a point of the elliptic curve
def key_gen()

Public key generation function

A function that generates a public key from a private key. The function receives the private key (SK) as a parameter. The function will return the public key represented as a point of the elliptic curve secp256k1

def pk_from_sk(sk)

Private key export function

Function that converts a private key in WIF format. The function receives three input parameters:

  • The private key to convert
  • The network for which you want to export the key (which can be MAINET or TESTNET)
  • A boolean (True / False) that will indicate whether the export is to be done in compressed mode or not The function returns the value of the private key in WIF format
def sk_to_wif(sk, network, compressed)

Bitcoin address generation function

Function that generates a P2PKH Bitcoin address from a public key. The function will receive three input parameters:

  • The public key
  • The network for which you want to generate the address (which can be MAINET or TESTNET)
  • A boolean (True / False) that will indicate whether the export is to be done in compressed mode or not The function returns the address
def get_address(pk, network, compressed)

bitcoin-key-generator's People

Stargazers

 avatar  avatar

Watchers

 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.