SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues •...
Transcript of SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues •...
![Page 1: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/1.jpg)
SmartPool: Decentralized mining pools using smart contracts
1
Loi LuuCofounder, SmartPool.ioPhD candidate, National University of Singapore
![Page 2: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/2.jpg)
Agenda• What is pooled mining• Why centralized mining pool is not ideal• SmartPool
![Page 3: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/3.jpg)
What is mining• Probabilistically elect leader to propose blocks
– By solving proof of work
• A way to issue more coins– 12.5 BTC per 1 Bitcoin block– 5 ETH per 1 Ethereum block
![Page 4: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/4.jpg)
How to mine a block• To mine a block, we need to find a nonce so that
Hash(BlockHeader, nonce) ≤ dor
Hash(BlockHeader, nonce, dataset) ≤ d• Finding a valid nonce is hard
– Normal computers are nearly impossible to ever find a nonce
![Page 5: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/5.jpg)
Mining pool• Group of miners join hand to mine blocks together• Rewards are split among miners based on their
contribution– Reduce variance– Receive smaller rewards frequently
![Page 6: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/6.jpg)
How mining pools work• Pools track miners’ contribution by using shares
– A share is similar to a block, but required less work to find
– Each share has probability d/D being a valid block
Hash(BlockHeader, nonce) ≤ d
Hash(BlockHeader, nonce) ≤ D with D >> d
Valid block
Valid share
![Page 7: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/7.jpg)
How mining pools work• Pool operator records the shares, and distribute reward
accordinglyNetwork (Bitcoin, Ethereum)
Solo miner Solo miner Solo minerMining pool
pool members
block block block
share
share
![Page 8: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/8.jpg)
Pooled mining is great• For miners
– Allow them to have stable income– Low variance means easier to plan economically
• For the network– Help increase the security of the network by allowing more
miners to join the mining
![Page 9: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/9.jpg)
Pooled mining issues
• Mining in cryptocurrencies is highly centralized– 3-5 pools control majority of hash power
Ethereum’s mining power distributionBitcoin’s mining power distribution
![Page 10: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/10.jpg)
Pooled mining issues (2)• Implicit trust
– Miners trust pool to record shares and pay correctly
• Transaction censorship threat– Pools decide which transactions to include, not the miners
• Single point of failures
![Page 11: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/11.jpg)
SMARTPOOL: REPLACING POOL OPERATOR BY A SMART CONTRACT
![Page 12: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/12.jpg)
Naïve solution
Mining pool
Smart Contract
Miner’s mining
software
Pool’sGateway
Miner’s Local environmentgetWork()
submitWork()
Work responded
Ethereum Blockchain
submitShares()
User’s address
Reward is sent when a block is minedMiner uses the pool’s address as the
coinbase address in their blocks
![Page 13: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/13.jpg)
Naïve solution’s Problems• Number of shares is huge
– May reach millions per block– Require as many messages to the contract
• Cost (gas) to verify a Ethash PoW is expensive– May be more than the reward per share
• Verifying a PoW was not even technically feasible– Require access to 1GB data set– Smart contract storage is costly (around $76,000 USD per GB)
Hash(BlockHeader, nonce, dataset) ≤ d
![Page 14: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/14.jpg)
SmartPool – Solution• Allow batch
submissions (up to millions of shares)– significantly reduce
number of messages over the network
SmartPool smart contract
Miners
Submit batch of shares
![Page 15: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/15.jpg)
SmartPool – Solution (2)• Probabilistic
verification to check a submission– Randomly verify only
one share per submission
– Pr[of cheating detected] is proportional to the amount of cheating
SmartPool smart contract
Requested proofs
Submit batch of shares
Probabilistic Verification
Credit contributions
random proofs
Miners
![Page 16: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/16.jpg)
SmartPool: Disincentivize cheating• Payment scheme: pay 0 for a submission if cheating
detected– Expected reward is the same whether cheating or not– Miners have no incentive to cheat
• If we sample more than 1 share, can strongly disincentivize cheating miners
Get 1.5 Reward with 2/3 probability
Get 0 Reward with 1/3 probability
Probabilistic verification
passed
detected
Expected reward = 1
16
Reward = 1
![Page 17: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/17.jpg)
SmartPool: Efficiently Verify Ethash PoW• Verify Ethash PoW was thought to be impossible
– Although the 1GB dataset is generated from the 16 MB seed, its still expensive to store the entire 16MB
• Would cost hundreds of Ether• The 16MB data set changes every 30k blocks (4-5 days)
– Even if we can store the 16 MB seed, it is still not possible• Getting the element in the 1Gb dataset from the 16MB seed is
expensive• E.g. requires 8 SHA-512 computations per element, will run out of gas
Hash(BlockHeader, nonce, dataset) ≤ d
![Page 18: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/18.jpg)
Our solution: only verify the result of Ethash
• Observation– We do not need the entire 1GB data set or the 16Mb seed, we
only care about the correctness 64 elements sampled by the nonce and the block header
• Solution– Store the Merkle root of the 1GB dataset in the contract– Require the miners to send the merkle proof for each data
element
![Page 19: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/19.jpg)
SmartPool’s Ethash in Testnet• We self-implement the SHA-512 in solidity
– Cost is 200k of gas per computation
• Fully verify an Ethash PoW with 4.1M of gas• Our solution can be used to build a lighter light-client
![Page 20: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/20.jpg)
More in the white paper• How to prevent miners from stealing others’ shares?• How to prevent claiming a share multiple times
– Within a submission– Across submissions
• How to run mining pools for other cryptocurrencies on Ethereum
20
![Page 21: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/21.jpg)
SmartPool: Features and Plan• Features
– Totally decentralized– Secure– Efficient and scalable– Open source and non-profit
• Plan– Testnet deployment in March– Mainnet deployment in June– Supporting other cryptocurrencies depends on funding
![Page 22: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/22.jpg)
SmartPool.io is calling for donation
22
![Page 23: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/23.jpg)
Conclusion• Blockchain & smart contract help remove middle
man/centralized operators– Decentralized mining pools is one example.
• Smart contract are not the solution for everything– More thoughts on the design and implementations required
![Page 24: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/24.jpg)
Acknowledgement• Ethereum Foundation
• DinarDirham
• 24 pseudonymous donors
![Page 25: SmartPool: Decentralized mining pools using smart … Luu_Decentralized...Pooled mining issues • Mining in cryptocurrencies is highly centralized –3-5 pools control majority of](https://reader033.fdocuments.us/reader033/viewer/2022050210/5f5d09f24744bc372b368802/html5/thumbnails/25.jpg)
Thank you – Q&A
http://smartpool.io SmartPool_Prj