Intro to 0xBitcoin Mining Theory and Pools

K.
4 min readApr 29, 2018

This article originated as a Reddit post written by the Developer of 0xPool.io, it can be found in its original form HERE. The author can be reached on the 0xBitcoin Discord chat under the name “Vox | 0xpool.io.”. If you would like to know more about 0xBitcoin please read “The What, the Why, and the How of 0xBitcoin.”

Hey guys, a friend of mine was wondering what this 0xBitcoin thing was all about and how it worked and I accidentally wrote a book, I thought it would make a good intro to anyone here who wonders how the mining and pool systems work. It is strikingly similar to normal Crypto mining with a few extra challenges due to the nature of ERC20 tokens. Here goes:

The code for the token itself lives here, as a smart contract on Ethereum like any other ERC20 Token (Think EOS, OMG etc in their current form):

https://etherscan.io/address/0xb6ed7644c69416d67b522e20bc294a9a9b405b31

So that code controls how the token works. If you understand code on a basic level I’m sure you’ll get the gist of it. The most important function in there is the “mint” function. The contract generates a hashed string (Using a SHA-3 / Keccak algorithm called SoliditySha3).

When a miner solves that problem and finds the solution it will send a transaction to the smart contract with the solution data and call the mint() function, if it’s right, the miner is rewarded with tokens (Currently the reward is 50 0xBTC).

Note: 0xBTC has the same reward / difficulty / maximum supply data as Bitcoin itself.

Pools:

So pool software sits in the middle. It fetches the challenge data (the hashed string + the target difficulty) from the 0xBitcoin Smart contract. Miners connect their mining software to the pool server, and the pools software distributes the challenge around to the miners at a lower difficulty than the difficulty set by the 0xBitcoin Smart contract.

Mining Theory:

Onto a bit of mining theory. Think of difficulty as accuracy and the true solution for the mint() function as the bullseye. You can mine at the exact difficulty as the smart contract (Highest effective difficulty / accuracy), and when your miner finds something it thinks is the valid solution, it is 100% going to be the right one. However, this takes a LONG time to complete. If you mine at 1% of the target difficulty, every time your miner finds a solution it is less accurate (less certain to be the true solution) but you’ll generate more potential valid solutions in a given amount of time.

Pools work on the theory that if you have lots of people working together for the same reward, they will find the solution faster by sharing the total difficulty amongst each other. They generate lots of solutions that will hit within a certain radius of the actual bullseye on the assumption that one of them will hit within the actual target.

When one of them does get the target, the pool has its own Eth wallet and sends off for the mint() function.

It tracks the shares from each connected miner and rewards miners based on the difficulty (remember, accurracy) of their submitted solutions.

If you have a higher difficulty (maybe you have a lot of GPUs) and you send more accurate solutions to the pool, you get rewarded more “shares” in the pool.

When the reward is hit, and the 0xBTC get sent to the pools wallet, the pool calculates the miners payouts based on:

MinerReward = MinerShares / TotalSharesForBlock

This means that those with more hash power get rewarded fairly for their investment of hash power into the pool because you generate more shares with higher accurracy.

When the block reward (50 0xBTC) is distributed, the smart contract generates a new challenge, the pool resets everyone’s shares, and every miner starts working on finding the next solution (hitting the next bullseye).

The 0xBTC Pool Problem:

Currently, pools have to send off lots of tiny transactions, which cost Ethereum for gas, in order to distribute the rewarded tokens. This is expensive for pool owners and means pools have to run with quite high fees. At the moment, pools have to have quite high payout thresholds in order to mitigate these gas costs, i.e. the miners have to earn up to 20 tokens before the pools will send them their earnings.

With my current development 0xPool (coming soon!), these tokens all get sent in bulk from the pool to a smart contract which accepts the tokens and share data from the pool. The miners are then allowed to withdraw their tokens from this smart contract whenever they please.

What this does is move the cost of token distribution from the pools owner to the miners — as they now have to pay the gas cost to call the withdraw() function. This is better for everyone involved. The pool can have lower fees because they don’t have to pay for all of those tiny transactions, and the pools miners now have the choice as to when they withdraw their tokens. This is beneficial for the miners because it allows them to receive their tokens on demand, or wait and lower their gas costs.

Because the tokens are now held in a smart contract with the share data, miners are not required to trust the pool owner with their tokens for more than ~2 minutes. With this system, you make mining a little bit more DECENTRALISED and TRUSTLESS …which is what this whole cryptocurrency thing was meant to be in the first place!

I hope this write up helps someone understand the fundamentals of mining, pools, and 0xBTC a little better. Happy mining :)

Check out 0xBitcoin at http://0xbitcoin.org or /r/0xbitcoin and be sure to join the 0xBitcoin Discord at (https://discord.gg/EK6JKj8) we can help you there if you have any questions or want help setting up miners or trading!

--

--