Bitcoin Forum
May 17, 2024, 06:05:25 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Does this accurately show how a crypto-mining software works?  (Read 137 times)
bitcoinflea (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 4


View Profile
December 27, 2020, 12:57:58 PM
 #1

Hi guys, just got a question here:

Does this flowchart accurately show the step-by-step workings of a typical crypto-miner software?
I'm a newbie in the cryptocurrency business. Though I welcome comments and objections, please be understanding...

https://i.stack.imgur.com/AuPLa.jpg
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
December 27, 2020, 01:07:25 PM
 #2

Ish...

The miner either returns the hash back after each iteration or computes itself if it's below the target.

Once that occurs and the hash is below the target, the "block" is returned back to the software to be broadcast over the network and fund the wallet.
The address also has to be sent towards the start with the previous block hash that's transferred to the miner to start mining (transferring the transactions at that stage too to the miner) .
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4193



View Profile
December 27, 2020, 01:20:48 PM
 #3

Mining softwares are usually connected to a pool or node of some sort which will feed it with the information required.

The mining software will obtain the information needed to build a block header from the program. The ASICs merely hashes the block header twice with SHA256 to obtain the block hash. The variables within the block headers are changed with every attempt to ensure that the output is a different hash for every attempt. Only when the hash meets the minimum target, it will submit the correct block header to the mining pool. The mining pool will relay the block across the network and the reward becomes spendable after 120 confirmations.

There's no such thing as a verification node sending coins. Neither will the mining software interact with the coins, it's primary purpose is to supply information to the ASICs. When you're building your block header, you'll assemble a set of transactions and in that set of transactions, there should be a coinbase transaction which would consists of the coins being sent to the address that you've specified.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
December 27, 2020, 02:50:21 PM
 #4

there are some parts missing. for example the mining software has to do the verification (int comparison) itself and then send the good result to the node to be broadcasted.
there is also another step where the node has to be informed that the mining software failed to find the hash and is done searching then the node has to update the block and its headers (change the transactions in it or bump the extra nonce or change the time,...) and request a retry.
or when someone else finds a block and the node has to call the mining software to stop the work it is doing and start working on a new one.

there is a wrong part at the end about mining software storing coins into miners address after finding the block, this all happens BEFORE the mining even begins because the block has to be created and the coinbase set to send the reward to defined addresses before mining begins.

There is a FOMO brewing...
bitcoinflea (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 4


View Profile
December 28, 2020, 11:12:24 AM
Last edit: December 28, 2020, 11:48:26 AM by bitcoinflea
 #5

there is a wrong part at the end about mining software storing coins into miners address after finding the block, this all happens BEFORE the mining even begins because the block has to be created and the coinbase set to send the reward to defined addresses before mining begins.

Hmmm...so what address are you referring to? The miner's bitcoin wallet address?
By the way, is my revised diagram correct now? https://imgur.com/a/RaRgWEb

I want to understand how mining works so I'm starting from the beginning - that is, mining on my own first.
Kinda find the diagram for mining pools really complicated - so I'm starting with this first...
bitcoinflea (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 4


View Profile
December 28, 2020, 11:45:00 AM
 #6

Mining softwares are usually connected to a pool or node of some sort which will feed it with the information required.

The mining software will obtain the information needed to build a block header from the program. The ASICs merely hashes the block header twice with SHA256 to obtain the block hash. The variables within the block headers are changed with every attempt to ensure that the output is a different hash for every attempt. Only when the hash meets the minimum target, it will submit the correct block header to the mining pool. The mining pool will relay the block across the network and the reward becomes spendable after 120 confirmations.

There's no such thing as a verification node sending coins. Neither will the mining software interact with the coins, it's primary purpose is to supply information to the ASICs. When you're building your block header, you'll assemble a set of transactions and in that set of transactions, there should be a coinbase transaction which would consists of the coins being sent to the address that you've specified.


If my previous diagram is wrong, then is my revised flowchart below the correct one now?
https://imgur.com/a/RaRgWEb

I want to understand how mining works so I'm starting from the beginning - that is, mining on my own first. Kinda find the diagram for mining pools really complicated - so I'm starting with this first...
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4193



View Profile
December 28, 2020, 01:04:04 PM
 #7

I think that there are some conceptual misunderstanding here, I'll try to explain the process the best I can.

Mining involves the miner with his ASICs hashing the block headers twice to produce a hash. The block is valid when it's hash meets the target as specified by the network. The components of the block headers are as follows:
- Version (not really standardized due to ASICBoost)
- Previous Block hash
- Merkle Root Hash (Depends on the Transaction set)
- Time Stamp (Variable)
- Target in nBits (Fixed)
- Nonce (Variable)
The mining pool's job is to determine the transaction set and assemble them. Firstly, the mining pool will select a set of transactions and calculate the transaction fees. The pool will then use this amount, the pool will generate their own transaction and specify an output that is their address for which the amount must be less than < 6.25BTC + TX fees, there is no lower limit. After that, the pool will send the Version, Block hash, coinbase transactions, merkle tree, target and current time. The mining software will add the extranonce within the coinbase transactions before forming the merkle root hash. The mining software will then feed the relevant information to the ASIC itself.

Now, to the main part which how the ASIC actually mines. Depending on your ASIC, it will increment the nonce by itself. The extranonce allows the ASICs to calculate more hashes at once without wasting time to calculate the entire merkle tree again. ASICs are actually so specialized that most of them are designed to only vary and hash the final 4bytes which contains the nonce.


To point out the mistakes:

1. The mining software you're using likely doesn't connect directly to the network directly. You need to have access to the previous block hash, list of transactions and the target. To do this, something must be used to process the information which is usually either your own Bitcoin Core (for a solo miner) or a mining pool.
2. The previous block hash always changes every ~10minutes so there's likely no advantage in doing so.
3. Mining software does not store the coins in the wallet. As mentioned, a coinbase transaction is included in the block. The transaction contains the newly generated coins as well as the transaction fees and you can specify the output as your wallet. It does not happen after you find a block.
4. There's no verification node. Your ASICs determines the target and compares the hashes generated. If the hashes meets the minimum target, your block is valid. Your software will send the nonce used, timestamp, etc to the server and the server will relay the valid block with the headers, transactions etc.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
December 28, 2020, 02:24:37 PM
 #8

there is a wrong part at the end about mining software storing coins into miners address after finding the block, this all happens BEFORE the mining even begins because the block has to be created and the coinbase set to send the reward to defined addresses before mining begins.

Hmmm...so what address are you referring to? The miner's bitcoin wallet address?
By the way, is my revised diagram correct now?

I want to understand how mining works so I'm starting from the beginning - that is, mining on my own first.
Kinda find the diagram for mining pools really complicated - so I'm starting with this first...

your initial diagram sounds like you are saying that the miner first finds the block and then claims the reward which is exactly the opposite of what's happening.
the miner first claims the reward in its coinbase transaction (sends the reward to its own address(es)) then starts mining that block. if they succeed the block will become part of the blockchain and they can spend it later.

There is a FOMO brewing...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!