Author

Topic: Mining: separating the steps (Coding) (Read 853 times)

newbie
Activity: 2
Merit: 0
May 07, 2016, 08:50:15 AM
#3
Thanks for the info.
Do you know the internal techniques of a solo (asic) miner?
I realized they run with programs like cgminer and Im thinking about how they do the work.
How do they put the pieces together when they do solo mining?
Who is collecting the transactions to build the next new block?
Is there any chance I could realize that Im not working on the same block than someone else?
full member
Activity: 203
Merit: 100
May 06, 2016, 07:32:11 PM
#2
It is entirely up to the pool operator or solo miner to select which transactions to include.  A pool, or solo miner, is aware of all transactions in their mempool.  They build a block from these transactions and then start looking for valid hashes.  

So what goes in a block depends first of all on what the solo node or pool has accepted into its mempool and then on which transactions they selected from their mempool.  If you want the details see https://bitcoin.org/en/developer-guide#mining.

The only restriction on blocks is that pools or solo miners must only build a block that will be accepted and relayed around the network.  For block rules see https://en.bitcoin.it/wiki/Protocol_rules

For what mempool will include see such parameters as mempoolexpiry, mintxfee and minrelaytxfee.

Remote 'Miners' using a central pool only calculate sha-hashes as directed by the pool operator. They do not know block contents.  A hardware miner such as an S7 is simply calculating sha-hashes values for the pool operator or solo miner.






newbie
Activity: 2
Merit: 0
May 06, 2016, 10:29:29 AM
#1
Hi there,
I'm a software programmer and I'm interested in the specific steps inside a mining client.
I know i cannot efficiently mine with my PC but I'm interested in the steps to reproduce.

I'm using BitcoinJ to develop a small program to decode the Blocks from the standard LevelDB that the bitcoin core client downloaded.

If I understand it correctly, it's all about the 80 bytes header.
The variable things are the previous block hash and the merkle hash of the transactions contained in the new block (plus time and nonce).

So my first question:
Can a miner simply select some of the pending transactions to be included in the new block (=> the merkle hash)?

How are the solo mining clients doing this? Do they ask for a new block (as I could do in the debug console of the core client) and try to make it fit (by adjsuting the nonce ) or are they aware of all pending transactions and puzzle them together until it fits?

Thanks in advance,
Astaldo
Jump to: