Blockchain Technology - Lecture 8a
Blockchain Technology - Lecture 8a
[transactions + scripts]
TRANSACTIONS
banks
account-based paradigm
housekeeping
1
TRANSACTIONS
transaction-based model
append-only ledger
inputs, outputs
change addresses
2
PROPERTIES
efficient verification
consolidating funds
joint payments
3
SYNTAX: METADATA
{
transaction
hash "hash":"5a42590...b8b6b",
"ver":1,
housekeepi "vin_sz":2,
ng
"vout_sz":1,
not valid
before "lock_time":0,
housekeepi "size":404,
ng
...
}
4
TRANSACTION INPUTS
"in":[
{
"prev_out":{
previous "hash":"3be4...80260",
transaction
"n":0
},
signatu "scriptSig":"30440....3f3a4ce81"
re },
(more inputs) ...
],
5
TRANSACTION OUTPUTS
more
"out":[
{
output "value":"10.12287097",
value
"scriptPubKey":"OP_DUP
OP_HASH160 69e...3d42e
OP_EQUALVERIFY OP_CHECKSIG"
(more },
outputs)
...
recipient
] address
6
SCRIPTS
why scripts?
basic script: redeem by signature from owner of address
X
X = H(public key)
redeem by public key that hashes to X, along with
signature by owner of that public key
9
EXECUTION
stack
no memory or variables
data instructions, opcodes
10
HUMOR
READING MATERIAL
Chap 3: Bitcoin Mechanics
Bitcoin and Cryptocurrency Technologies:
A Comprehensive Introduction
Bitcoins the hard way (link)
Scripts (link)
12
Characteristics of Hash
Function
● Deterministic
● Quick Computation
● Pre-image Resistance
● Randomized
● Collision Resistant
Characteristics: Deterministic
● A hash function needs to have a fixed or
specific output
● It means is that it doesn’t matter what
number of times you process a given
input using a hash function; the result is
always of the same length.
● The hashes can be random and of
different patterns, but the same
size/length
Characteristics: Quick
Computation
● The hash function should be capable of
returning the hash of input quickly. If the
process isn’t fast enough then the
system simply won’t be efficient.
● If an ordinary computer needed several
minutes to process a cryptographic hash
function and receive the output, it would
not be very practical.
● Nowadays, an average home computer
Characteristics: Pre-image
Resistance
● Pre-image resistance means that the
output of a cryptographic hash function
must not reveal any information about
the input
● If a hash function ‘h’ produced a hash
value ‘z’, then it should be a difficult
process to find any input value ‘x’ that
hashes to ‘z’
● If a single word produces small hash and
Characteristics: Randomized
● Hash functions should produce different
outputs for every input, even if the input
data differs by only a digit or letter
● Hash of ‘Alpha’ should never be equal to
hash of ‘Alpha1’, ‘1Alpha’, ‘Alp1ha’, ‘Al
pha’, ‘alpha’ or any other such
combination.
Characteristics: Collision
Resistant
● It must be extremely unlikely to find two
different inputs that produce the same
output
● There are infinite possible inputs that
can be entered into a hash function
However, outputs are of a fixed length.
● This means that there are a finite
number of outputs that a hash function
can produce.