SlideShare a Scribd company logo
1 of 21
Download to read offline
1 
Bitcoin – Introduction for 
programmers 
Wojciech Langiewicz @ DRUG #58
2 
Scope of this talk 
● Introduction – What is Bitcoin, History 
● Core concepts 
– Keys, Addresses 
– Wallet 
– Clients 
– Transaction 
– Block 
– Mining 
– Blockchain
3 
What is Bitcoin 
● Collection of concepts (and full “ecosystem” of tools) 
● Decentralized peer-to-peer system 
● Solves 2 main problems: 
– Is that money authentic (not counterfeit) 
– Is there only singe occurrence of this specific coin (double spends) 
● Has much similarities to cash and gold
4 
Key elements of the ecosystem 
● Decentralized peer-to-peer network (Bitcoin protocol) 
● Public transaction ledger (Blockchain) 
● Decentralized currency issuing algorithms (mining) 
● Decentralized transaction verification (transaction scripts)
5 
Few words about history 
● Introduced in 2009 by Satoshi Nakamoto 
● https://bitcoin.org/bitcoin.pdf 
● Combined concepts that existed before 
● But have not been combined until then 
● POW algorithm + Blockchain
6 
Bitcoin Address 
● Something like this: 
1FzQW9CWpNBoqUmaLFKNMAYiBhj6ncJA7N 
● Usually shown as QR code: 
● Address is a Base58 encoded form 
of the public key 
● Based on the address prefix, you can figure out what type of 
address it is. 
● Types of addresses: Pubkey hash, script hash, private key 
● Address reuse 
● A word about HD Wallets
7 
Bitcoin Keys - ECDSA 
● Private keys – numbers between 0 and 2^256 
● Public key can be calculated from the private key 
● Public key can be represented as Base58 encoding, HEX 
number, etc 
● Private keys can also be encoded as Base58 – this is called 
WIF format – most common way to export/import keys 
between wallets
8 
Wallet 
● Client software running on: server, desktop, phone, “in the 
cloud”, it manages keys, signs transactions, generates new 
keys, etc 
● Bitcoin-qt 
● Electrum, Armory, Multibit 
● Blockchain.info 
● Mobile wallets with intermediate server 
● Other web wallets
9 
Full nodes 
● Full nodes store full copy of the blockchain 
● Currently over 40GB of data 
● Usually need for server-side type of applications 
● Provide JSON-RPC API 
● Example: Satoshi client, btcd
10 
SPV nodes 
● Lighweight nodes 
● Use Simplified Payment Verification instead of ITV 
● Suitable for desktops, phones 
● Instead of downloading full blockchain 
● Download transactions only for their addresses 
● Security and privacy implications 
● Example: bitcoinj
11 
Transaction 
● Coinbase transaction 
● Each transaction has 1 or more inputs and 1 or more outputs 
● Transaction “moves money” - changes owner 
● Transactions take inputs and translate it into outputs 
● Those outputs can serve as inputs to the new transaction
12 
Spending a transaction - P2PH 
● Example of transaction type “Pay to pubkey hash” 
● ScriptPubKey: 
OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY 
OP_CHECKSIG 
● scriptSig: <sig> <pubKey> 
● Script: 
<sig> <pubKey> OP_DUP OP_HASH160 <pubKeyHash> 
OP_EQUALVERIFY OP_CHECKSIG
13 
Executing a script
14 
Advanced transaction types 
● Multi signature (multisig) 
● OP_RETURN 
● Anyone can spend 
● Pay to script hash
15 
Blocks 
● Genesis block 
● Mining – process of confirming a block 
● Each block points to a previous one creating a blockchain 
● Quite few similarities to git (instead you can't merge)
16 
Mining 
● Merges transactions into blocks 
● Finds nonce that “solves” the block 
● Once the solution is found – block is published 
● Published – appended to the blockchain 
● Published blocks are verified by other nodes 
● This sends coinbase transaction to the miner + all fees 
● Proof of Work – 10 minutes per block 
● Difficulty
17 
Mining pools 
● Chance to find a solution to a block are small 
● Small miners join in pools where they share a profit 
● Instead of finding a block every year and getting 25BTC 
● You will get 0.5 BTC per week. 
● You have to trust the pool operator or use p2pool
18 
Blockchain 
● “A chain of blocks” 
● Clever approach to consensus problem 
● Miners after finding a new block publish it on the network 
● You base your security on a height of a transaction 
● Ensures that there are no duplication
19 
Blockchain fork 
● Situation when 2 blocks are found at the same time 
● Bitcoin network is in the state of a fork 
● 10 minutes later a new block is found that is based on one of 
the forks 
● All Bitcoin nodes quickly switch to the longer branch 
● Transactions from the shorter branch are orphaned and will 
be processed shortly after
20 
Few words about the 51% attack 
● Theoretically possible even with 40-50% of power 
● Can be used to destabilize network for some period of time 
● Can help to create a double-spend 
● In no case you'll be able to spend coins you don't have 
● This attack is not practical 
● Miners will make more BTC by being honest
21 
Next time 
● More about Bitcoin clients 
● Bitcoin-core / btcd API 
● Bitcoinj 
● Raw transactions 
● Blockchain details 
● Security 
● Bitcoin flaws

More Related Content

What's hot

Introduction to bitcoin
Introduction to bitcoinIntroduction to bitcoin
Introduction to bitcoinWolf McNally
 
Blockchain seminar
Blockchain seminarBlockchain seminar
Blockchain seminarAmiyabablu
 
Blockchain Primer Part 1
Blockchain Primer Part 1Blockchain Primer Part 1
Blockchain Primer Part 1Sanjay Basu
 
Overview of bitcoin
Overview of bitcoinOverview of bitcoin
Overview of bitcoinAbdul Nasir
 
The Bitcoin blockchain (en)
The Bitcoin blockchain (en)The Bitcoin blockchain (en)
The Bitcoin blockchain (en)Davide Carboni
 
Wallets and Transactions #2
Wallets and Transactions #2Wallets and Transactions #2
Wallets and Transactions #2BCWorkspace
 
YOCoin PowerPoint Presentation
YOCoin PowerPoint PresentationYOCoin PowerPoint Presentation
YOCoin PowerPoint PresentationCrypto Currency
 
Blockchain Technology - The Next Superpower By Priyank Vaghela
Blockchain Technology - The Next Superpower By Priyank VaghelaBlockchain Technology - The Next Superpower By Priyank Vaghela
Blockchain Technology - The Next Superpower By Priyank VaghelaPriyankVaghela
 
MultiChain – Private multicurrency blockchain platform
MultiChain – Private multicurrency blockchain platformMultiChain – Private multicurrency blockchain platform
MultiChain – Private multicurrency blockchain platformCoin Sciences Ltd
 
Bitcoin Transactions Examples
Bitcoin Transactions ExamplesBitcoin Transactions Examples
Bitcoin Transactions ExamplesJeff Flowers
 
Information security in private blockchains
Information security in private blockchainsInformation security in private blockchains
Information security in private blockchainsCoin Sciences Ltd
 
Bitcoin Technology Fundamentals - Tutorial 3 – Bitcoin Mining
Bitcoin Technology Fundamentals - Tutorial 3 – Bitcoin MiningBitcoin Technology Fundamentals - Tutorial 3 – Bitcoin Mining
Bitcoin Technology Fundamentals - Tutorial 3 – Bitcoin MiningAmitesh Raikwar
 
Bitcoin powerpoint
Bitcoin powerpointBitcoin powerpoint
Bitcoin powerpointdcarro11
 
Bitcoin - the basics
Bitcoin - the basicsBitcoin - the basics
Bitcoin - the basicsUri Nativ
 
Quick Understanding of Bitcoin/Cryptocurrency.
Quick Understanding of Bitcoin/Cryptocurrency.Quick Understanding of Bitcoin/Cryptocurrency.
Quick Understanding of Bitcoin/Cryptocurrency.Satish Mudaliar
 

What's hot (20)

Introduction to bitcoin
Introduction to bitcoinIntroduction to bitcoin
Introduction to bitcoin
 
Blockchain seminar
Blockchain seminarBlockchain seminar
Blockchain seminar
 
Blockchain Primer Part 1
Blockchain Primer Part 1Blockchain Primer Part 1
Blockchain Primer Part 1
 
Overview of bitcoin
Overview of bitcoinOverview of bitcoin
Overview of bitcoin
 
The Bitcoin blockchain (en)
The Bitcoin blockchain (en)The Bitcoin blockchain (en)
The Bitcoin blockchain (en)
 
Dash(digital cash)
Dash(digital cash)Dash(digital cash)
Dash(digital cash)
 
Wallets and Transactions #2
Wallets and Transactions #2Wallets and Transactions #2
Wallets and Transactions #2
 
YOCoin PowerPoint Presentation
YOCoin PowerPoint PresentationYOCoin PowerPoint Presentation
YOCoin PowerPoint Presentation
 
Blockchain Technology - The Next Superpower By Priyank Vaghela
Blockchain Technology - The Next Superpower By Priyank VaghelaBlockchain Technology - The Next Superpower By Priyank Vaghela
Blockchain Technology - The Next Superpower By Priyank Vaghela
 
Hands on with multichain
Hands on with multichainHands on with multichain
Hands on with multichain
 
Lightning Network
Lightning  NetworkLightning  Network
Lightning Network
 
MultiChain – Private multicurrency blockchain platform
MultiChain – Private multicurrency blockchain platformMultiChain – Private multicurrency blockchain platform
MultiChain – Private multicurrency blockchain platform
 
Intro to blockchain
Intro to blockchainIntro to blockchain
Intro to blockchain
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Bitcoin Transactions Examples
Bitcoin Transactions ExamplesBitcoin Transactions Examples
Bitcoin Transactions Examples
 
Information security in private blockchains
Information security in private blockchainsInformation security in private blockchains
Information security in private blockchains
 
Bitcoin Technology Fundamentals - Tutorial 3 – Bitcoin Mining
Bitcoin Technology Fundamentals - Tutorial 3 – Bitcoin MiningBitcoin Technology Fundamentals - Tutorial 3 – Bitcoin Mining
Bitcoin Technology Fundamentals - Tutorial 3 – Bitcoin Mining
 
Bitcoin powerpoint
Bitcoin powerpointBitcoin powerpoint
Bitcoin powerpoint
 
Bitcoin - the basics
Bitcoin - the basicsBitcoin - the basics
Bitcoin - the basics
 
Quick Understanding of Bitcoin/Cryptocurrency.
Quick Understanding of Bitcoin/Cryptocurrency.Quick Understanding of Bitcoin/Cryptocurrency.
Quick Understanding of Bitcoin/Cryptocurrency.
 

Similar to Bitcoin Introduction for Programmers - Core Concepts Explained

Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2Wojciech Langiewicz
 
Bitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the HoodBitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the HoodGalin Dinkov
 
Fredericksburg LUG Bitcoin slides
Fredericksburg LUG Bitcoin slidesFredericksburg LUG Bitcoin slides
Fredericksburg LUG Bitcoin slidesAlex Akselrod
 
Blockchan For Developers
Blockchan For DevelopersBlockchan For Developers
Blockchan For DevelopersAlex Chepurnoy
 
Blockchain For Developers
Blockchain For DevelopersBlockchain For Developers
Blockchain For DevelopersAlex Chepurnoy
 
Blockchain with scala
Blockchain with scalaBlockchain with scala
Blockchain with scalaHongchao Liu
 
Blockchain, bitcoin, ethereum and ICOs
Blockchain, bitcoin, ethereum and ICOsBlockchain, bitcoin, ethereum and ICOs
Blockchain, bitcoin, ethereum and ICOsBogdan Fiedur
 
Blockchain (and Bitcoin)
Blockchain (and Bitcoin) Blockchain (and Bitcoin)
Blockchain (and Bitcoin) Nitin Jain
 
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)Alex Chepurnoy
 
The Emergent Layer 2
The Emergent Layer 2The Emergent Layer 2
The Emergent Layer 2Chris Priest
 
Bitcoin, Banking and the Blockchain
Bitcoin, Banking and the BlockchainBitcoin, Banking and the Blockchain
Bitcoin, Banking and the Blockchainseancarmody
 
Crypto & Crpyocurrencies Intro
Crypto & Crpyocurrencies IntroCrypto & Crpyocurrencies Intro
Crypto & Crpyocurrencies IntroTal Shmueli
 
Intro to Blockchain Slides
Intro to Blockchain SlidesIntro to Blockchain Slides
Intro to Blockchain SlidesShannon Wells
 
“A bitcoin mining rig”
“A bitcoin mining rig”“A bitcoin mining rig”
“A bitcoin mining rig”glitterlabs
 
Bitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrencyBitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrencyBen Hall
 
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018Codemotion
 

Similar to Bitcoin Introduction for Programmers - Core Concepts Explained (20)

Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2
 
Bitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the HoodBitcoin Blockchain - Under the Hood
Bitcoin Blockchain - Under the Hood
 
Fredericksburg LUG Bitcoin slides
Fredericksburg LUG Bitcoin slidesFredericksburg LUG Bitcoin slides
Fredericksburg LUG Bitcoin slides
 
Blockchan For Developers
Blockchan For DevelopersBlockchan For Developers
Blockchan For Developers
 
Bitcoin Talk at Rainbow
Bitcoin Talk at RainbowBitcoin Talk at Rainbow
Bitcoin Talk at Rainbow
 
Blockchain For Developers
Blockchain For DevelopersBlockchain For Developers
Blockchain For Developers
 
Blockchain with scala
Blockchain with scalaBlockchain with scala
Blockchain with scala
 
Blockchain, bitcoin, ethereum and ICOs
Blockchain, bitcoin, ethereum and ICOsBlockchain, bitcoin, ethereum and ICOs
Blockchain, bitcoin, ethereum and ICOs
 
Blockchain (and Bitcoin)
Blockchain (and Bitcoin) Blockchain (and Bitcoin)
Blockchain (and Bitcoin)
 
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)
Blockchain For Developers (Talk at Innopolis Blockchain Hackathon 2016)
 
The Emergent Layer 2
The Emergent Layer 2The Emergent Layer 2
The Emergent Layer 2
 
Bitcoin, Banking and the Blockchain
Bitcoin, Banking and the BlockchainBitcoin, Banking and the Blockchain
Bitcoin, Banking and the Blockchain
 
Crypto & Crpyocurrencies Intro
Crypto & Crpyocurrencies IntroCrypto & Crpyocurrencies Intro
Crypto & Crpyocurrencies Intro
 
Intro to Blockchain Slides
Intro to Blockchain SlidesIntro to Blockchain Slides
Intro to Blockchain Slides
 
“A bitcoin mining rig”
“A bitcoin mining rig”“A bitcoin mining rig”
“A bitcoin mining rig”
 
Bitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrencyBitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrency
 
Ethereum overview
Ethereum overviewEthereum overview
Ethereum overview
 
Blockchain Properties
Blockchain PropertiesBlockchain Properties
Blockchain Properties
 
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
 
Bitcoin
BitcoinBitcoin
Bitcoin
 

More from Wojciech Langiewicz

More from Wojciech Langiewicz (7)

JSON API Specificiation
JSON API SpecificiationJSON API Specificiation
JSON API Specificiation
 
Ionic 2 intro
Ionic 2   introIonic 2   intro
Ionic 2 intro
 
Mutation testing in Java
Mutation testing in JavaMutation testing in Java
Mutation testing in Java
 
2014 hadoop wrocław jug
2014 hadoop   wrocław jug2014 hadoop   wrocław jug
2014 hadoop wrocław jug
 
Badanie skalowalności HBase
Badanie skalowalności HBaseBadanie skalowalności HBase
Badanie skalowalności HBase
 
Introduction to Octopress at DRUG
Introduction to Octopress at DRUGIntroduction to Octopress at DRUG
Introduction to Octopress at DRUG
 
Hadoop w NK.pl
Hadoop w NK.plHadoop w NK.pl
Hadoop w NK.pl
 

Recently uploaded

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Recently uploaded (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Bitcoin Introduction for Programmers - Core Concepts Explained

  • 1. 1 Bitcoin – Introduction for programmers Wojciech Langiewicz @ DRUG #58
  • 2. 2 Scope of this talk ● Introduction – What is Bitcoin, History ● Core concepts – Keys, Addresses – Wallet – Clients – Transaction – Block – Mining – Blockchain
  • 3. 3 What is Bitcoin ● Collection of concepts (and full “ecosystem” of tools) ● Decentralized peer-to-peer system ● Solves 2 main problems: – Is that money authentic (not counterfeit) – Is there only singe occurrence of this specific coin (double spends) ● Has much similarities to cash and gold
  • 4. 4 Key elements of the ecosystem ● Decentralized peer-to-peer network (Bitcoin protocol) ● Public transaction ledger (Blockchain) ● Decentralized currency issuing algorithms (mining) ● Decentralized transaction verification (transaction scripts)
  • 5. 5 Few words about history ● Introduced in 2009 by Satoshi Nakamoto ● https://bitcoin.org/bitcoin.pdf ● Combined concepts that existed before ● But have not been combined until then ● POW algorithm + Blockchain
  • 6. 6 Bitcoin Address ● Something like this: 1FzQW9CWpNBoqUmaLFKNMAYiBhj6ncJA7N ● Usually shown as QR code: ● Address is a Base58 encoded form of the public key ● Based on the address prefix, you can figure out what type of address it is. ● Types of addresses: Pubkey hash, script hash, private key ● Address reuse ● A word about HD Wallets
  • 7. 7 Bitcoin Keys - ECDSA ● Private keys – numbers between 0 and 2^256 ● Public key can be calculated from the private key ● Public key can be represented as Base58 encoding, HEX number, etc ● Private keys can also be encoded as Base58 – this is called WIF format – most common way to export/import keys between wallets
  • 8. 8 Wallet ● Client software running on: server, desktop, phone, “in the cloud”, it manages keys, signs transactions, generates new keys, etc ● Bitcoin-qt ● Electrum, Armory, Multibit ● Blockchain.info ● Mobile wallets with intermediate server ● Other web wallets
  • 9. 9 Full nodes ● Full nodes store full copy of the blockchain ● Currently over 40GB of data ● Usually need for server-side type of applications ● Provide JSON-RPC API ● Example: Satoshi client, btcd
  • 10. 10 SPV nodes ● Lighweight nodes ● Use Simplified Payment Verification instead of ITV ● Suitable for desktops, phones ● Instead of downloading full blockchain ● Download transactions only for their addresses ● Security and privacy implications ● Example: bitcoinj
  • 11. 11 Transaction ● Coinbase transaction ● Each transaction has 1 or more inputs and 1 or more outputs ● Transaction “moves money” - changes owner ● Transactions take inputs and translate it into outputs ● Those outputs can serve as inputs to the new transaction
  • 12. 12 Spending a transaction - P2PH ● Example of transaction type “Pay to pubkey hash” ● ScriptPubKey: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG ● scriptSig: <sig> <pubKey> ● Script: <sig> <pubKey> OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
  • 13. 13 Executing a script
  • 14. 14 Advanced transaction types ● Multi signature (multisig) ● OP_RETURN ● Anyone can spend ● Pay to script hash
  • 15. 15 Blocks ● Genesis block ● Mining – process of confirming a block ● Each block points to a previous one creating a blockchain ● Quite few similarities to git (instead you can't merge)
  • 16. 16 Mining ● Merges transactions into blocks ● Finds nonce that “solves” the block ● Once the solution is found – block is published ● Published – appended to the blockchain ● Published blocks are verified by other nodes ● This sends coinbase transaction to the miner + all fees ● Proof of Work – 10 minutes per block ● Difficulty
  • 17. 17 Mining pools ● Chance to find a solution to a block are small ● Small miners join in pools where they share a profit ● Instead of finding a block every year and getting 25BTC ● You will get 0.5 BTC per week. ● You have to trust the pool operator or use p2pool
  • 18. 18 Blockchain ● “A chain of blocks” ● Clever approach to consensus problem ● Miners after finding a new block publish it on the network ● You base your security on a height of a transaction ● Ensures that there are no duplication
  • 19. 19 Blockchain fork ● Situation when 2 blocks are found at the same time ● Bitcoin network is in the state of a fork ● 10 minutes later a new block is found that is based on one of the forks ● All Bitcoin nodes quickly switch to the longer branch ● Transactions from the shorter branch are orphaned and will be processed shortly after
  • 20. 20 Few words about the 51% attack ● Theoretically possible even with 40-50% of power ● Can be used to destabilize network for some period of time ● Can help to create a double-spend ● In no case you'll be able to spend coins you don't have ● This attack is not practical ● Miners will make more BTC by being honest
  • 21. 21 Next time ● More about Bitcoin clients ● Bitcoin-core / btcd API ● Bitcoinj ● Raw transactions ● Blockchain details ● Security ● Bitcoin flaws