The blockchain serves as an immutable ledger which allows transactions to take place in a decentralized manner. Blockchain-based applications are springing up, covering numerous ﬁelds including ﬁnancial services, reputation system and Internet of Things (IoT) and so on. Let us understand through this blog how does Blockchain Architecture work.
Overview of Blockchain Architecture
Blockchain systems can seem complex; however, they can be easily understood by examining each component technology individually. At a high level, blockchains utilize well-known computer science mechanisms (linked lists, distributed networking) as well as cryptographic primitives (hashing, digital signatures, public/private keys) mixed with financial concepts (such as ledgers).
An important component of the blockchain technology is the use of cryptographic hash functions for many operations, such as hashing the content of a block.
Hashing is a method of calculating a relatively unique fixed-size output (called a message digest, or just digest) for
an inputof nearly any size (e.g., a file, some text, or an image). Even the smallest change of input (e.g., a single bit) will result in a completely different output digest.
Hash algorithms are designed to be one-way (known as being preimage resistant): it is computationally infeasible to find any input that maps to any pre-specified output. If a particular output is desired, many inputs must be tried by passing them through the hash function until
an inputis found that produces the desired result. Hash algorithms are also designed to be collision resistant (known as second preimage resistant): it is computationally infeasible to find two or more inputs that produce the same output.
A transaction is a recording of a transfer of assets (digital currency, units of inventory, etc.) between parties. An analog to this would be a record in a checking account for each time money was deposited or withdrawn. Each block in a blockchain architecture contains multiple transactions.
- Amount – The total amount of the digital asset to transfer.
- Inputs – A list of the digital assets to be transferred (their total value equals the amount). Note that each digital asset is uniquely identified and may have different values from other assets. However, assets cannot be added or removed from existing digital assets. Instead, digital assets can be split into multiple new digital assets (each with lesser value) or combined to form fewer new digital assets (each with
a correspondinglygreater value).
- Outputs – The accounts that will be the recipients of the digital assets. Each output specifies the value to be transferred to the new owner(s), the identity of the new owner(s) and a set of conditions the new owners must meet to receive that value. If the digital assets provided are more than required, the extra funds are returned to the sender (this is a mechanism to “make
- Transaction ID/Hash – A unique identifier for each transaction. Some blockchains use an ID and others take a hash of the specific transaction as a unique identifier
- Asymmetric-Key Cryptography
A fundamental technology utilized by blockchain technologies is asymmetric-key cryptography (also referred to as public/private key cryptography). Asymmetric-key cryptography uses a pair of keys: a public key and a private key that are mathematically related to each other.
The public key may be made public without reducing the security of the process, but the private key must remain secret if the data is to retain its cryptographic protection. Even though there is a relationship between the two keys, the private key cannot efficiently be determined based on knowledge of the public key.
Asymmetric key cryptography uses the different keys of the key pair for specific functions, dependent on which service is to be provided. For example, when digitally signing data, the cryptographic algorithm utilizes the private key to sign. The signature can then be verified using the corresponding public key.
- Addresses and Address Derivation
A user’s address is a short, alphanumeric string derived from the user’s public key using a hash function, along with some additional data (used to detect errors). Addresses are used to send and receive digital assets. Most blockchain systems make use of addresses as the “to” and “from” endpoints in a transaction.
A ledger is a collection of transactions. Throughout history, pen and paper ledgers have been used to keep track of the exchange of goods and services. More recently, ledgers have been stored digitally, often in large databases owned and operated solely by centralized “trusted” third parties on behalf of a community of users (i.e., the third party is the owner of the ledger).
Users may submit candidate transactions to the ledger by sending these transactions to some of the nodes participating in the blockchain. Submitted transactions are propagated to the other nodes in the network (but this by itself does not include the transaction in the blockchain). The distributed transactions then wait in a queue, or transaction pool, until they are added to the blockchain by a mining node.
- Chaining Blocks
Blocks are chained together through each block containing the hash of the previous block’s header, thus forming the blockchain. If a previously published block were changed, it would have a different hash. This, in turn, would cause all subsequent blocks to also have different hashes since they include the hash of the previous block. This makes it possible to easily detect and reject any changes to previously published blocks.
A blockchain is simply a distributed data structure that is built linearly, over time and is independently verified and audited by all actors in the network.
In general, blockchains contain transactions packaged into blocks that are mined using significant resources and new “tokens” are created as a result of this mining.
The network-at-large cryptographically verifies that all transactions are legitimate and uses consensus rules to determine what the valid blockchain contains