Book Image

Hands-On Bitcoin Programming with Python

By : BignumWorks Software LLP
Book Image

Hands-On Bitcoin Programming with Python

By: BignumWorks Software LLP

Overview of this book

Bitcoin is a cryptocurrency that’s changing the face of online payments. Hands-On Bitcoin Programming with Python teaches you to build software applications for mining and creating Bitcoins using Python. This book starts with the basics of both Bitcoin and blockchain and gives you an overview of these inherent concepts by showing you how to build Bitcoin-driven applications with Python. Packed with clear instructions and practical examples, you will learn to understand simple Python coding examples that work with this cryptocurrency. By the end of the book, you’ll be able to mine Bitcoins, accept Bitcoin payments on the app, and work with the basics of blockchain technology to create simply distributed ledgers.
Table of Contents (6 chapters)

Creating a multisignature bitcoin address

A multisignature address is an address that is associated with more than one private key; therefore, we need to create three private keys.

Go through the following steps to create a multisignature bitcoin address:

  1. Create three private keys:
#!/usr/bin/env python
'''
Title - Create multi-signature address

This program demonstrates the creation of
Multi-signature bitcoin address.
'''
# import bitcoin
from bitcoin import *

# Create Private Keys
my_private_key1 = random_key()
my_private_key2 = random_key()
my_private_key3 = random_key()

print("Private Key1: %s" % my_private_key1)
print("Private Key2: %s" % my_private_key2)
print("Private Key3: %s" % my_private_key3)
print('\n')
  1. Create three public keys from those private keys using the privtopub function:
# Create Public keys
my_public_key1...