Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

BLOCKCHAIN TECHNOLOGY

SUBJECT CODE: 20CS63

ACTIVITY BASED ASSESSMENT

TOPIC: BITCOIN USING PYTHON

PRESENTED BY:

1. CHAITHANYA S 4VV20CS021

2. CHINMAYI H 4VV20CS024

3. HAMSINI D 4VV20CS046

FACULTY NAME:

PROF.BALARENGADURAI C
BITCOIN USING PYTHON

 BITCOIN is a digital currency or cryptocurrency which has gained popularity since it started in 2009
by Satoshi Nakamoto.
 Bitcoin is the first successful electronic cash system and coincidentally, the first instance of a successful
Blockchain.
 No bank needed to authorize/process transactions.
 Transactions are stored on a distributed ledger.
 Bitcoin introduced the concept of cryptocurrency; decentralized digital money secured by
cryptography, and used to create valuable digital assets that cannot be counterfeited.
 Bitcoin is built on decades of cryptographic research such as the research in Merkle trees, hash
functions, public key cryptography, and digital signatures.
 Moreover, ideas such as BitGold, b-money, hashcash, and cryptographic time stamping provided the
foundations for bitcoin invention.
 Bitcoin transactions are authorized in a peer-to-peer network.
 Each node stores the history of the chain of blocks, containing validated transactions.
 Counterfeiting is impossible because if one node’s history is corrupted the others stay the same, and
no central authority (i.e.bank) needs to confirm; this is called decentralization.
 Bitcoin network are incentivized to participate through cryptocurrency ( Private & Public Keys)
 Specifically, the incentive is for the people who mint (create) Bitcoin, called miners.
GENERATING PRIVATE KEY, PUBLIC KEY, BITCOIN ADDRESS AND
MULTISIGNATURE ADDRESSES

Setup your Computer

Install Python

Download and install python from http://www.python.org/ Make sure to download the Python
3.x as that’s the one we are going to be using in this tutorial.

Install bitcoin python library

After you finish installing Python, open your command line program and execute below
command to install bitcoin python library

pip install bitcoin


GENERATING PRIVATE KEY

Private keys are basically 256-bit numbers chosen in the range. Any randomly chosen 256-bit number from
0x1 to 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140
is a valid private key.
GENERATING PUBLIC KEY

 In public key cryptography, public keys are generated from private keys.
 Bitcoin uses ECC (Elliptic curve cryptography).
 A private key is randomly selected and is 256-bit in length.
 Public keys can be presented in an uncompressed or compressed format.
 Public keys are basically x and y coordinates on an elliptic curve and in an uncompressed format and
are presented with a prefix of 04 in a hexadecimal format.
 X and Y coordinates are both 32- bit in length.
 Next, we generate a public key. We do this by passing the private key we generated
to privtopub function.
GENERATING BITCOIN ADDRESS

 In order to generate an address, your wallet first generates a private key.


 A private key is nothing but a large number roughly between 1 and 2256.
 Wallet converts that private key to a Bitcoin address using a well-known function.
 It uses elliptic curve cryptography to generate Bitcoin addresses.
 If anyone knows your private key, they could easily convert it to a Bitcoin address, too.
 Bitcoin address usually starts with 1 or 3.
GENERATING MULTISIGNATURE ADDRESS

Multi-signature (multisig) refers to requiring multiple keys to authorize a Bitcoin transaction, rather than a
single signature from one key. It has a number of applications.

 Dividing up responsibility for possession of bitcoins among multiple people.


 Avoiding a single point of failure, making it substantially more difficult for the wallet to be
compromised.
 m-of-n backup where loss of a single seed doesn't lead to loss of the wallet.
CONCLUSION

The public key is used to send cryptocurrency into a wallet. The private key is used to verify transactions and
prove ownership of a blockchain address. If someone sends you, say one bitcoin (BTC), a private key will be
required to “unlock” that transaction and prove that you are now the owner of that bitcoin.

The function of the private key, technically speaking, is to "sign" transactions that use your funds. Transactions
using your funds cannot be validated by the network without your private key attached. The public key
encrypts transactions, which can be decrypted only by the corresponding private key. The technology is called
public-key cryptography, sometimes abbreviated PKC, or asymmetric cryptography.

A multisig wallet is a wallet that provides users with extra security because it requires multiple unique
signatures (hence multi-signature) to authorize and execute a transaction. A traditional — or single-sig —
Bitcoin wallet contains a Bitcoin address, each with one associated private key that grants the keyholder
complete control over the funds.

REFERENCES

1. https://medium.com/coinmonks/bitcoin-with-python-6595588c2fcf
2. https://www.coindesk.com/learn/a-crypto-must-know-public-vs-private
3. Mastering Blockchain: A deep dive into distributed ledgers, consensus protocols, smart contracts,
DApps, cryptocurrencies, Ethereum, and more, 3rd Edition

You might also like