3. 3
What is Mining?
Mining serves as two purposes:
▪ To verify the legitimacy of a transaction, or avoiding the so-
called double-spending;
▪ To create new digital currencies by rewarding miners for
performing the previous task.
4. 4
Mining behind the scenes
When you want to set a transaction this is what happens behind the scenes:
▪ Transactions are bundled together into what we call a block;
▪ Miners verify that transactions within each block are legitimate;
▪ To do so, miners should solve a mathematical puzzle known as proof-of-work problem;
▪ A reward is given to the first miner who solves each blocks problem;
▪ Verified transactions are stored in the public blockchain
▪ This “mathematical puzzle” has a key feature: asymmetry. The work, in fact, must be moderately hard on the requester side but easy to
check for the network. This idea is also known as a CPU cost function, client puzzle, computational puzzle or CPU pricing function.
▪ All the network miners compete to be the first to find a solution for the mathematical problem that concerns the candidate block, a
problem that cannot be solved in other ways than through brute force so that essentially requires a huge number of attempts.
▪ When a miner finally finds the right solution, he/she announces it to the whole network at the same time, receiving a cryptocurrency
prize (the reward) provided by the protocol.
▪ From a technical point of view, mining process is an operation of inverse hashing: it determines a number (nonce), so the
cryptographic hash algorithm of block data results in less than a given threshold.
▪ This threshold, called difficulty, is what determines the competitive nature of mining: more computing power is added to the network,
the higher this parameter increases, increasing also the average number of calculations needed to create a new block. This method
also increases the cost of the block creation, pushing miners to improve the efficiency of their mining systems to maintain a positive
economic balance. This parameter update should occur approximately every 14 days, and a new block is generated every 10 minutes.
5. 5
Overview Ethereum and Hyper Ledger
No Description Ethereum Ethereum Enterprise Hyper Ledger
1 Regulatory Organization Ethereum Foundation Enterprise Ethereum Alliance
(EEA), 28 Feb 2017
Linux Foundation
2 Influence Figure Vitalik Buterin Brian Behlendorf
(Executive Director)
3 Generally Available 30 July 2015 N/A 12 July 2017,
Hyperledger Fabric 1.0
4 Use Case Smart Contract for
Crypto Currency
General Purpose Blockchain
with Smart Contract
General Purpose Blockchain
with Smart Contract
6. 7
Ethereum Enterprise Vision
1. Develop a sufficiently modular Ethereum implementation to separate and define clear interfaces between
networking and storage layers - that is a prototype for pluggable consensus that minimizes the code changes
required to switch consensus algorithms.
2. Experiment with potential consensus algorithms, along with data privacy and permissioning frameworks.
3. Develop a clear set of capabilities and performance characteristics that suit the needs of enterprises, including:
1. 100 transactions per second, across a 10 party network
2. High volume and value use cases
3. High availability/reliability
4. Parallelization and horizontal scaling
4. Develop a Version 1 specification for Enterprise Ethereum, based on the learnings from the above plus the
roadmap and requirements gathered from members, i.e., produce a reference implementation.
5. Leverage a robust governance process to ensure alignment and agreement on approaches
https://www.infoq.com/news/2017/03/Enterprise-Ethereum-Vision
A common, modularized implementation will provide a code base for developing the Enterprise Ethereum specification and
also experimenting with consortia consensus algorithms. Pluggable consensus needs a modularized client with a clean
interface for networking and between the Ethereum Virtual Machine and the consensus algorithm - it is really these
interfaces that make the consensus layer pluggable.
Pluggable Concensus
11. 12
TODO
▪ Basic Concept:
– https://bitsonblocks.net/2016/10/02/a-gentle-introduction-to-ethereum/
– https://bitsonblocks.net/2016/05/09/confused-by-blockchains-revolution-vs-evolution/
– https://bitsonblocks.net/2015/09/28/a-gentle-introduction-to-digital-tokens/
– https://bitsonblocks.net/2016/02/29/a-gentle-introduction-to-immutability-of-blockchains/
– https://bitsonblocks.net/2016/02/01/a-gentle-introduction-to-smart-contracts/
– https://bitsonblocks.net/2016/03/14/bitcoins-network-in-one-infographic/
– https://bitsonblocks.net/2016/12/09/a-gentle-introduction-to-the-hyperledger-project/
▪ Solo vs Pool Mining
▪ Proof of Work vs Proof of Stake (Casper)
▪ Miner Software: Ethminer vs Claymore
▪ Ethereum Pool Statistics: https://etherchain.org/statistics/miners
▪ Transaction vs Smart Contract
13. 14
Proof of Work
▪ https://blockgeeks.com/guides/proof-of-work-vs-proof-of-stake/
▪ Proof of work is a protocol that has the main goal of deterring cyber-attacks such as a distributed denial-of-service attack (DDoS)
which has the purpose of exhausting the resources of a computer system by sending multiple fake requests.
▪ The Proof of work concept existed even before bitcoin, but Satoshi Nakamoto applied this technique to his/her – we still don’t
know who Nakamoto really is – digital currency revolutionizing the way traditional transactions are set.
▪ In fact, PoW idea was originally published by Cynthia Dwork and Moni Naor back in 1993, but the term “proof of work” was
coined by Markus Jakobsson and Ari Juels in a document published in 1999.
▪ What’s trustless and distributed consensus?
▪ A trustless and distributed consensus system means that if you want to send and/or receive money from someone you don’t
need to trust in third-party services.
▪ When you use traditional methods of payment, you need to trust in a third party to set your transaction (e.g. Visa, Mastercard,
PayPal, banks). They keep their own private register which stores transactions history and balances of each account.
▪ The common example to better explain this behavior is the following: if Alice sent Bob $100, the trusted third-party service would
debit Alice’s account and credit Bob’s one, so they both have to trust this third-party is to going do the right thing.
▪ With bitcoin and a few other digital currencies, everyone has a copy of the ledger (blockchain), so no one has to trust in third
parties, because anyone can directly verify the information written.
14. 15
Proof of Stake
▪ https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ
▪ Proof of stake is a category of consensus algorithms for public blockchains, which Ethereum's upcoming Casper algorithm is a
part of. It serves a similar function to the proof of work which underpins the security behind Bitcoin, the current version of
Ethereum and many other blockchains, but has significant advantages in terms of security and energy efficiency.
▪ In general, a proof of stake algorithm looks as follows. The blockchain keeps track of a set of validators, and anyone who holds
the blockchain's base cryptocurrency (in Ethereum's case, ether) can become a validator by sending a special type of transaction
that locks up their ether into a deposit. The process of creating and agreeing to new blocks is then done through a
consensus algorithm that all current validators can participate in.
▪ There are many kinds of consensus algorithms, and many ways to assign rewards to validators who participate in the consensus
algorithm, so there are many "flavors" of proof of stake. From an algorithmic perspective, there are two major types: chain-based
proof of stake and BFT-style proof of stake.
▪ In chain-based proof of stake, the algorithm pseudo-randomly selects a validator during each time slot (eg. every period of 10
seconds might be a time slot), and assigns that validator the right to create a single block, and this block must point to some
previous block (normally the block at the end of the previously longest chain), and so over time most blocks converge into a
single constantly growing chain.
▪ In BFT-style proof of stake, validators are randomly assigned the right to propose blocks, but agreeing on which block is
canonical is done through a multi-round process where every validator sends a "vote" for some specific block during each round,
and at the end of the process all (honest and online) validators permanently agree on whether or not any given block is part of
the chain. Note that blocks may still be chained together; the key difference is that consensus on a block can come within one
block, and does not depend on the length or size of the chain after it.
15. 16
Account Types, Gas and Transactions
▪ http://ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.html
▪ "Gas" is the name for a special unit used in Ethereum. It measures how much "work" an action or set of actions takes to perform: for example, to calculate one Keccak256 cryptographic hash it will
take 30 gas each time a hash is calculated, plus a cost of 6 more gas for every 256 bits of data being hashed. Every operation that can be performed by a transaction or contract on the Ethereum
platform costs a certain number of gas, with operations that require more computational resources costing more gas than operations that require few computational resources.
▪ The reason gas is important is that it helps to ensure an appropriate fee is being paid by transactions submitted to the network. By requiring that a transaction pay for each operation it performs (or
causes a contract to perform), we ensure that network doesn't become bogged down with performing a lot of intensive work that isn't valuable to anyone. This is a different strategy than the Bitcoin
transaction fee, which is based only on the size in kilobytes of a transaction. Since Ethereum allows arbitrarily complex computer code to be run, a short length of code can actually result in a lot of
computational work being done. So it's important to measure the work done directly instead of just choosing a fee based on the length of a transaction or contract.
▪ So if gas is basically a transaction fee, how do you pay it? This is where it gets a little tricky. Although gas is a unit that things can be measured in, there isn't any actual token for gas. That is, you
can't own 1000 gas. Instead, gas exists only inside of the Ethereum virtual machine as a count of how much work is being performed. When it comes to actually paying for the gas, the transaction
fee is charged as a certain number of ether, the built-in token on the Ethereum network and the token with which miners are rewarded for producing blocks.
▪ This might seem odd at first. Why don't operations just have a cost measured in ether directly? The answer is that ether, like bitcoins, have a market price that can change rapidly! But the cost of
computation doesn't go up or down just because the price of ether changes. So it's helpful to separate out the price of computation from the price of the ether token, so that the cost of an
operation doesn't have to be changed every time the market moves.
▪ The terminology here gets a little messy. Operations in the EVM have gas cost, but gas itself also has a gas price measured in terms of ether. Every transaction specifies the gas price it is willing to pay
in ether for each unit of gas, allowing the market to decide the relationship between the price of ether and the cost of computing operations (as measured in gas). It's the combination of the two, total
gas used multiplied by gas price paid, that results in the total fee paid by a transaction.
▪ As tricky as it is, it's important to understand this distinction, because it results in one of the most confusing things about Ethereum transactions to the initial learner: there is a difference between your
transaction running out of gas and your transaction not having a high enough fee. If the gas price I set in my transaction is too low, no one will even bother to run my transaction in the first place.
It will simply not be included in the blockchain by miners. But if I provide an acceptable gas price, and then my transaction results in so much computational work that the combined gas costs go past the
amount I attached as a fee, that gas counts as "spent" and I don't get it back. The miner will stop processing the transaction, revert any changes it made, but still include it in the blockchain as a
"failed transaction", collecting the fees for it. This may seem harsh, but when you realise that the real work for the miner was in performing the computation, you can see that they will never get those
resources back either. So it's only fair that you pay them for the work they did, even though your badly designed transaction ran out of gas.
▪ Providing too big of a fee is also different than providing too much ether. If you set a very high gas price, you will end up paying lots of ether for only a few operations, just like setting a super high
transaction fee in bitcoin. You'll definitely be prioritised to the front of the line, but your money is gone. If you provided a normal gas price, however, and just attached more ether than was needed to
pay for the gas that your transaction consumed, the excess amount will be refunded back to you. Miners only charge you for the work that they actually do. You can think of the gas price as
the hourly wage for the miner, and the gas cost as their timesheet of work performed.
▪ There are a lot of other subtleties to gas, but that should give you the basics! Gas is the key mechanism that makes the complex computations in Ethereum "safe" for the network to work on,
because any programs that run out of control will only last as long as the money provided by the people who requested they be run. When the money stops, the miners stop working on it. And the
mistakes you make in your program will only affect the people who pay to use it--the rest of the network can't suffer performance issues due to your error. They will simply get a big payday when
the performance issues consume all of your ether! Without this critical technique, the idea of a general-purpose blockchain would have been completely impossible.
16. 17
Gas
▪ https://ethereum.stackexchange.com/questions/3/what-is-meant-by-the-term-gas
▪ Gas is the way that fees are calculated
▪ The fees are still paid in ether, though, which is different from gas
▪ The gas cost is the amount of work that goes into something, like the number of hours of labour, whereas the gas price is like the
hourly wage you pay for the work to be done. The combination of the two determines your total transaction fee.
▪ If your gas price is too low, no one will process your transaction
▪ If your gas price is fine but the gas cost of your transaction runs "over budget" the transaction fails but still goes into the blockchain,
and you don't get the money back for the work that the labourers did.
▪ This makes sure that nothing runs forever, and that people will be careful about the code that they run. It keeps both miners
and users safe from bad code!
17. 18
Gas
▪ https://ethereum.stackexchange.com/questions/3/what-is-meant-by-the-term-gas
▪ "Gas" is the name for a special unit used in Ethereum. It measures how much "work" an action or set of actions takes to perform: for example, to calculate one Keccak256 cryptographic hash it will
take 30 gas each time a hash is calculated, plus a cost of 6 more gas for every 256 bits of data being hashed. Every operation that can be performed by a transaction or contract on the Ethereum
platform costs a certain number of gas, with operations that require more computational resources costing more gas than operations that require few computational resources.
▪ The reason gas is important is that it helps to ensure an appropriate fee is being paid by transactions submitted to the network. By requiring that a transaction pay for each operation it performs (or
causes a contract to perform), we ensure that network doesn't become bogged down with performing a lot of intensive work that isn't valuable to anyone. This is a different strategy than the Bitcoin
transaction fee, which is based only on the size in kilobytes of a transaction. Since Ethereum allows arbitrarily complex computer code to be run, a short length of code can actually result in a lot of
computational work being done. So it's important to measure the work done directly instead of just choosing a fee based on the length of a transaction or contract.
▪ So if gas is basically a transaction fee, how do you pay it? This is where it gets a little tricky. Although gas is a unit that things can be measured in, there isn't any actual token for gas. That is, you
can't own 1000 gas. Instead, gas exists only inside of the Ethereum virtual machine as a count of how much work is being performed. When it comes to actually paying for the gas, the transaction
fee is charged as a certain number of ether, the built-in token on the Ethereum network and the token with which miners are rewarded for producing blocks.
▪ This might seem odd at first. Why don't operations just have a cost measured in ether directly? The answer is that ether, like bitcoins, have a market price that can change rapidly! But the cost of
computation doesn't go up or down just because the price of ether changes. So it's helpful to separate out the price of computation from the price of the ether token, so that the cost of an
operation doesn't have to be changed every time the market moves.
▪ The terminology here gets a little messy. Operations in the EVM have gas cost, but gas itself also has a gas price measured in terms of ether. Every transaction specifies the gas price it is willing to pay
in ether for each unit of gas, allowing the market to decide the relationship between the price of ether and the cost of computing operations (as measured in gas). It's the combination of the two, total
gas used multiplied by gas price paid, that results in the total fee paid by a transaction.
▪ As tricky as it is, it's important to understand this distinction, because it results in one of the most confusing things about Ethereum transactions to the initial learner: there is a difference between your
transaction running out of gas and your transaction not having a high enough fee. If the gas price I set in my transaction is too low, no one will even bother to run my transaction in the first place.
It will simply not be included in the blockchain by miners. But if I provide an acceptable gas price, and then my transaction results in so much computational work that the combined gas costs go past the
amount I attached as a fee, that gas counts as "spent" and I don't get it back. The miner will stop processing the transaction, revert any changes it made, but still include it in the blockchain as a
"failed transaction", collecting the fees for it. This may seem harsh, but when you realise that the real work for the miner was in performing the computation, you can see that they will never get those
resources back either. So it's only fair that you pay them for the work they did, even though your badly designed transaction ran out of gas.
▪ Providing too big of a fee is also different than providing too much ether. If you set a very high gas price, you will end up paying lots of ether for only a few operations, just like setting a super high
transaction fee in bitcoin. You'll definitely be prioritised to the front of the line, but your money is gone. If you provided a normal gas price, however, and just attached more ether than was needed to
pay for the gas that your transaction consumed, the excess amount will be refunded back to you. Miners only charge you for the work that they actually do. You can think of the gas price as
the hourly wage for the miner, and the gas cost as their timesheet of work performed.
▪ There are a lot of other subtleties to gas, but that should give you the basics! Gas is the key mechanism that makes the complex computations in Ethereum "safe" for the network to work on,
because any programs that run out of control will only last as long as the money provided by the people who requested they be run. When the money stops, the miners stop working on it. And the
mistakes you make in your program will only affect the people who pay to use it--the rest of the network can't suffer performance issues due to your error. They will simply get a big payday when
the performance issues consume all of your ether! Without this critical technique, the idea of a general-purpose blockchain would have been completely impossible.
29. 30
Auto Start PC & Miner after Restart
▪ Enable BIOS Auto Start
▪ Enable Windows 10 auto login
http://www.intowindows.com/how-to-automatically-login-in-windows-10/
▪ Add Claymore Miner to startup folder
http://tunecomp.net/add-app-to-startup/
30. 31
Disabled Windows Services
1. AllJoyn Router Service
2. Application Layer Gateway Service
3. Bluetooth Support Service
4. BranchCache
5. Certificate Propagation
6. DNSClient
7. Downloaded Maps Manager
8. Geolocation Service
9. HomeGroup Listener
10. HomeGroup Provider
11. Hyper-V Data Exchange Service
12. Hyper-V Guest Service Interface
13. Hyper-V Guest Shutdown Service
14. Hyper-V Heartbeat Service
15. Hyper-V Remote Desktop Virtualization Service
16. Hyper-V Time Synchronization Service
17. Hyper-V VM Session Service
18. Hyper-V Volume Shadow Copy Requestor
19. Internet Connection Sharing (ICS)
20. Internet Explorer ETW Collector Service
21. IP Helper
22. Microsoft (R) Diagnostics Hub Standard Collector Service
23. Microsoft iSCSI Initiator Service
24. Microsoft Windows SMS Router Service
25. Netlogon
26. Offline Files
27. Print Spooler
28. Printer Extensions and Notifications
29. Remote Access Auto Connection Manager
30. Remote Access Connection Manager
31. Remote Desktop Configuration
32. Remote Desktop Services
33. Remote Desktop Services UserMode Port Director
34. Remote Procedure Call (RPC) Locator
35. Retail Demo Service
36. Sensor Data Service
37. Sensor Monitoring Service
38. Sensor Service
39. Smart Card Device Enumeration Service
40. Smart Card Removal Policy
41. SNMP Trap
42. Storage Service
43. Superfetch
44. Touch Keyboard and Handwriting Panel Service
45. Windows Biometric Service
46. Windows Connect Now - Config Registrar
47. Windows Media Player Network Sharing Service
48. Windows Mobile Hotspot Service
49. Windows Remote Management (WS-Management)
50. Windows Search
51. Xbox Live Auth Manager
52. Xbox Live Game Save
53. XboxNetApiSvc
33. 34
Solidity: Contract Oriented Programming Language
https://ethereum.github.io/browser-solidity/
https://ethereumbuilders.gitbooks.io/guide/content/en/solidity_tutorials.html
https://solidity.readthedocs.io/en/develop/
contract Coin {
address minter;
mapping (address => uint
function Coin() {
minter = msg.sender;
}
function mint(address ow
if (msg.sender != mi
balances[owner] += a
}
function send(address re
if (balances[msg.sen
balances[msg.sender]
balances[receiver] +
}
function queryBalance(ad
return balances[addr
}
}
34. 35
Glossary
No Terminology Description
1 Ðapp Ethereum Decentralized Apps, Ethereum based Applications
2 Wallet
3 geth, eth, pyethapp Ethereum Clients, written in different languages
4 Satoshi Nakamoto
5 DAG
https://github.com/ethereum/wiki/wiki/Ethash-DAG
Ethash is the PoW system. It requires a ~1GB dataset known as the DAG (see Dagger
Hashimoto). This typically takes hours to generate so we tend to memorise it. Clients
wishing to store the DAG in a cache should conform to this spec in order to share the
cache with other clients:
https://ethereum.stackexchange.com/questions/1993/what-actually-is-a-dag
ETH Ethereum built I native cryptocurrency, used for paying for smart contracts to run
Ethereum Virtual Machine,
Swarm and Whisper
Decentralised computation, file storage and communication protocols
Solidity, Serpent, LLL Smart contract programming languages
Frontier, Homestead,
Metropolis, Serenity
Friendly names for different software releases
Ethereum Vision
software running on a network of computers that ensures that data and small computer
programs called smart contracts are replicated and processed on all the computers on the