Bitcoin Forum

Other => Beginners & Help => Topic started by: a298b112 on May 19, 2022, 02:37:07 PM



Title: better algorithm to mine Bitcoin, was there any?
Post by: a298b112 on May 19, 2022, 02:37:07 PM
I wonder if there were any attempts to come up with better algorithm that will allow you to mine BTC faster than others? I mean, if I understood correctly, all you have to do is run the hash function with the desired outcome, in this case, with the leading 17-19 zeros. So, is there better algorithms or bruteforcing is the only way?


Title: Re: better algorithm to mine Bitcoin, was there any?
Post by: bitmover on May 19, 2022, 02:55:43 PM
I wonder if there were any attempts to come up with better algorithm that will allow you to mine BTC faster than others? I mean, if I understood correctly, all you have to do is run the hash function with the desired outcome, in this case, with the leading 17-19 zeros. So, is there better algorithms or bruteforcing is the only way?

Bitcoin is designed to work this way.
The whole security and the foundation of its blockchain is the Proof of Work, and the "work" is this "bruteforce" of hashing.

What you are suggesting, a "better algorithm" to create the desired hash without bruteforcing, is basically to break out SHA 256, reversing a hash function. You would be basically destroying cryptography.

The implications of your suggestion would be terrible for computer security and cryptography. You would be able to even reverse public keys to private keys:

https://abeldantas.com/content/images/size/w1000/2022/01/mbc2_0401.png
https://abeldantas.com/mastering-bitcoin/



I created a brief explanation of how Proof of Work works long ago, but it is still valid (https://bitcointalk.org/index.php?topic=3317586.0)

Basically, you need computer power to generate as much hashes as possible, until you find a nonce (a number) that once hashed is low enough to "solve" the Proof of Work algorithm and create a new block.

As hash is a only way function (you cannot unhash anything), the only way to do so is by bruteforcing nonces (hashing random numbers, millions per second) and checking their hash.

You are suggesting that someone could build an algorithm that you would reverse the hash function: you choose the hash, then it would return you the nonce.



There is a nice demo of how Proof of Work works here:
https://andersbrownworth.com/blockchain/blockchain


Title: Re: better algorithm to mine Bitcoin, was there any?
Post by: nc50lc on May 19, 2022, 03:07:10 PM
-snip- I mean, if I understood correctly, all you have to do is run the hash function with the desired outcome, in this case, with the leading 17-19 zeros.
You can't do that because all Bitcoin nodes will check if your "winning" block header's hash is valid by checking if that block's SHA256(SHA256(Block_Header)) hash matches.
Since you've used a different hashing algorithm, they will come up with a different result.


Title: Re: better algorithm to mine Bitcoin, was there any?
Post by: Welsh on May 19, 2022, 06:45:37 PM
Technically there are other ways, they just aren't secure enough. Proof of Work is arguably the best option.

I wonder if there were any attempts to come up with better algorithm that will allow you to mine BTC faster than others?
Why would we want to mine it quicker? Bitcoin already has difficulty, which adjusts based on the hashrate of the entire network. The only concern I see with Proof of Work is the energy used. Although, I don't think it carries much weight. I mean, Proof of Work is what makes Bitcoin work, and what sets it apart from other implementations, which basically just aren't as secure. It's one of the big contributors to its success.


Title: Re: better algorithm to mine Bitcoin, was there any?
Post by: witcher_sense on May 20, 2022, 05:49:22 AM
I wonder if there were any attempts to come up with better algorithm that will allow you to mine BTC faster than others? I mean, if I understood correctly, all you have to do is run the hash function with the desired outcome, in this case, with the leading 17-19 zeros. So, is there better algorithms or bruteforcing is the only way?
One doesn't need to come up with a "better" algorithm for mining to add up new blocks to the blockchain at a higher pace. One can achieve that by slightly adjusting the code that governs the difficulty of the mining. For example, if we set the expected time of mining of 2016 blocks to 10080 minutes or 5040 minutes instead of the current 20160 minutes, it will automatically lead to a lower difficulty value and higher target for miners. It also will make a difficulty adjustment to take place every one week or three days, which will make the competition between miners even more intense. In short, by slightly changing only one value in the code, we can make bitcoin blocks be mined faster.

However, blockchain is made very slow intentionally so that a new block can be propagated over the network before the next one is mined to prevent constant disagreements between nodes and unexpected forks and chain reorgs. Paradoxically, if we make bitcoin blocks faster, it will result in very slow settlements because of uncertainty in the current state of the blockchain. That also will make the network more centralized since to verify very fast blocks of transactions, one needs decent hardware. Raspberry Pi is not going to handle fast blockchains. Hence, there will be a centralization of power where people are incentivized to build big data centers and outsource the running of full nodes.


Title: Re: better algorithm to mine Bitcoin, was there any?
Post by: odolvlobo on May 21, 2022, 01:35:14 AM
I wonder if there were any attempts to come up with better algorithm that will allow you to mine BTC faster than others? I mean, if I understood correctly, all you have to do is run the hash function with the desired outcome, in this case, with the leading 17-19 zeros. So, is there better algorithms or bruteforcing is the only way?

Look up ASICBoost. It is a hashing optimization.


Title: Re: better algorithm to mine Bitcoin, was there any?
Post by: pooya87 on May 21, 2022, 03:54:16 AM
You can not change the protocol, for example the target (looks like leading zeros but we don't count zeros) because the nodes are enforcing those. You also can't break the algorithm itself since it hasn't worked for the past 21 years (SHA2 was created on 2001).
What you can do is to optimize the algorithm, just as many have done so far. For example by using the  characteristics of SHA2 you could slightly decrease the amount of computation needed to get the digest. But the thing about proof of work is that it works based on a value called "difficulty" and it is adjusted based on how fast everyone in total is computing hashes. So if you can compute more hashes (whether by optimizing the algorithm or by producing more efficient hardware like ASICs) it will re-adjust to prevent blocks from being mined faster than what the protocol wants.