A blockchain is a distributed and a decentralized digital ledger that can be used to record transactions and other data across numerous computers in a peer-to-peer network. We can also define a blockchain as a distributed encrypted database like a spreadsheet that is duplicated thousands of times across a network of computers. This network is designed to regularly update this spreadsheet. It is a subset of distributed ledger technologies.
Centralized Network vs Decentralized Network
Each node is a computer(desktop, laptop, handphone, mining rig etc) that is connected to the network
A blockchain comprises a chronological chain of blocks. A block refers to a set of transactions that are bundled together and appended to the blockchain. Every node in the network stores a copy of the distributed ledgers, or a chain of blocks, as shown in the figure below.
A block in the blockchain primarily consists of four pieces of metadata, as follows:
- The reference to the previous block
- The proof of work, also known as a nonce
- The timestamp
- The Merkle tree root for the transactions included in the block.
What is Proof of work?
On the Bitcoin blockchain network, the miner nodes bundle unconfirmed and valid transactions into a block. Each block contains a given number of transactions. In the Bitcoin network, every miner must solve a cryptographic puzzle to propose the next block. This process is known as ‘proof of work’. Proof-of-work is a mechanism that existed before the first blockchain was created. It prevents abuses by requiring a certain amount of computing work. That amount of work is key to prevent spamming and tampering. Spamming is no longer worth it if it requires a lot of computing power.
What is Timestamping?
Timestamping is an important feature of blockchain technology. Each block is timestamped, with each new block referring to the previous block using the cryptographic hash. Combined with cryptographic hashes, this timestamped chain of blocks provides an immutable record of all transactions in the blockchain, as
Notice that the hash and the previous hash must be the same.
What is Hash?
A hash or hash value is the result of a hash function. A hash function
A hash value comprises a 256 bits(64 characters) random letters and numbers , as follows: “4373c7fb1437035365d9228c77eca2cfd240523e274163e78c1eba11effd8b38”.
A hash has the following properties
- A given input has a precisely predictable output of a specified length, usually, but not necessarily much shorter than the input.
- Even if the input is only slightly changed, the output differs dramatically.
- If the hash function is of the cryptographic variety, it is very difficult, if not practically impossible, to infer the original input, given only the output. The degree of difficulty/impossibility depends on the strength of the encryption used.
Hashes are used to represent the current state of the blockchain. The input is the entire state of the blockchain. It means all the transactions that have taken place so far and the resulting output hash represents the current state of the blockchain. The hash is used to agree between all parties that the state is the same.
Hash is for validation purpose. Data on the blockchain is “hashed” in each block. Each block is linked with the previous bock via the hash value. If
What is a Digital Signature?
Digital signatures, like real signatures, are a way to prove that somebody is who they say they are, except that we use cryptography or math, which is more secure than handwritten signatures that can be easily forged. A digital signature is a way to prove that a message originates from a specific person and no one else, like a hacker.
Digital signatures are used today all over the Internet. Whenever you visit a website, you are using SSL, which uses digital signatures to establish trust between you and the server. This means that when you visit Facebook.com, your browser can check the digital signature that came with the web page to verify that it indeed originated from Facebook and not some hacker.
Generating a key pair is analogous to creating an account on the blockchain, but without having to actually register anywhere. Besides that, every transaction that is executed on the blockchain is digitally signed by the sender using their private key. This signature ensures that only the owner of the account can move money out of the account.
The Role of Hashing and Digital Signature in Blockchain
To bring it all together, blockchain could not exist without hashing and digital signatures. Hashing provides a way for everyone on the blockchain to agree on the current world state, while digital signatures provide a way to ensure that all transactions are only made by the rightful owners. We rely on these two properties to ensure that the blockchain has not been corrupted or compromised.