Rendering Blockchain Immutability in Chatserver: A Nodejs Approach
Rendering Blockchain Immutability in Chatserver: A Nodejs Approach
NodeJs Approach.
1. Introduction
The amount of digital data has reached staggering amounts globally. A recent report
claims that 90% of the world’s data was generated over the past 2 years (Brandtzæg,
2013). In the era of AI, ML and Big Data this data is constantly being generated,
stored and processed, the data being at the core of any decision making calls for
serious data breaches. Centralized organizations, both public and private sector,
collect huge amounts of sensitive personal data and information. Data has been an
inseparable part of global headlines lately, the most famous being the Facebook-
Cambridge Analytica Scam (Solon, 2018). The data breach scam caused a global
outcry and the people questioned the amount of control they have over their sensitive
information. WannaCry Ransomware, another famous incident covered extensively
by the public media, infected millions of computers globally (Jones, 2017).
Cybercriminals are getting more active and more competent by the day whereas for
people and organizations, the odds have never been higher. Today, data has become
one of the most valuable assets of an economy (Economist, 2017) and its protection is
a necessity. The security of data even in chat trails need to incorporate immutability,
as the use case in defence may apply were the trails are valuable when debriefs are
carried out.
This paper contains seven sections, Section-1, “Introduction” describe the
organization of the paper. Section-2, “Blockchain” section describes features and
presents a brief analysis of the Blockchain. Section-2, “Blockchain Security”
highlights the security features with some demonstration. Section-4, “Node.js” section
explores Node.js as the platform for Blockchain implementation. Section-5,
“Chatserver” section of the paper demonstrates how Blockchain can be used in
implementation of the Chatserver. Section-6, “Blockchain use-case”: Chatserver
evaluates the relevance of immutability during communication between Client and
Server.
2. Blockchain
Features of a Blockchain:
3. Each node receives a replica of all transactions.
4. All nodes intercept fresh transactions into block.
5. Every node seeks to evolve a consensus for its block.
6. If a node encounters a consensus, it transmits it to every node on the
network.
7. All transactions are evaluated for their validity and subsequently committed.
(Fig 7)
8. Upon validation of the Hash values the Nodes render their acceptance by
appending it as the next block.
9. Blockchain security
Blockchain uses the concept of distributed ledger to increase its security. Third parties
and Central Organizations validate transactions through their own servers with only a
small knowledge of legitimacy but in a Blockchain environment, a P2P network of
nodes functioning on the same Blockchain protocol do all the legitimate work and
through consensus or Majority vote. Consensus uses Smart Contracts to maintain
legitimacy.
The above components are elucidated in detail in the Node.js code snippet.
10. Node.js
This class represents a block in the Blockchain. It has 2 member functions namely
constructor and calculate hash. Constructor has index, timestamp, data and previous
hash as parameters. Index represents the address of the block. The timestamp contains
information related to when the block was created. Data can contain any information
a user wishes to secure by uploading it on the Blockchain. The previous hash
parameter stores the hash value of the previous block except in the case of genesis
block where the hash value is NULL. The calculate hash function calculates the hash
value for the current block using SHA256 encryption module.
The code snippet in Fig 5 demonstrates the consensus aspect of Blockchain and
distributed ledgers, this code shall be executed to verify the validity of the block, only
if found valid will it be added to the chain. The Consensus algorithm of either POW
or POS shall of course be embedded for detailed implementation of the Blockchain.
The above Fig 7 illustrates blocks in a Blockchain. The first block, namely Genesis
block has an index value of ‘0’ implying that it is the first in the chain of blocks. The
previous hash of the Genesis block is “0000” further asserting the fact that it is indeed
the first block as the previous hash cannot be zero except in the case of the first block
in the Blockchain. The Genesis block also contains a hash value that can be verified
by everyone present on the Blockchain. The next block has an “index” value equal to
‘1’ implying that it is the second block in the chain. Its previous hash parameter
contains the exact same hash value of the previous (Genesis) block.
The Fig 8 shows the code snippet of a block creation process for sake of
demonstration. The addBlock function is called only when the receiver is receiving
the sender’s message. The code will be changed in fully fledged application as per the
need of the application.
This section of the paper emphasizes that the chat server approach through block
chain and be effectively used in any confidential environments, typically where the
trail of communication is determined to be immutable. The trail is modified at any
future representation should lead to an alarm and the associating management bodies
should take a cognizance.
13. Conclusion
This paper has explored the architecture of a typical Blockchain whereby the
components of a block have been elaborated with a purpose of implementing the same
through the Node JS approach. The immutability aspect of a Blockchain is the key
feature for acceptability in all business environments where security and privacy is
the main concern.
2. Node.js https://nodejs.org/en/
5. Brandtzæg, P. B. (2013, May 22). Big Data, for better or worse: 90% of
world's data generated over last two years. Retrieved from Science Daily:
https://www.sciencedaily.com/releases/2013/05/130522085217.htm
7. Jones, S. (2017, May 14). Global alert to prepare for fresh cyber-attacks.
Retrieved from Financial Times: https://www.ft.com/content/bb4dda38-
389f-11e7-821a-6027b8a20f23
9. Solon, O. (2018, April 4). Facebook says Cambridge Analytica may have
gained 37m more users' data. Retrieved from The Guardian:
https://www.theguardian.com/technology/2018/apr/04/facebook-cambridge-
analytica-user-data-latest-more-than-thought