The Ultimate Guide To Understanding Blockchain Transactions (Part 1)

Dung Dinh
Dung Dinh
Feb 6 · 8 min read

The essence of a blockchain is to create a secure environment for network participants to safely carry out transactions. These transactions are then recorded within the distributed ledger, which is shared to all participants of the network.

The entire blockchain architecture exists to make sure that transactions once verified, cannot be altered in any way. This singular ledger that records all the transactions in a network has the potential for a wide range of applications.

What is a Transaction?

Alot of mention has been made of the word “transaction”. If one were to go online as well, there are also tons of references being made to this same word whenever blockchain technology is being discussed.

In actual fact, a transaction is a common enough term in digital technology and it always has to do with some form of data exchange.

For example, when trying to read an article on Wikipedia, the user attempts to connect to the Wikipedia link. In actual fact, the user’s computer being the client is trying to establish a connection with the Wikipedia server in order to gain access to that article.

When the connection is successfully made, the information appears on a screen and a transaction is said to have taken place. This is a digital transaction at its most basic level.

With this sort of understanding in mind, the reader can begin to appreciate just how diverse digital transactions can be once viewed in the context of data exchange between at least two nodes.

Inblockchain technology, a transaction is a database on which the encrypted digital asset transfer (or group of assets transfer) is recorded upon. In a blockchain, participants are regularly transferring digital assets and these digital assets could potentially be anything from cryptocurrencies like Bitcoin, to contract milestones, etc.

Such is the power of the blockchain that individuals, organizations, and even governments now have the ability to introduce trustless authentication and verification for a host of transactions. The fact that these transactions are encrypted, provides a level of security that is unmatched by anything that exists today.

Blockchain Transaction Lifecycle

There is a process that every transaction must undergo from when it is initiated to when it is validated and becomes a part of the blockchain. This process is described by the blockchain transaction lifecycle. In each of the known blockchains available today, there are many subtle differences in this process.

In this section, a simplified approximation of the process will be presented to enable the reader to get a fair idea of the steps involved in the process. For the purpose of this description, a transaction will be carried out on a hypothetical blockchain using a hypothetical cryptocurrency called Satocoin.

The transaction is being carried out by a girl named Lulu who wants to buy a sweater from an online store. Remember that a cryptocurrency is the native digital currency of a blockchain or blockchain-based application.

While browsing for sweaters online, Lulu comes across a sweater she likes and clicks the “buy now” button which takes her to the payment page. She chooses Satocoin as her payment option and she inputs her public key to initiate the payment.

Now the Satocoin blockchain network must verify that she has enough Sato- coin in her wallet to afford the sweater, which by the way, costs 20 Satocoin.

The stages this transaction will pass through are as follows:

•Initiation:

Once Lulu clicks the “buy now” button and proceeds to enter in her wallet information, the transaction is said to have been initiated. Lulu signs this transaction using her public-private key combination.

She does this by entering her public key during the payment process. This initiated transaction that has been signed is now ready for broadcast and propagation.

•Pre-Validation Broadcast & Propagation:

Nodes within the network discover Lulu’s transaction and carry out checks to ascertain its validity. These checks involve examining the data structure within the transaction and once it is deemed valid it is propagated to the entire network.

By a process called “flooding”, this propagated transaction becomes accessible to more nodes within the network. This process is rapid, ensuring that in a few seconds, every node in the network has received the new transaction.

•Validation:

As more nodes receive the transaction, its validation becomes more established. As each node validates the transaction, it propagates it further within the network.

This ensures that an invalid transaction doesn’t become deeply propagated within the network, wasting computing power in the process. Once the transaction has been validated, it sits in the transaction pool (memory pool) where it waits to be grouped with other transactions into a block on its way to the verification process (mining).

The Blockchain Transaction Verification Process

This process describes the means by which a validated transaction is verified, in order for it to become a part of the blockchain ledger. In many blockchains applications, this process is referred to as “mining”.

It is the termination of the transaction lifecycle during which the transaction becomes recorded in a block on the blockchain.

It is important to note that not all blockchains have a mining process but for the purpose of this section, the focus will be limited to blockchains in which the verification of transactions is via a block mining process.

The Ultimate Guide To Understanding Blockchain Transactions (Part 2)

What is Blockchain Mining?

Mining is another of those terms that one hears repeatedly in the blockchain space.

The literal understanding of the word itself applies to a part of what the process achieves, in that it leads to the creation (“mining”) of new coins in the blockchain.

A coin is the generic term used to describe a cryptocurrency. In a blockchain network, mining refers to the process by which a transaction block is verified and added as a block on the blockchain.

This process also leads to the creation of new coins which are given as a reward to the node that successfully “mines” the block.

In some blockchains, there is no reward for mining the block as the mining receives a transaction fee. In any case, there is always some form of reward (or incentive) for mining nodes in a blockchain network.

Most mining processes are based on cryptographic hashing, where mathematical computations are used to solve the complex mathematical algorithms that make up the block header parameters. Recall, that block headers contain a cryptographic hash.

Imagine this hash to be like a complex math problem requiring a solution. It is the job of the mining node to discover the unique solution to this problem in order to verify the block. The blockchain is coded in a way that makes this solution difficult to obtain yet easy to verify by other nodes.

Blockchain mining helps to maintain the structural integrity of the blockchain. With so many nodes working independently, it can be difficult to ensure uniformity of process but mining solves this process easily by introducing mathematical proofs which are a universal language.

Steps Involved in Verifying a Blockchain Transaction

Remember Lulu’s transaction? Having been validated, it now sits in something called the memory pool where it will await the authentication of a mining node.

The memory pool (or transaction pool) is a place in the blockchain environment where all the validated transactions temporarily reside while waiting for authentication by mining nodes during the mining process.

The verification process for transactions in a blockchain is also a step-wise process.

Different blockchains utilize diverse mathematical proofs but the focus will be given to the proof-of-work algorithm in this section. This is the mining algorithm used by Bitcoin. The steps are as follows.

•Identification

Mining nodes search the memory pool, looking for unconfirmed transactions. One of them will come across Lulu’s transaction, alongside a group of other unconfirmed transactions. These transactions are then aggregated into something called a “candidate block”. The candidate block is an aggregation of data structures (transactions) into a single block for mining.

•Computation

This is where the cryptographic hashing process takes place. Mining nodes will seek to find a solution for the proof-of-work algorithm of the candidate block that contains Lulu’s transaction.

This action is being carried out simultaneously by numerous mining nodes on the blockchain. All of them race against each other to arrive at the solution first so that they can claim the reward.

The basic principle in the computation stage is to obtain a value that is less than that of a specific target. Part of the architecture of the blockchain specifies a target that is unique for every candidate block. During the mining process, a mining node has to arrive at a value that is less than this specific target.

Only then can the block be said to have been mined. Think of this specific target to be a picture puzzle. Only by fitting the pieces together can the puzzle be completed. Using hashing techniques, mining nodes will perform multiple trial and error computations using something called “nonce values” until a solution for the proof-of-work algorithm is obtained.

The common hash function used by most blockchains that favor the proof-of-work algorithm is the SHA256 hashing function. During the trial and error hashing process, when a nonce value does not produce a value that is less than that of the specific target value, it is modified.

After modification, the process is repeated until the block header value of the candidate block becomes less than that of the specific target.

Depending on the computing power of the mining hardware being utilized, as many as 1 quadrillion trial and error attempts might be required before the correct nonce value is arrived at. For this reason, a considerable amount of computing power and electricity is utilized by large mining node setups.

•Broadcast

A mining node will eventually be successful in finding the solution to the proof-of-work algorithm for the candidate block that contains Lulu’s transaction. Once this happens, the mining node will broadcast it to the entire network for others to verify.

The verification process involves examining the proof-of-work solution to make sure that it is indeed of a lower value than that of the target. There are also some other checks that are carried out to ascertain the validity of the solution.

The way blockchains are built, the mining process is a complex one but the process of verifying the work done by miners is actually simple and straightforward.

The complexity of the mining operation adds a robust fidelity component to the network while the ease of verifying drastically speeds up transaction lag times. This is one of the many ingenious aspects of blockchain technology that makes it such a revolutionary concept.

•Majority Consensus

At this stage, the mined candidate block containing Lulu’s transaction is being broadcast throughout the entire network.

Other nodes review the solution to see if it is correct. With each successful validation by peer nodes, a distributed consensus begins to develop as these peer nodes add the mined candidate block to their local copy of the blockchain.

Soon, this distributed consensus becomes a majority consensus and the candidate block becomes a legitimate block on the blockchain.

•Addition

Once the majority consensus is formed, the mined candidate block becomes a verified block and it will now reside permanently on the blockchain.

At any time, participants in the network can examine the block and they will find Lulu’s 20 Satocoin payment. The successful mining node also receives a reward for being able to mine the block.

Source: Indrek Lasn

Written by

Dung Dinh

More From Medium

Top on Medium

Ed Yong
Mar 25 · 22 min read

16.5K

Top on Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade