Deep Dive into Bitcoin: Answers to the Questions You Rarely Ask
How to hack Bitcoin? How does the blockchain calculate time? How does mining difficulty change? What happens if two miners mine a block simultaneously? Where are transactions stored before confirmation, how are fees calculated, and is it possible to send a transaction with zero fee? What types of nodes exist in the blockchain, and how do they differ? When can you use miningΒ rewards?

Here I provide deeper answers to these questions because popular materials about Bitcoin either donβt explain these things at all or do so very superficially. To understand this article, you need a minimal understanding of how blockchain works, which you can get here: https://vas3k.com/blog/blockchain/
TL;DR
- How to hack Bitcoin?
A quantum computer will only be able to derive a private key from a public key after a transaction has been sent. If no transaction has occurred, the wallet is protected.
A 51% attack only provides the ability to cancel your own or othersβ transactions to double-spend your own coins; gaining control over othersβ coins is impossible. - How does mining difficulty change?
Difficulty is recalculated every ~2 weeks based on the mining time of the previous twoΒ weeks. - What happens if two miners mine a block at the same time?
The chain temporarily splits until one branch becomes longer. The longer branch becomes the mainΒ one. - When can mining rewards be used?
After 100Β blocks. - How does the blockchain calculate time?
Based on the median time of the past 11 blocks and the system time of theΒ nodes. - Where are transactions stored before confirmation, how is the fee calculated, and can you send without one?
Theyβre stored on nodes for no more than two weeks. A zero-fee transaction is theoretically possible but practically almost impossible to get confirmed. - What nodes are in the blockchain and how do they differ?
Full nodesβββhold the blockchain data and enforce the rules.
Minersβββquery full nodes for data and build new blocks.
Light nodesβββoften used in wallets on weak devices; they query full nodes for what theyΒ need.
Whatβs the point of Bitcoin (besides speculation), in plainΒ English

Bitcoin is an alternative financial system that does not require user trust. When using traditional banks, we must trust them not to steal or lose our money, and if that happens, we must trust the state to be able to return it. We also have to hope that money wonβt be blocked at the whim of authorities or bank employees.
The point of Bitcoin is the opposite: everything is tied to strict mathematics that removes the probability of all these potential problems (or drastically reduces), provided you store Bitcoin in a personal non-custodial wallet.
Non-custodial wallet: A wallet controlled only by whoever has the private key; essentially just a small file/program that stores keys and signs transactions.
Custodial wallet: An account on an exchange that controls your assets and stores your funds in its own non-custodial wallets. This allows the exchange to block or seize your funds if you violate its rules or national laws, though the exchange offers more convenient and expanded functionality inΒ return.
Interesting fact: A Bitcoin wallet is not an object inside the blockchain, but a program that stores keys and signs transactions.
The blockchain stores UTXOs (Unspent Transaction Outputs). Each UTXO is βlockedβ by a condition (program), usually tied to an address (practically, a hash of a publicΒ key).
To spend a UTXO, the wallet creates a transaction referencing that UTXO as an input and adds a signature. Network nodes verify the signature and the scriptβs execution. As a result, the old UTXO becomes spent, and the transaction creates new outputsβββnew UTXOs for the recipients.
A private key is a number. A public key can be calculated if you have the private key, but the reverse is practically impossible (how thatβs attacked is discussed later in the βattacksβ section). Using a private key, you can sign data, but this signature cannot be forged with a public key. Meanwhile, the public key can verify that the signature was produced by the corresponding privateΒ key.

In early versions, the wallet address was the public key. But later, addresses derived as a hash/encoding of the key or script began to be used. This is a crucial point for the section on quantum computerΒ attacks.
Once a transaction is signed, it must be embedded in a block. First, it goes into a general pool of unconfirmed transactions (mempool), where any miner can take it to create aΒ block.
But a transaction can exist only once in the blockchain, so the network canβt allow every miner to create their own block with the same set of transactions and have them all accepted.
Block Header
Each block has a header containing version data, the previous blockβs hash, the merkle root (hash of all transactions in the current block), time, bits (mining difficulty), and aΒ nonce.
Hereβs an example (block 900K)
β’ version: 0x20aba000
β’ previous block hash: 0000000000000000000196400396be46d0816dc462df4c3450972f589f4d7d24
β’ merkle root: 0cfb54e522b07bd1a381adc774ec1851590ef4c3add83958135106534569f970
β’ time (unix): 1749188499 _(2025β06β06 06:41:39 UTC)_
β’ bits (nBits): 0x17023774
β’ nonce: 0x925fd07a
All of these fields are combined and then hashed viaΒ SHA-256.
SHA-256 is a hashing technology: take some data and turn it into a different set of numbers that you canβt convert back into the original data if you only know the hash. But you _can_ verify it, because for a fixed input X the result is always the same output Y. So knowing X gives you Y; knowing Y does not practically give you X backβββeven with a quantum computer.
You can try hashing any data here.
SHA-256 is also one of the core tools in the HTTPS connections we use every day, and it plays a key role in hundreds of internet protocols.
The nonce is needed to find out whose block to record. Miners change the nonce so the headerβs hash is less than the target. In our example, the hash has 19Β zeros.
Finding such a hash is hard. It takes roughly ~10 minutes of the entire Bitcoin networkβs mining power. Blocks should appear roughly every 10 minutesβββthatβs how Satoshi Nakamoto designedΒ it.
Why exactly this many zeros, and how does mining difficulty change?

Itβs not actually about the zeros, but about the **target**. The target determines mining difficulty: the smaller the target, the higher the difficulty. A valid block header hash must be β€ the target. Because small target numbers in hexadecimal start with zeros, hashes often appear with many leading zeros (e.g., ~19 or more). The smaller the target, the rarer it is for a random hash to land below it, so mining becomesΒ harder.
Difficulty Calculation Hack: If the difficulty increases by 16 times, the required threshold becomes 16 times lowerβ often resulting in one additional leading hex-zero.
Difficulty adjustments (retarget) occur every 2016 blocks (roughly 2 weeks, 1 block ~10 minutes). The blockchain uses a simpleΒ formula:
Target_new= target_old*T_act/T_exp, 4Texp
Target_new = new target (new difficulty)
Target_old = old target
T_act = actual time it took to mine the last 2016 blocks
T_exp = expected time for 2016 blocks: 2016*600 seconds (10 min = 600 sec)
4T_exp= The change is limited: difficulty canβt shift more than 4Γ eitherΒ way.
If, since the last difficulty retarget, the networkβs total hash rate (the combined power of all miners) has increased over the past 2,016 blocks, then with near-certainty the average time to mine a block will decrease. That means the actual time to produce those 2,016 blocks T_act will be less than the expected time T_exp, so T_act/T_exp < 1. As a result, the new target Target_new will go down: and the lower the target, the higher the difficulty and the harder it is toΒ mine.
But what to do if two different miners mine a block at the sameΒ time?
That happens,and thereβs a safety mechanism forΒ it.
In theory, they can make practically identical blocks if the same transactions in the same order fall into each block. But blocks still wonβt be identical because the first transaction in every block is the coinbase (the miner reward), and it pays to the minerβs addressβββso two miners canβt have the exact same block because their addresses differ.
But it is possible that two miners almost simultaneously mine different blocks. If the delay between the creation of a block and its distribution among nodes is 2 seconds, then this means that after the creation of the first block, there is a two-second gap in which a second block can be created. The longer this time, the higher the probability, but with each year this time is reduced. The probability of creating three blocks is almost negligible, but the protection system is theΒ same.
If two blocks are created, they are saved in nodes, and these two chains are passed further. Miners then choose which block to build onβββusually the one they saw first. And when they find the next block for one of the chains, it is distributed further and the nodes agree with it, and the shorter version is forgotten. This is the rule of the longer chain. Even if 2, 3, or more blocks in a row are formed in two chains, sooner or later one branch outpaces theΒ other.
Transactions have 3 probableΒ paths:
1. Fall into the chain that wins, then they remain in the blockchain.
2. Fall into both chains, then only the version in the winning chain remains relevant.
3. Fall into the chain that loses, then they go again into the pools of unconfirmed transactions (more on thisΒ below).
A fewΒ numbers:
- Approx. probability of a fork given ~1s delay:Β 0.17%
- A second block on the same competing branch:Β 0.00028%
- Third: 4.6*10^β»βΉ
- Fourth: 7.7*10^β»ΒΉΒ²
Thatβs why exchanges donβt credit your deposit after 1 confirmation. Typically they wait for 6 confirmationsβββ~1 hour on average (6 blocks Γ 10 minutes).
There is no limit to the length of the second/third chain because they disappear quickly. Not counting these twoΒ cases:
- Reorganization through 53 blocks due to a bug in the software (source).
- Another incident with reorganization through 24 blocks (source).
And there is also the possibility of an attack through a second chain, but about this at the veryΒ end.
From this follows the next question:
Since the miner receives a reward for mining a block, what happens when two blocks areΒ mined?
Simple: a miner can spend the reward only after 100Β blocks.
If you are a miner and mined block β 1000, you will be able to use the reward for this block only starting from block β1100. This looks like a time-lock transaction, but technically it is not one. I will write about the time-lock technology next time, this is already turning into too muchΒ text.
Miners add transactions to the blockchain, receiving a fee for this. And from this follow a few more questions:
Where and for how long are unconfirmed transactions stored, and can a transaction with a zero fee pass inΒ theory?
The fee in Bitcoin depends not on the number of tokens sent in the transaction, but on the size of the transaction and the occupancy of the network at the given moment. After sending your transaction from a non-custodial wallet, it goes to the nearest node(s), these nodes decide based on several characteristics whether to accept your transaction orΒ not:
1. Does it comply with the rules and did you not assign yourself non-existent tokens or something else?
2. Is the specified transaction fee sufficient?
If the answer to one of these questions is no, the node will not take the transaction and it will not fall into the blockchain, and your balance will not change. It turns out that a zero fee, in most cases, will not pass into the blockchain, although theoretically a miner can include such a transaction in a block, it is extremely unlikely.
How does a node assign aΒ fee?
The node has a certain amount of memory where it stores such unconfirmed transactions after receiving them, but until the moment they are recorded in the blockchain.
By default, it is limited to 300 MiB of RAM memory and 336 hours of storage. However, if the blocksonly setting is enabled in Bitcoin-Core 25.0, the RAM memory will be reduced to 5 MiB; this is often done for validating the blockchain.
All these data can be changed when setting up the node, but this is often not done, as for most it would be a simple waste of extra resources.
And what will happen if you send a transaction with the minimum allowable fee?
If the node does not throw it out after adoption due to overflow, and if miners will not take this transaction due of small fee, it will be deleted after 336 hours = 2Β weeks.
After the transaction is accepted, nodes distribute it to other nodes, and miners insert transactions with the highest fees into theΒ block.
Considering the limits on transaction size of 400,000 weight units β 100KB (but it could be more with SegWit, but those are already too small details). A maximum of 10 such large transactions can fit into 1 block, and β 10,000 of the smallest. But on average it comes out to 2500 transactions per 1Β block.
The fee itself is calculated by the formula: fee (sat) = vsize (vB) * feerateΒ (sat/vB)
- fee = commission.
- vsize = transaction size.
- sat = satoshi, in one Bitcoin there are 100,000,000 satoshis.
- vB = VirtualΒ Byte.
Your wallet can find out the minimum feerate from the nodes, but this is the lower boundary of whether the transaction will be distributed, not a guarantee of its confirmation. To estimate how much you need to pay now, wallets use mempool statistics and confirmation history.
An average transaction weighs 150vB; if at the given moment the average sat/vB = 2, then the transaction will cost 300 sat. And it will costΒ $0.27.

The highest sat/vB was in April 2024 during the halving and was from 1795 to 2751 sat/vB (source). On that day, an average transaction would have already cost from $160 to $245, depending on how quickly it needed to be processed.
The busier the network, the higher sat/vB. If you want your transaction to get confirmed faster, you set sat/vB above the currentΒ average.
Nodes define the fee as: fee = sum(inputs)βββsum(outputs), then they look at the transaction size to check if it fits their internal policies.
Donβt forget about UTXO: if over time you received 10 separate incoming transactions, and now you want to send the entire balance in one transaction, the blockchain sees that as 10 inputsβββmeaning the transaction is larger and therefore more expensive.
To save on fees in the future, it is useful to sometimes do βconsolidationββββsending yourself all small remnants in one transaction when the network is calm and sat/vB isΒ minimal.
Returning to the first topic and the block header, the following question mayΒ arise:
How does the blockchain know that ~10 minutes passed, and that miners arenβtΒ lying?
The blockchain receives information about the time from miners and nodes (nodes that store information but do not mine) in UTCΒ format.
Miners write the time in the block header. Nodes have their own clocks and verify the median time received from otherΒ nodes.
Bitcoin is a closed system, so the blockchain cannot connect to ntp.org to check if the miners are writing the truth in the block header and the nodes orΒ not.
How can the blockchain check if the nodes and especially the miners arenβtΒ lying?
For this, there is MTPβββMedian TimeΒ Past.

Not the average, but precisely theΒ median.
It is calculated from the last 11 blocks arranged in order. ForΒ example:
18, 2, 12000 (liar), 14, 6, 20, 10, 4, 16, 12,Β 8
If we take the average value, then we need to sum all these numbers and divide by 11, we get 1100. Because of the liar who put 12000, everything has changed aΒ lot.
But if we take the median, then first we arrange them inΒ order:
2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 12000Β (liar)
And we take the value from the middle, that is, 12. This is how MTP is calculated.
The time of a new block is always greater than the MTP; otherwise, the block will not be accepted by other miners/nodes and will not be inserted into the blockchain.
But if someone wants to go to the future, at what time gap should blocks be rejected?

In the past Bitcoin used NATβββNetwork Adjusted Time (time adjusted by the network), which compared median time from peers. Later NAT was removed as a consensus component.
Now nodes use their own system UTC time to check how far βinto the futureβ a new block is. If a blockβs timestamp is more than 2 hours ahead of a nodeβs local time, that node rejectsΒ it.
If some nodeβs time differs significantly from other nodes, then NAT warns about itβββthatβs basically the only remaining use.
Miners and other nodes, how do they differ and why are theyΒ needed?
There are 3 main types of nodes in Bitcoin: a full node with two variations (archival and pruned), a light node, and aΒ miner.
The other nodes are superstructures on top of these three pillars of the blockchain.
- Full archival node: a server that has all the information about the blockchain for all time. Validates or rejects blocks in accordance with the rules of the blockchain.
- Full pruned node: also checks blocks but does not store all data, only the UTXO and part of the lastΒ blocks.
- Relay node: a superstructure on top of a full node, which is connected to other nodes with a large number of peers for fast distribution of information. Like torrentΒ seeders.
- Light node: stores only block headers to check their hashes. For transactions, it ask information from full node. Great for phone wallets or weak devices where storing dozens/hundreds of GB is inconvenient.
- Miner: takes information from a full node or is one; based on this information, searches for a nonce to produce a valid block, then broadcasts it to theΒ network.
If you need a non-custodial wallet on a PC, then perhaps a full pruned node for this would be the best option. You can choose the one you need here: bitcoin.org/en/choose-your-wallet?step=1
How to hackΒ Bitcoin?
There are many possible attack vectors. If I described all of them, the article would be longer than it already is. But someday I will write. For now, letβs briefly look at two hack variants that are often talkedΒ about.
Quantum Computer VSΒ Bitcoin
A quantum computer could derive a private key from a public keyβββbut thereβs already partial protection. If youβve never spent from your address, your wallet is protected because outsiders see only the hash of your public key, not the public keyΒ itself.
Even with a quantum computer, it is practically impossible to brute-force the hash of a public key. But after the first outgoing transaction, the public key becomes visible to everyone. Therefore, to protect against quantum attacks, you should use addresses once.
However, thereβs still a possible βinterceptionβ scenario: if a quantum computer could, after you broadcast a transaction but before itβs confirmed, derive your private key from your revealed public keyβββit would have very little time, but thatβs theΒ idea.
But there are wallets (outputs) of old formats, where the public key is visible immediately, and such wallets can be hacked even if there was not a single transaction fromΒ them.
And there are also many βlostβ wallets; transactions were made from some, but that was many years ago. And with the help of quantum computers, coins from these wallets will probably fall back into circulation and possibly crash the Bitcoin price. But letβs leave these speculations to analysts who were perfectly described by one satirical channel:
βLast weekβs target for Bitcoin at 34 thousand dollars has been revised and now stands at 240 thousand.β

So, a quantum computer will not destroy Bitcoin in thisΒ way.
But they are already thinking about creating a reusable quantum-protected wallet. This will require a soft-fork (change of rules), which has been done more thanΒ once.
A couple of texts on this topic: BIP 0347 and BIPΒ 360.
51% Attack
If 1 person has more than 51% of the mining power, it will be easy for him to create a second chain of blocks as he wants. In this case, he will be able to cancel transactions and rewrite the history of his spending.
But even in this case, he will not be able in any way to steal someone elseβs coins that were never on his wallet. The older the transactions that need to be rewritten, the longer and harder it will be, and there is no 100% guarantee that it will work and he will be able to make his chain longer and faster than the otherΒ 49%.
Such an attack is possible even with 30% and 40%, but the probability is muchΒ lower.
How much money will be needed for such an attack?
If we attack from scratch, then we essentially have to have a power 0.5% more than the entire power of Bitcoin miners. The hashrate today is approximately 1 ZH/s = 1,000,000,000,000,000,000,000 SHA-256 hash findings perΒ second.
Modern ASICs (mining devices) have a power of approximately 200 TH/s, meaning 5,000,000 of them will be needed. Their efficiency is β 17β20 J/TH. Multiply by 10βΉ and you get 17β20 GW. A bit less than the power of the largest hydroelectric dam in theΒ world.
To this, we add the prices for the ASICs themselves, which comes out to β $7.5 billion. Not counting extra infrastructure which will also be very expensive.
Even all these costs will lead at most to double spending of own coins in the blockchain and censorship of transactions. And even then, it will be visible to everyone and the price will probably crash and the game will not be worth theΒ candle.
If you are interested in diving deeper into WEB 3.0 technologies, subscribe to my X (x.com/Paolo3Web) where there will be more content, far from always so long, but no less interesting.
Deep Dive into Bitcoin: Answers to the Questions You Rarely Ask was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.