Bitcoin and Blockchain for Pythoneers
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 160 | |
Author | ||
License | CC Attribution - NonCommercial - ShareAlike 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this | |
Identifiers | 10.5446/33689 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
00:00
AuthorizationRight angleCentralizer and normalizerLecture/Conference
00:42
Service (economics)Database transactionHeat transferDatabaseSynchronizationComputer networkIdentity managementProof theoryBlock (periodic table)ChainPoint (geometry)EmailInformationHash functionRevision controlNetwork topologyRootAuthorizationSingle-precision floating-point formatGoodness of fitPoint (geometry)Extension (kinesiology)NumberForm (programming)QuicksortPeer-to-peerTheoryMoore's lawElasticity (physics)Mathematical analysisDatabase transactionSystem identificationPhysical systemIntegrated development environmentNetwork topologyDatabaseChainMultiplicationFormal grammarOrdinary differential equationNeuroinformatikThermal conductivityProof theoryTrigonometric functionsoutputCellular automatonInformationRootOrder (biology)Multiplication signMereologyIdentity managementData miningWorkstation <Musikinstrument>Normal (geometry)Matching (graph theory)Complete metric spaceMathematicsComputer programmingAtomic numberSoftwareHeat transferImage registrationBlock (periodic table)Bit2 (number)EmailTimestampDoubling the cubeFrequencyRevision controlComputer animation
07:32
Revision controlBlock (periodic table)RootNetwork topologyDatabase transactionHash functionInformationEmailPhysical systemInclusion mapWeb pageChainCryptographyPoint (geometry)Data miningDatabase transactionWater vaporPhysical systemOcean currentChainMoment (mathematics)Block (periodic table)Food energyForm (programming)Uniform resource locatorProcedural programmingArithmetic meanPoint (geometry)Logistic distributionInformationHash functionProof theoryRight angleState of matterSet (mathematics)Traffic reportingMoore's lawWeb pageNeuroinformatikDisk read-and-write head
14:14
Auto mechanicHash functionData miningDatabase transactionoutputBlock (periodic table)Revision controlMatching (graph theory)ChainVertex (graph theory)Physical systemHash functionDesign by contractoutputRootMathematicsDatabase transactionNetwork topologyForm (programming)Multiplication signInformationTriangleRevision controlBlock (periodic table)SoftwarePoint (geometry)2 (number)Computer animationDiagram
16:07
ChainBlock (periodic table)Web pageDatabase transactionCryptographyData structureFunction (mathematics)Hash functionDegree (graph theory)Database transactionPoint (geometry)Structural loadData structureSoftwareHash functionComputer animationLecture/ConferenceXMLProgram flowchart
16:50
Database transactionAxiomAddress spaceoutputPublic-key cryptographyFunction (mathematics)Hash functionAxiomDatabase transactionAreaBeat (acoustics)Multiplication signMetadataAddress space
18:08
Function (mathematics)Price indexoutputScripting languageDatabase transactionPublic-key cryptographyFunction (mathematics)Electronic signatureDatabase transactionMultiplication signoutputSinc functionGroup actionAreaScripting languageHash functionDesign by contractSlide ruleCuboidForm (programming)Row (database)Address spaceComputer animation
20:54
Hash functionFormal verificationDatabase transactionScripting languageDatabase transactionData miningValidity (statistics)MathematicsLine (geometry)CausalityScripting languageDiscrete groupoutputElectronic signaturePhysical systemProgrammschleifeChainHash functionHydraulic jumpFunction (mathematics)Computer animation
22:34
Hash functionNormed vector spaceFormal verificationDatabase transactionScripting languageStack (abstract data type)Operator (mathematics)Public-key cryptographyPrice indexStack (abstract data type)Electronic signatureComputer animation
22:59
Scripting languageFormal verificationDatabase transactionHash functionDatabase transactionPublic-key cryptographyGroup actionEscape characterPrice indexHash function
23:37
Database transactionElectronic signatureDesign by contractMultiplicationJust-in-Time-CompilerScripting languageDesign by contractKernel (computing)Database transactionCartesian coordinate systemType theoryMultiplicationElectronic signatureComputer animation
24:40
Digital signalRevision controlPeer-to-peerComputer networkHash functionDatabase transactionProof theoryChainTimestampEvent horizonSequenceBefehlsprozessorVertex (graph theory)Message passingBasis <Mathematik>Data structureAbstractionNormed vector spaceCommunications protocolVolumeData miningBlock (periodic table)Food energyState of matterSlide ruleCommunications protocolCASE <Informatik>Computer programmingChainData miningDatabase transactionLimit (category theory)Volume (thermodynamics)Film editingProof theoryFault-tolerant systemBlock (periodic table)Exterior algebraBit rateComputer animation
26:15
Pairwise comparisonHypercubeCommunications protocolBlock (periodic table)Vertex (graph theory)Personal digital assistantCryptographyPlastikkarteDigital signalDatabaseData storage deviceCASE <Informatik>Formal languageDatabase transactionDesign by contractIntrusion detection systemBlock (periodic table)Exterior algebraState of matterChainSpeech synthesisReal numberTheoryPairwise comparisonOcean currentBit rateCodeField (computer science)Computer animation
Transcript: English(auto-generated)
00:05
I have quite a lot to tell you, so let's go straight to a rather short but hopefully deep dive into the Python and blockchain matter.
00:23
Most of you know that Bitcoin is a cryptocurrency. It's fast, reliable and most of all it works without central authority. Why is this a good thing to work without central authority, central authority like a government or a bank?
00:47
It's good because a bank, you know, it offers a single point of failure. It can go down or the database of a bank can go down and then that poses a huge failure and costs a lot.
01:15
So, to work around this, we have to distribute what the bank or the central authority made to every computer.
01:33
This is the reason of the blockchain. It's a distributed ledger, it's a peer-to-peer network.
01:43
But of course, if we distribute the ledger, this comes with other problems. The first problem is a transaction forgery.
02:02
You have to, if you work in a distributed environment, each transaction has to be announced publicly. And in a simple approach, a transaction in the form Alice transfers a coin to Bob can be replayed.
02:22
And such a replay is ambiguous. It could mean either Alice wants to transfer a second coin to Bob or it can mean Alice wants to fool Bob or it can mean Bob replaces the transaction to get multiple coins from Alice's account.
02:44
To get around this problem, you have to add an identification. For example, a serial number to every coin in the system. But this poses another problem. It's called the double spending problem.
03:04
Now, we have a transaction in the form Alice transfers a coin with the ID 42 to Bob. But this transaction can be duplicated by Alice transfers coin 42 to Charlie.
03:29
And if the transaction to Bob is announced before the transaction to Charlie, this is not a problem. But in a distributed network, we have to deal with network latency.
03:43
We have to deal with the undesirable period between issuing a transaction and having everyone informed about it. To work around this problem of double spending, we let the whole network verify the legitimacy of a transaction.
04:03
But with such a solution, we come to the last problem. It's called Sybil attack. An attacker in such an approach can install false identities.
04:23
And if the attacker has installed enough such false identities, then he will be able to win. And to effectively double spend the transaction.
04:41
So the solution is that we have to create, to make creation of false identities expensive. To do this, the mining node has to perform some work.
05:06
And thereby, the ability to verify transaction depends on the computing power and not on the number of identities. And this principle, this idea is called proof of work.
05:26
So with these workarounds, we've come to the basic principles of the Bitcoin blockchain. Transactions are verified in a disputed manner and registered in blocks.
05:41
And these blocks form a chain, the famous Bitcoin blockchain. Blocks are created using a proof of work. And new blocks are created mined on the longest chain. We have to now, we have to take a closer look to the blockchain header to understand how the proof of work works.
06:13
The blockchain header consists of six input information. The first is the version number of the blockchain protocol.
06:23
This is a fixed value. Then a timestamp. This timestamp changes every second. Then there's a difficulty. The zero bits which a mined block header has to match.
06:49
Then a reference to the previous block's hash. And this is also a fixed value of course. Then the root of the Merkle tree goes into the block header.
07:01
And the Merkle tree is the registrations of all transactions that are processed by the block. And the sixth input value is the nouns. And these nouns can be freely chosen. A valid block consists of these parts.
07:28
A valid block consists of the following parts. On the one side it's the block header. And on the second side it's the registered transactions. And the third is the block hash which is calculated from the head information.
07:46
To calculate the block's hash, two pieces of information are fundamental. It's the difficulty and the nouns.
08:04
If we calculate a hash, you know it. It's a rather simple procedure. But the outcome is unexpected. But with the difficulty, we say that the created block hash has to match a distinct form.
08:38
The difficulty says that the created block hash has to start with a certain amount of zero bits.
08:51
So if we see that the block is created of some fixed values,
09:02
then the outcome is exactly defined. And we don't have some freedom to vary. And here is the point where the nouns come in.
09:20
This nouns can be freely chosen. And the proof of work consists of varying the nouns until the created hash matches the difficulty. That's how the proof of work works.
09:45
So the distributed blockchain consists of thousands of nodes which try to create blocks.
10:01
And they spend their computer power to create blocks and make the blockchain alive. Why does anyone provide this computing power?
10:25
Because it consumes energy and energy has to be paid. So there must be an incentive that block miners contribute to the blockchain.
10:40
And one of the incentives is that the mining node that was able to create a new block with the matching block hash gets some bitcoins, the so-called Coinbase.
11:02
At the moment, each created block is rewarded by 12.5 bitcoins. And that's about 30,000 US dollars. In addition, the participant that created the new block gets all the transaction fees.
11:25
So there's a very interesting idea that if the block reward on the one hand is the incentive for the block miners and on the other hand it's that with this step new bitcoins get contributed, get introduced to the system.
11:55
At the beginning, the block reward started by 50 bitcoins and every 2,140, every 210,000 blocks this reward is halved.
12:16
So the whole, the mining reward is continuously sinking.
12:26
At the end, around 2,140, the bitcoin system will contain exactly 21 million bitcoins. So we can recapitulate what we learned until now.
12:47
Transactions are registered in the blocks and we can think of blocks as pages of distributed ledger. Blocks are formed to a chain to give a complete order of the transaction history.
13:02
Blocks are created solving a cryptographic puzzle, the proof of work. And this is to prevent civil attacks. New blocks are mined on the longest chain to prevent forks. And the mine of the new block is rewarded by a certain amount of bitcoins.
13:25
I made a short animation for recapitulation. Here we have a system consisting of three mining nodes.
13:52
And we see each node is hashing independently. The hashes are displayed on the right of each node.
14:05
So we have three nodes in this system.
14:30
And the orange points are transactions getting into the system. The triangle beyond the nodes symbolize the Merkle tree.
14:52
And the transactions are validated and dispatched.
15:04
If we look at the block header, the six input information. The first is the version. Actually it's version two. Then the time. This information changes every second.
15:21
The difficulty in this example is six. The real world is of course much higher than us. This is the information, the input that can be freely chosen. The previous block, which has to match the difficulty. And the transactions, which are here in the form of the root of the Merkle tree.
15:46
Eventually one of the blocks finds a hash that matches the difficulty. And the new block is dispatched. The other blocks in the network have to validate not only the block,
16:02
but also the transaction, each transaction registered in the block. Now we have to look at the transaction,
16:21
because the transaction is the most important thing in cryptocurrency. We have to prove that the ownership of the coins in the network is guaranteed. The transaction has the following structure.
16:46
In yellow the transaction ID, which of course is a hash. Then some descriptors and metadata. Then an input, this is the pink area.
17:04
And an output, the green area. To understand how a transaction works, you have to know the axioms, which rule a transaction.
17:22
There are four axioms. Any Bitcoin amount is sent to an address. Any Bitcoin amount received is locked to the receiving address. And addresses are managed by a wallet.
17:41
Any time we spend Bitcoin, the amount we spend will always come from funds previously received and currently present in our wallet. Addresses receive Bitcoin, but they do not send Bitcoin. Bitcoin is sent from a wallet. What is an address?
18:00
An address is nothing else than the hashed public key of the receiver. So this is the... We have here to deal with public and private key. A wallet starts from a private key
18:23
and generates the public key and the address from the public key. Here is an example starting from the transaction where Alice sends Bob some amount.
18:41
This example, 0.5 Bitcoins. To do so, she creates a transaction record which has as output the amount and script public key. This is a script with a special name.
19:06
And this script contains the public key hashed from Bob's wallet. And this is nothing else than the address.
19:21
At this time, the output is unspent. Each output remains unspent as long as this output is not used as an input. In another transaction. So let's now spend this amount by creating another transaction.
19:43
In this transaction, Bob sends Charlie 0.4 Bitcoins. This transaction consists of an input
20:02
and the input references the ID of the former transaction coming from Alice and the signature script. And this signature script consists of Bob's public key
20:21
and the signature created by Bob's private key. And of course, this transaction has also an output which includes Charlie's public key in hashed form. The red area on this slide combines the output of the previous transaction
20:44
and the input of the current transaction. How do we verify transactions? Mining nodes have to validate every incoming transaction.
21:04
First, to do so, first they retrieve the reference preceding transaction. The amount to transfer in the current transaction has to be less than the amount of the transaction referenced in the input. And of course, such an input has to be unspent.
21:25
As next step, the signature script in the input is combined with the output script of the reference transaction. And in the second line, I have combined these two scripts.
21:47
In the most common script transaction is called pay-to-public-keyhash. The Bitcoin blockchain uses a fourth-like stack-based scripting system
22:06
for transaction validation. The scripting system is not Turing-complete. That means it's stateless and has neither loops nor jumps.
22:22
So, because it's rather simple, we can animate and look for how this works. First the data is put on the stack and then some operations are put on the stack.
22:44
Then the next public key is put and the quality is verified. The next operation checks the signature and if the signature is okay, then the okay indicator is left on the stack.
23:03
And this indicator, the true marker, shows that the transaction is valid. And the important thing to remember is that the public key is duplicated
23:23
and this combines the previous transaction and the actual transaction. The pay-to-public-keyhash is the most simple and most common script in the Bitcoin world.
23:45
But there are some other contracts that are thinkable and possible. For example, to implement escrow in the application, the possibility to create a multi-signature script.
24:11
In such a script, the two participants agree that a third party is also integrated
24:25
and the transaction is only valid if two of the three parties sign the contract. And with this knowledge,
24:40
now we can perfectly understand the abstract of the famous paper, Nakamoto published in 2008. But I will not read. But this is a very lucid abstract.
25:02
I will publish my slides and then you can read if you want. There are some problems with the Bitcoin blockchain. First, the transaction volume is limited. The limitation is caused by the size of a Bitcoin block
25:23
which is limited to one megabyte. The other limitation is the block creation rate which is set with Bitcoin is set to 10 minutes. But the more significant problem
25:42
is the high energy consumption which is used for block mining. So the people concerned with blockchains are looking for alternatives. There are alternative consensus protocols.
26:01
For example, the proof of stake or the practical Byzantine fault tolerance. There are alternatives to the Bitcoin blockchain. First, there are some forks of the Bitcoin blockchain
26:20
like Litecoin or Dogecoin. If you look at the comparison, Litecoin has lessened the block interval to 2.5 minutes and Dogecoin is on 1 minute.
26:41
So these forks have higher transaction rates. The most prominent rival of the Bitcoin blockchain is Ethereum. Ethereum has a known blockchain and has another scripting language.
27:02
The Ethereum scripting language is fully Turing-complete and allows for more complicated so-called smart contracts. And there is also an alternative
27:21
with Hyperledger, the IBM blockchain. So what are the blockchain use cases? First of all, it's of course the cryptocurrencies which is becoming more and more interesting
27:43
and not only in the developed countries but more so in failing states like Venezuela where they have to live with hyperinflation. And the real good alternative there is Bitcoin.
28:06
Use cases based on Ethereum is just shortly last week announced the city of Zug in the Swiss Silicon Valley announced that they are storing digital IDs
28:24
to the providing digital IDs which are stored in the Ethereum blockchain. So I hope I gave you a little introduction into the Bitcoin blockchain and thank you very much for your attention.