Upload
johann-romefort
View
119
Download
5
Embed Size (px)
Citation preview
A Gentle Introduction To Blockchain With Ethereum
Johann Romefort, Tech Evangelist at Stylight
Twitter: @romefortBlog: http://romefort.netLinkedIn: http://linkedin.com/in/romefortEmail: [email protected]
Agenda
● The Trust Industry● Disruptive Nature of Blockchain● Ethereum● Demo!
What Is the Buzz about Blockchain
The History of Trust and Exchange of Value
3500 Years Ago: The Signet Ring
Signet rings have been used since as far back as 3500 BC when the people of Mesopotamia began using them as a method of authenticity. Each was unique to one person.
Today: 3rd-Party Trust Guarantors
● Banks
● Insurance
● Land registries
● Governments
● Credit companies
● Legal Agencies
Trust Comes at a Price
● Operational Costs● Risk● Time ● Centralization
3rd-Party Trust Is Fragile and Disrupted
● 2008 financial meltdown● Government surveillance● Elections● Social media giants● Data breaches
The Edelman Trust Barometer
Source: https://www.scribd.com/document/336621519/2017-Edelman-Trust-Barometer-Executive-Summary
The Double-Spending Problem
● You need to make sure the ownership of the item of value is moving from A to B
● In a digital world this is a problem as assets can be copied.
● This is why we needed 3rd party which we can trust and can ensure the validity of the transaction
Until January 3rd, 2009
First blockchain implementation deployed under the name:
“Bitcoin: A Peer-to-Peer Electronic Cash System”
By Satoshi Nakamoto
The Distributed and Transparent Nature of
Blockchain
What is Blockchain?● It’s an immutable distributed public ledger● All transactions are timestamped and recorded
into blocks● Distributed database with no single point of
failure● Can’t be controlled by authorities such as
government due to its decentralized nature● Solve the double-spending problem without
need for 3rd party of trust.
What is a Hash?● Mathematical function which turns data into a
fingerprint of that data called ● You can’t deduce the data from the hash.● The same data will have the same Hash.● Slightly different data will have a totally different hash
What about Ethereum?
● It’s the second largest Blockchain implementation
● It can be a seen as a blockchain of second generation
● It contains new features such as Smart Contracts
What’s a Block?
● Bundle transactions● Contains previous block hash● All blocks are linked through their hashes● You can’t change the data in one block
without breaking the chain● Unless you mine it all over again
What’s a transaction?
● An operation that writes data on the blockchain● Each transaction incurs a fee● Simple transaction sending ETH from one address to
another● More complicated transactions involve Smart Contracts
Smart Contracts● Introduced in Ethereum Blockchain
● Run code directly on the blockchain
● Each smart contract has its own wallet
● Smart Contracts can invoke each others
● Written in Solidity
Enabling New kinds of Organizations
● DAO: Decentralized
Autonomous
Organization
● New type of
organization governed
by multiple smart
contracts
● Token holders can be
granted the right to
vote for example
Developing with Ethereum
Many chains available
● Main Net: This is the production network - Don’t use it for development purposes!
● Rinkeby: https://www.rinkeby.io/#stats○ PoA (Proof of Authority)
○ Immune to Spam attacks
○ Supported by geth only
○ Request ether through faucet: https://faucet.rinkeby.io/
● Ropsten: Best reproduce the current prod. Env.○ Subject to Spam
○ Ether can be mined or requested
● Solo Network
Truffle - development framework for Ethereum
Setting up our development environment
npm install -g truffle
npm install -g ganache-cli
truffle init
ganache-cli -p 7545
Ganache run a local EVM (Ethereum Virtual Machine)
Also:
● Create accounts ● their private keys● Fund the accounts
with 100ETH
Our first Smart Contract: HelloWorld.sol
Write the migration
Save this in migrations/2_deploy
Adjust truffle.jsYou can also get rid of the truffle-config.js file // depending on your platform
Let’s compile and deploy our contract
truffle compiletruffle migrate --network development
Compile will compile our Solidity code to bytecode (the code that the Ethereum Virtual
Machine (EVM) understands), in our case, Ganache emulates the EVM.
Migrate will deploy the code to the blockchain, in our case, the blockchain could be found in
the network “development” we set earlier in the “truffle-config.js” file.
Migration in progress...
Using Truffle console
Interact with the Contract
1/get an instance
2/get the contract address
3/get the message var content
If you prefer a GUI
Questions?