What is Bitcoin Mining and How Does it Work? (2020 Updated)

Forcenet: an experimental network with a new header format | Johnson Lau | Dec 04 2016

Johnson Lau on Dec 04 2016:
Based on Luke Dashjr’s code and BIP: https://github.com/luke-jbips/blob/bip-mmhf/bip-mmhf.mediawiki , I created an experimental network to show how a new header format may be implemented.
Basically, the header hash is calculated in a way that non-upgrading nodes would see it as a block with only the coinbase tx and zero output value. They are effectively broken as they won’t see any transactions confirmed. This allows rewriting most of the rules related to block and transaction validity. Such technique has different names like soft-hardfork, firmfork, evil softfork, and could be itself a controversial topic. However, I’d rather not to focus on its soft-hardfork property, as that would be trivial to turn this into a true hardfork (e.g. setting the sign bit in block nVersion, or setting the most significant bit in the dummy coinbase nLockTime)
Instead of its soft-HF property, I think the more interesting thing is the new header format. The current bitcoin header has only 80 bytes. It provides only 32bits of nonce space and is far not enough for ASICs. It also provides no room for committing to additional data. Therefore, people are forced to put many different data in the coinbase transaction, such as merge-mining commitments, and the segwit commitment. It is not a ideal solution, especially for light wallets.
Following the practice of segwit development of making a experimental network (segnet), I made something similar and call it the Forcenet (as it forces legacy nodes to follow the post-fork chain)
The header of forcenet is mostly described in Luke’s BIP, but I have made some amendments as I implemented it. The format is (size in parentheses; little endian):
Height (4), BIP9 signalling field (4), hardfork signalling field (3), merge-mining hard fork signalling field (1), prev hash (32), timestamp (4), nonce1 (4), nonce2 (4), nonce3 (compactSize + variable), Hash TMR (32), Hash WMR (32), total tx size (8) , total tx weight (8), total sigops (8), number of tx (4), merkle branches leading to header C (compactSize + 32 bit hashes)
In addition to increasing the max block size, I also showed how the calculation and validation of witness commitment may be changed with a new header. For example, since the commitment is no longer in the coinbase tx, we don’t need to use a 0000….0000 hash for the coinbase tx like in BIP141.
Something not yet done:
  1. The new merkle root algorithm described in the MMHF BIP
  2. The nTxsSigops has no meaning currently
  3. Communication with legacy nodes. This version can’t talk to legacy nodes through the P2P network, but theoretically they could be linked up with a bridge node
  4. A new block weight definition to provide incentives for slowing down UTXO growth
  5. Many other interesting hardfork ideas, and softfork ideas that works better with a header redesign
For easier testing, forcenet has the following parameters:
Hardfork at block 200
Segwit is always activated
1 minutes block with 40000 (prefork) and 80000 (postfork) weight limit
50 blocks coinbase maturity
21000 blocks halving
144 blocks retarget
How to join: codes at https://github.com/jl2012/bitcoin/tree/forcenet1 , start with "bitcoind —forcenet" .
Connection: I’m running a node at 8333.info with default port (38901)
Mining: there is only basic internal mining support. Limited GBT support is theoretically possible but needs more hacking. To use the internal miner, writeup a shell script to repeatedly call “bitcoin-cli —forcenet generate 1”
New RPC commands: getlegacyblock and getlegacyblockheader, which generates blocks and headers that are compatible with legacy nodes.
This is largely work-in-progress so expect a reset every couple weeks
jl2012
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 671 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20161205/126aae21/attachment.sig
original: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-Decembe013338.html
submitted by dev_list_bot to bitcoin_devlist [link] [comments]

A full explanation of what Antpool is doing, how it harms the network, and what should be done (if anything) to make it irrelevant.

Hey bitcoin
I saw a lot of people with the same questions about AntPool and what's happening. I had to dig hard to find halfway decent answers at times, and other times there was some hefty misinformation and unwarranted FUD in some corners. This is instead, a full explanation of what is happening and why you should and shouldn't be worried.

Why is AntPool mining tiny blocks?
This is an attack of sorts on bitcoin, but not in a straightforward manner. There is no immediate increase of fees because these blocks exist. In fact, all it means is that currently the network is mining with hashrate:
H - A 
where H is the total hashrate and A is the hashrate of AntPool. AntPool doesn't change the overall hashrate of those cooperating with Bitcoin.

If it doesn't effect transaction fees or times, why should I be worried?
The long-term stability of the network is where this attack comes into play. The difficulty is re-targeted every 2016 blocks to make sure the difficulty stays as close to 10 minutes as possible. The AntPool blocks, despite their lack of transaction processing, will be included in this count. That means that as long as there are malicious miners, the effective transaction throughput will be:
10 min * (H / (H - A)) 
This is after re-targeting and if the attack has been going on for the entire 2016 block timeframe.

Is this economically viable for miners?
Perhaps, but to be a miner on AntPool, you'd have to be pretty much all-in on the other side of the chain with substantial holdings. The block reward is currently 12.5 bitcoin and there are around 4 bitcoin in transaction fees per block.
if you decide to mine sub-optimally, you miss out on around $16k USD of effective reward for the transaction fees alone. That one block alone isn't going to vastly change the price, but mining a high percentage of blocks throughout the re-targeting period will. Let's say they effectively manage to mine 20% of blocks, that would be a transaction cost loss of around USD $6 Million for a mere 20% loss of network hashrate. While the network will be slower, you'd have to hold tens to hundreds of thousands of coins on the alternate chain for this attack to be viable.

I noticed that AntPool doesn't always mine empty blocks, what gives?
I noticed the same thing. Check over here: https://blockchain.info/blocks
Sometimes AntPool mines a full block, sometimes they mine a partial block, and somtimes they mine an empty block.
There's a chance that AntPool found a way to optimize hash hits by cycling number of transactions first instead of the nonce variable. (I can't for the life of me see how this optimization would be any quicker.) In any case, if this is what's happening, then the average AntPool block would be half as large as the average.
The more likely possibility is that AntPool has 2 different versions of the mining software where you can opt-in to being malicious or they can turn it on and off at will or some systems had a mining error that fails to process transactions but still hashes.

What can be done?
Honestly, I don't think this will be a problem long-term. It's just (probably) not economically viable unless AntPool is trying to get enough miners off the main chain to take it over and run a 50% attack... Which will be very hard and still economically costly. If AntPool continues sub-optimal mining, a lot of miners will likely leave for a better (honest) pool.

If this becomes a serious problem, what should be done?
Honestly, adding a check-able hashed variable like:
isMemFull 
to each block would be as ideal as possible. The check algorithm could have a pool factor like 1.5 or 2 so a few non-propagated transactions don't pull a false negative. This could even eat a bit of the signature field to keep block size the exact same.
if(isMemFull = 1 && memPoolSize >= 1.5Mb) {acceptBlock()}; if(isMemFull = 0) {acceptBlock()}; else {rejectBlock()}; 
The only difference is if the 1.5 or 2 factor is met in a local transaction pool, the miner would reject blocks with a 0 in the field.
When recalculating difficulty, the network would not count non-full blocks where the bit is set towards the difficulty. This would mean that the only time the difficulty could be tampered with is when the mempool is 1Mb - 2Mb (max)

Wouldn't that require a hard-fork?
I unfortunately can't envision a way to implement without hard-forking, but the massive upside to this is that the difficulty of the (new) main chain would be lower overall so that miners who don't cooperate would be increasingly squeezed out of the old chain.
The good news is... it likely doesn't matter. I'm relatively certain AntPool will have to mine at an economic deficit for too long for it to have any net positive for them.

Edit 2
After thinking more about it, the new chain would still be valid on the other side - especially if old data locations were used such as the LSB of sig. Technically, this WOULD only be a soft fork because the older systems that find a block would have to orphan and swap to the new chain when they inevitably encounter a longer chain.
user69213 may have a point that dummy transactions may be used in attack. I'll have to look back into how and when transactions are validated, but I think he does have a point. Still, other changes would also be sufficient to overcome this hurtle like PoW. (Although ASIC miners won't be happy about that and it would be a definitive hard-fork)

TL;DR: What AntPool is doing will likely have no long-term effect on Bitcoin, and if it does, there are at least some ways to make it not matter.
Edit - Minor Text Fixes
submitted by CaptainPatent to Bitcoin [link] [comments]

What Bitcoin Is And Why It Matters IS BITCOIN (BTC) MINING WORTH IT 2020?? -PROFITABLE? What Bitcoin Miners Actually Do Ano ang BITCOIN for Beginners (tagalog) Bitcoin Basics ... Bitcoin Trading for Beginners (A Guide in Plain English ...

ASIC. The bitcoin mining world is now solidly in the Application Specific Integrated Circuit (ASIC) era. An ASIC is a chip designed specifically to do one thing and one thing only. Unlike FPGAs, an ASIC cannot be repurposed to perform other tasks. An ASIC designed to mine bitcoins can only mine bitcoins and will only ever mine bitcoins. Bitcoin is everywhere these days. If you’re late the party, then worry not. CoinRevolution has got you covered. This is our ultimate guide to everything Bitcoin. Each section will walk you through exactly what Bitcoin is, how it works, and where you can get some. You’ll also learn how to buy, sell, trade, shop, mine Bitcoin — as well as where to discuss it all further. An application-specific integrated circuit (ASIC) bitcoin miner is a computerized device that was designed for the sole purpose of mining bitcoins. Bitcoin is a digital or virtual currency created in 2009 that uses peer-to-peer technology to facilitate instant payments. It follows the ideas set out in a whitepaper by the mysterious Satoshi ... Bitcoin Mining for Dummies – How Bitcoins are Mined. Marc Kenigsberg - July 9, 2018 ... An ASIC that works for Bitcoin – SHA256 – will not work on DASH or on Ethereum for example. A GPU rig can be good for several coins in different ways. Efficiency, high quality and hardware cost are the main features that would make a rig good.

[index] [30682] [22632] [1109] [7093] [31506] [15781] [15843] [5324] [22473] [24824]

What Bitcoin Is And Why It Matters

This has made Bitcoin and other coins with ASIC support unprofitable to mine on traditional hardware like your computer. ... Bitcoin Explained Simply for Dummies - Duration: 12:49. Bitcoin has been all over the news in recent days, reaching all-time highs then dropping thousands in minutes. So what is the hype all about? Start trading Bitcoin and cryptocurrency here: http://bit.ly/2Vptr2X Bitcoin trading is the act of buying low and selling high. Unlike investing, which means... So is Bitcoin mining worth it in may 2019? is Bitcoin mining in anyway profitable? Or worth it? should purchase a bitcoin mining machine (antminer or ASIC) or build your first mini bitcoin mining ... For more info concerning Bitcoin wallet card, litecoin wallet card, please visit site the following: http://www.cryptocoinwalletcards.com/ Tags: asic bitcoin...

#