0% found this document useful (0 votes)
4 views

Module 2

The document provides an in-depth overview of Bitcoin, covering its history, transaction processes, and key concepts such as wallets, keys, and mining. It explains the phases of a Bitcoin transaction, including transacting, broadcasting, and settlement, as well as technical aspects like ECC and Base58 encoding. Additionally, it discusses P2SH transactions, their advantages, and limitations in the context of Bitcoin's functionality.

Uploaded by

pedopi8050
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Module 2

The document provides an in-depth overview of Bitcoin, covering its history, transaction processes, and key concepts such as wallets, keys, and mining. It explains the phases of a Bitcoin transaction, including transacting, broadcasting, and settlement, as well as technical aspects like ECC and Base58 encoding. Additionally, it discusses P2SH transactions, their advantages, and limitations in the context of Bitcoin's functionality.

Uploaded by

pedopi8050
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Module 2

Blockchain technology
Prof. Vinita Bhandiwad
• What is Bitcoin and the history of Bitcoin
• Bitcoin Transactions
• Bitcoin Concepts: keys, addresses and wallets, Bitcoin Transactions, UTXO.
• validation of Transactions
• Bitcoin Keys
• Addresses
• ECC , Base58 , BIP-38 , Pay-to Script and Multisig Addresses, Vanity Addresse
• Concept of Wallet, Wallet Technologies in Bitcoin HD wallet from Seed

Contents • Transaction Scripts and Scripts address, Bitcoin Mining and Difficulty levels
Structure of Blocks and Blockheader and Genesis Block ,linking of Block.
• Bitcoin Network: Bitcoin Core node and API, Peer-to-Peer Network Architecture,
Node Types and Roles
• Incentive based Engineering, The Extended Bitcoin Network, Bitcoin Relay
Networks, Network Discovery, Full Nodes, Exchanging “Inventory”, Simplified
Payment Verification (SPV) Nodes, SPV Nodes and Privacy, Transaction Pools
• Blockchain Forks Bitcoin Testnet
• Basics of Bitcoin Forensics: Analysis of Address and Wallet , Clustering of
Addresses following Money
What is bitcoin and its history
Task for students
What is bit coin

Digital money protocol


Coin Vs Token
How bitcoin works?
• You would first need to download a Bitcoin ‘wallet’ to your desktop or mobile device. The
wallet is used to both store Bitcoin securely and to make transactions.
• Your wallet generates ‘public keys’ of 34 letters and numbers (think of this as an email
address) that can be shared with anyone you want to make a transaction with. Addresses
should only be used once.
• When making a transaction, two wallets will connect with each other via the ‘public key’ and
then the transaction is signed off by the ‘private key’ (think of this as a PIN or password)
which is stored in the wallet releasing the funds.
• Once a transaction has been made, it’s broadcast to the Blockchain network for recording.
This is the ‘mining’ process that involves validating the transaction and recording it into a
block.
• Once the transaction is verified and recorded across the network, it cannot be changed and
becomes a permanent record.
• A Bitcoin transaction is a multi-step process
that allows the transfer of bitcoin from one user
to another. To understand how Bitcoin works,
grasping the concept of a Bitcoin transaction is
one of the key components of the operation of
the market's first and largest cryptocurrency.
• Phases of a Bitcoin Transaction

• A Bitcoin transaction can be divided into three
phases:

o Transacting
o Broadcasting
o Settlement
Transacting
• The first phase of a Bitcoin transaction is transacting.
The transacting phase involves relatively many
details, and for this reason, this phase will be
discussed separately from the user's perspective and
the technical perspective.
User Perspective
• In the transacting phase, the user initiating the
transaction carries out all the actions required for
the transaction to be completed. From the user's
standpoint, making the transaction is usually quite
easy, as the services and applications typically handle
all the details that the technical perspective requires.
• The user making the transaction usually has to make
three choices
o Sending Address:
o Receiving Address:
o Amount to Send:
Technical Perspective
• From a technical perspective, the aspects related to the
transaction phase are somewhat more complex. These are
elements that pertain to every Bitcoin transaction but are not
visible to the user initiating the transaction in many services and
applications.
• The key terms related to the transacting phase from a technical
perspective are:
Public Key:
• The public key is a shareable key from which a Bitcoin address
can be generated.
Private Key:
• The private key is a secret key used to carry out Bitcoin
transactions.
Unspent Transaction Output (UTXO):
• Unspent Transaction Output (UTXO) is a very central part of
Bitcoin, as all existing bitcoins exist in the form of UTXOs. Let’s go
through what UTXO means with an example: Bitcoin address A
has 1 bitcoin, and from this address, a transaction of 0.8 bitcoins
is being made to address B, which has no bitcoins at all.
• Broadcasting
• In the second phase, namely the broadcasting phase, the details of the Bitcoin transaction are sent to the
Bitcoin network. Servers called nodes, which store the history of the Bitcoin network, ensure that the transaction complies with
the rules of the Bitcoin network. Once the nodes have verified the correctness of the transaction, the transaction moves to wait in the place
called mempool (short for memory pool).

• Settlement
• The final phase of a Bitcoin transaction is the settlement of the transaction. At this stage, a significant aspect of Bitcoin's operation, namely
Bitcoin mining, comes into play. The core of mining consists of efficient computers specifically designed for Bitcoin mining, referred to as
miners. Miners compete with computing power to see who can be the first to solve the problem and add the next block to the Bitcoin
blockchain. This competition based on computing power is a result of the Proof of Work consensus algorithm used by Bitcoin.
• Adding a block to the Bitcoin blockchain is also a key aspect from the perspective of the Bitcoin transaction.
Working of
Bitcoin
ECC (Elliptical curve cryptography)
• Elliptic Curve Cryptography (ECC) is one of the most interesting – and important – concepts in the
intersection between Mathematics and Technology.
• ECC is a type of one-way cryptographic function, that is, it allows turning an input into an output in such a
way that it is impossible to obtain the original input data from the output.
• ECC is essential in a crucial step: deriving the Public Key from the Private Key. Without a one-way function like
ECC, our private key will be exposed every time we share our Public Key and therefore, an attacker could
obtain our funds.
• For the case of Bitcoin, Satoshi Nakamoto chose the elliptic curve called «secp256k1», a variant used both to
derive public keys and to sign Bitcoin transactions.
• If we seek a high level of security when employing a one-way function, an optimal degree would be 128 bits of
equivalent security—equivalent to the security provided by a 128-bit symmetric key encryption.
• ECC is based on mathematical operations that are computationally infeasible to solve even with current
supercomputers. This allows ECC to achieve high levels of security.
Elliptic Curve equation and secp256k1 parameters

• The Elliptic Curve is a mathematical function defined by the following formula:

• Where a and b are parameters that specify each curve. Every combination of different values for a and b,
generates a new elliptic curve with unique properties.
• In the Elliptic Curve used in Bitcoin, “secp256k1”, a takes the value of 0 and b takes the value of 7.
Consequently, the equation is as follows:
Deriving the Public Key

• The Public Key is obtained from the Private Key and a constant G known as the Generator
Point, which is static and defined in the secp256k1 curve parameters, through the following
operation:
K (Public Key) = k (Private Key) x G (Generator Point)

• This operation is performed on the coordinates of the Elliptic Curve, instead of real numbers.
So, in this particular case, multiplying is best interpreted as adding the Generator Point as
many times as indicated by the private key value.
• If the Private Key were «5», to obtain the Public Key you would have to add G+G+G+G+G = 5G.
• As we have said before, the Generator Point (G) is a constant already determined in the initial
parameters of the secp256k1 elliptic curve:
Task for students: study
through different source
encryption and
decryption in ECC
Base58 Encoder for Bitcoin
• Base58 is a group of binary-to-text encoding schemes used to represent large integers as
alphanumeric text. It is similar to Base64 but has been modified to avoid both non-
alphanumeric characters and letters which might look ambiguous when printed.
• The Base58 encoding format is designed for use in Bitcoin and is used in many
other cryptocurrencies. It offers a balance between compact performance, readability,
definition and error prevention. Base58 is a subset of Base64 that uses lowercase and
uppercase letters and numbers, but without some characters that are often mistaken for
each other and can be identical in some fonts.
• In particular, Base58 is Base64 without the number 0 (zero), O (capital letter O), l (small L), I
(large i), and the characters “+” and “/”. Or, simply put, it is a set of uppercase and lowercase
letters and numbers without the four (0, O, L, I) mentioned above.
• Base58Check is a Base58 encoding format that unambiguously encodes the type of data in
the first few characters and includes an error detection code in the last few characters.
Base58 Encoder for Bitcoin
• With Base58, private key can be converted to a public key, but a public key
cannot be converted to a private key. The bitcoin address is not really a public
key, but its hash.
• Bitcoin address is not presented in hexadecimal form as secret and public
keys. This is because for him, Bitcoin uses a “compressed” format, known as
base58check. Bitcoin Base58 suggests that it uses 58 different letters and
numbers (zero, O, l and I are omitted, as they are too easily confused with
each other). Base58 is a number with a base 58-similar to the usual for us
binary (base 2), decimal (base 10) or hexadecimal (base 16) representation.
Base58 alphabet:
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
Study what is BIP-38?
P2SH: Pay To Script Hash

• P2SH, or "Pay to Script Hash" transactions in full form, are one specific type of payment in
the Bitcoin script. P2SH was introduced to the Bitcoin network, which was mined on April 1,
2012.
• The introduction of P2SH allows users to send BTC without having to worry about how a
recipient unlocks access to the payment (e.g. via a passphrase or with multi-signature
requirements in place).
• P2SH also provides a method for senders to place the responsibility of paying additional
network fees on the recipient rather than themselves. Prior to the activation of P2SH,
senders had no standardized way to implement these scripts. It was possible to use
customized scripts, but these were pretty complex and time-consuming to write for most
users.
How Does P2SH Work?
• The first step of a P2SH transaction works in a similar fashion to that of a P2PKH transaction, in that
both lock the payment to a specific hash. A hash is the output— formally known as the digest— of a
cryptographic hash function.
• For P2PKH transactions, the input is simply the recipient’s pubkey. The output, or hash, of that pub key
is the hash to which the funds are locked (hence the name “pay to pub key hash”). All a recipient needs
to do in order to claim the funds is produce the right pubkey (as well as a digital signature from the
private key from which that pubkey was derived)
• The blockchain’s peer to peer network verifies that the hash of the pub key matches the hash of the
payment. If the two hashes match, the funds are released to the user who owns that pub key.
• For P2SH payments, the input is often more complex. It may add constraints in addition to an ordinary
digital signature or pubkey verification, such as requiring digital signatures from multiple private keys.
These constraints are created with a few lines of code known as a script. The hash of that script is used
to lock a payment in a “Pay To Script Hash” transaction.
• Once a script is hashed and the subsequent script hash has funds locked to it on-chain, the only way to
spend those funds is to enter the original script used to create the hash in the first place. This is called
the “redeem script.” The redeem script verifies the recipient is producing the correct data— the
corresponding script, script hash, and signature script— before the funds are released
Advantages
• Multisig: The main use case for P2SH is the ability to easily support multi-signature transactions. This
can provide extra security for a group of individuals or companies that want to ensure that no one
person can move or steal BTC from a shared wallet.
• Security: Although P2SH transactions usually include a highly complex set of instructions,
cryptographic hashing ensures that this script maintains the same level of security as P2PKH.
• Easier For Senders: Senders no longer bear the burden of having to write complex logic on behalf of
recipients. A P2SH transaction can be executed simply by sending to a standard address format that
starts with the number ‘3’. Senders also don’t have to pay the extra costs that come with storing extra
bytes corresponding to the more complex scripts on the blockchain.

Limitations
• Data Size: A 2-of-3 multisig script using P2SH requires 278 bytes compared to only 253 bytes with
P2MS. Taking up more data on the blockchain tends to create network congestion issues.
• Single Signatures: P2SH was initially developed to provide a solution for multisig wallets. This means
that other script types are more commonly used for single signature transactions. Most end users won’t
have a need for complex scripts, so the adoption of P2SH has been somewhat limited.

You might also like