An Introduction to Bitcoin

Salem Alqahtani
8 min readMay 12, 2020

--

Bitcoin is a decentralized digital currency that can be sent from user to user on the P2P network without the need for intermediaries. The core technique of Bitcoin transactions are messages, which are digitally signed using cryptography and sent to the entire Bitcoin network for verification. Bitcoin becomes the first byzantine fault tolerant that is opened and distributed over P2P network.

Blockchain is a new type of storage providing trust between users, developers, and the platform itself. Bitcoin is an asynchronous network and works over the internet. An adversary cannot delay the transactions effectively if the adversary does not control the majority of the hash power. The transaction will eventually be included in the blockchain if the adversary did not control 51% of the hash power.

Bitcoins transactions are processed to verify their integrity, authenticity, and correctness by a group of resourceful network nodes called miners. In particular, instead of mining a single transaction, the miners bundle a number of transactions that are waiting for the network to get processed in a single unit called block. The miner advertises a block in the whole network as soon as it completes its processing in order to claim the mining reward. This block is then verified by the nodes in the network before it is successfully added in blockchain. The miner who mines a block receives a reward when the mined block is successfully added into the blockchain.

Bitcoin enables consensus among an open, decentralized group of nodes. All nodes compete in a leader-election lottery, and the node that wins block by finding the solution to a hash puzzle. The miner will add the next block to the blockchain, and informs all other miners to stop mining for that block. Due to Bitcoin probabilistic leader election process combined with performance fluctuations in a decentralized network, Bitcoin offers only weak consistency. In Bitcoin, different nodes might end up having different views of the blockchain leading to forks. Blockchain suffers from a poor performance which cannot be remedied without fundamental redesign.

POW consumes a huge amount of energy and does not required a set up for public key (PKI). Bitcoin requires only linear number of messages. When a miner finds a block, it starts working on it. Miners should have an ASIC to join a mining pool. You can see, this is a kind of centralization. Bitcoin systems create and compute the block and then have POW on the block. Blockchain advantages are immutability and decentralization. All transactions are digitally signed. Bitcoin complexity is determined by the number of zeros at the prefix.

POW is a simple search process where a node tries many nonce values until the miner gets an acceptable solution. To verify the block, the node simply just has to try one value: the block that the miner provided. So, it uses the same test but it does not search; as a result, it does very little work.

Very careful engineering has been required to make sure that the handling of unconfirmed transactions cannot accidentally cause invalid blocks to pass. This especially is a concern because complications like locktimes and soft-forks can make the validity of a transaction some what conditional; however, in the latest software, the only real validation needed at block time of an already seen transaction is the locktimes and double spending checks.

Each full-node checks the validity of blocks. Checking the validity of a block is indeed done by repeating all steps of building that block and checking for adherence to all consensus rules. If a block infringes any rule, a full-node will consider the block invalid. The full-node will ignore the block, and ban the node that sent it to the full-node from its peers for 24 hours for sending invalid information. As each miner should be running a full-node to stay abreast of the current blockchain-tip, either all miners or no miners should consider a block valid (as long as they are in agreement on the consensus rules that apply).

When I say that PoW is synchronous I mean that its safety depends on an synchrony. Specifically, PoW inherently assumes that the propagation delay of new blocks is less than a known upper bound (e.g., ten minutes in Botcoin). What happens if this assumption is violated? Then safety might be compromised. The security of Bitcoin heavily relies on the incentive compatible PoW based distributed consensus protocol, which is run by miners. In exchange for the incentive, the miners are expected to honestly maintain the blockchain. In Bitcoin, POW calculated after computing the block.

Bitcoin use transactions to move coins from one user wallet to another. The destination address (also called Bitcoin address) is generated by performing a series of irreversible cryptographic hashing operations on the user’s public key. In Bitcoin, a user can have multiple addresses by generating multiple public keys and these addresses could be associated with one or more of user wallets the in the form of digitally signed transactions.

Basically, the transaction is the owner of coins. Transferring the coin to the next is done by singing a hash of previous transaction and a public key of the next owner of the coin. The payee has to verify (see the figure below) the signature in order to verify the ownership. The payee cannot verify the double spending of someone who wants to double spending. Only coin issue by the mint is trusted not to be double spending. Here it is still not solving a third-party. We need to be aware of all the transactions to confirm the absence of the transactions. All transaction must be announced for all parties and have to agree on a single history of the order of which they received.

Satoshi solution starts with a timestamp server. First, take the hash of a block of items to be time stamped and publish the hash. The timestamp proof the existence of data in order to get into the hash. Every timestamp includes the previous timestamp in its hash. This will form what normally called a chain. Each additional has reinforced the one before it. It is my conclusion that it is a distributed decentralized clock, and the Bitcoin paper generally agrees to refer to it as a “timestamp server”.

POW conceptually like affixing a postage stamp to a message, but rather than paying for that stamp using money, you are basically paying for that stamp via CPU cycles. POW protocol works relatively to a given challenge string. The minor of the work will basically try to come up with a corresponding proof that is tied to this challenge string. It is kind of response associated with this challenge. It has a very specific mathematical property in relation to this challenge. The challenge is a very specific to the task at hand. POW happens through miners trying to solve exceptionally difficult math problems. Finding a solution is basically a guessing game, but checking if a solution is correct is easy. Miners are not able to cheat the system because it takes real world resources to work out these solutions. But this also implies that POW is extremely inefficient in term of energy, these real world resources used to mine are computers and electricity and it takes a lot of power to run the computers, or clusters of computers, that calculate different potential solutions to solve the blocks and therefore also very expensive, obviously not desirable for a network whose goal is to minimize the need to trust third parties. Nonce is increment until give the blocks hash the requred zero bits.

Digital signature is a mathmatical analog of human signature. Node will broadcast the transaction for all other nodes in the P2P system. Other parties will receive the signature and they will check and verify the transaction. Minor listen to all transactions and compile them in transaction block. In the block there is a spcial number meant to minor themselves. It contain previous encoding of previous transaction block. sequence of number POW. solution of double spending? to have massive timestamp server slash ledger. that literally logs everything and everyone is made aware of this broadcast to each other and longest version of this is the accepted one as its you know the longest in the newest and it also will be CPU most sup.

The steps to run the network are as follows:
1- New transactions are broadcast to all nodes.
2- Each node collects new transactions into a block.
3- Each node works on finding a difficult POW for its block.
4- When a node finds a POW, it broadcasts the block to all nodes.
5- Nodes accept the block only if all transactions in it are valid and not already spent.
6- Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

The hard part about running a decentralized network is keeping the nodes in agreement without a controlling authority. This is important: different node in the network can and frequently do find a different POW for a given block, resulting in two competing branches to blockchain. Other nodes in the network will keep adding blocks to one of the two versions until eventually one branch pulls ahead and becomes longer. At this point, the shorter branch is discarded, and we are back to one blockchain again.

Part of the genius of BTC is that even a purely selfish actor is incentivized to support the network, rather than act against it. The only way new BTC are created is as a reward for finding the hash value of a new block of transactions (beginning with a string of zeroes). This is the principle of mining.

Hash transactions are hashed by using Merkle Tree with the only root of hash including in the block’s hash. A block header with no transaction is 80 bytes. Per year we have 6*24*365*80 = 4.2 MB per year. So, headers should not be a problem if they kept in memory.

It is possible to verify payments without running a full network node. A user only needs to keep a copy of the block headers of the longest proof-of-work chain, which he can get by querying network nodes until he’s convinced he has the longest chain, and obtain the Merkle branch linking the transaction to the block it’s timestamped in. He can’t check the transaction for himself, but by linking it to a place in the chain, he can see that a network node has accepted it, and blocks added after it further confirms the network has accepted it.

This part is tricky to grasp. To make up the exact sum of a bitcoin transaction, there are two options: either a higher value chunk of bitcoin in your wallet is broken in two, or smaller chunks are combined to make a higher amount, with some change left over.

In a sense it is like buying something with cash in a store: if you want to buy $13 of groceries, you might give the clerk $10 and three single bills to make the total, or you might hand over a $20 bill and get $7 change. The difference with bitcoin is that your change is always lumped in a single amount as if it were a $7 bill. So if your regular wallet was like a bitcoin wallet, it would be filled with notes of irregular values $2.65, $51.03, $0.02, and so on and you’d have to combine these to buy something, receiving another irregular sum of money in change.

Kind of self-explanatory, we can split the value of a bitcoin and combine the values of different bitcoins to trade them. Just like paper money, let us pretend we buy something for $8. We can have several bills to complete a sum (multiple inputs: two bills of $5 to make $10) and the returning change (One output: $2 )

Transactions in the network are public, but identities are kept apart from the transaction and the value. According to the level of anonymity that the user wants to have, he/she will have as many public keys (addresses) as transactions made to avoid being related to the operations.

--

--