Software patches, upgrades, and new releases are typical for an application whenever software development wants or needs. Releases can occur regularly or irregularly depending on when and what functionality is being deployed. Hence, agile development methodologies can be adopted both pre and post-release.
Firmwares are embedded into the hardware. It is not feasible for the Firmware to update or patch whenever firmware development wants. Special hardware/software and physical machine or access are typically required to update or patch Firmware. For example, if your washing machine needs a firmware upgrade, it is not practical to drag it to the local appliance store to be re-flashed. Due to the permanent nature of Blockchain, Smart Contracts are like firmware, not software. As with any other transaction stored on a Blockchain, a Smart Contract deployed to it is permanently stored and cannot be changed.
The new version of the Contract can be released to sit alongside the old ones, but the old ones can never be deleted. A published Smart Contract can never be upgraded or patched. Instead, a new Smart Contract can be created and published, but the old one will remain forever on the Blockchain.
Here, the Kill Function or a Self-destruction function can help. The Smart Contract’s old version may have a particular function that enables a Smart Contract to be “killed”. A killed Smart Contract will refuse any new transaction, although it exists. Kill function does NOT delete the Contract but puts the Smart Contract in dormant mode.
Kill function must be used very carefully and with great caution. It must be ensured that the correct people and circumstances can call the function. The Contract holds millions of dollars; malicious attackers may destroy by evoking the kill function. DO NOT take the decision to implement a kill or self-destruct function lightly!
With the advancement of blockchain technology over the past few years, it can be divided into multiple categories with distinct and sometimes partially overlapping attributes.
Since blockchain is a relatively new technology, many people use it interchangeably with cryptocurrency or digital currency. The main reason for this is that the first and most famous application of blockchain technology was Bitcoin, the first decentralized digital cryptocurrency.
You know about blockchain technology, but are you familiar with all of the types?
Before categorizing blockchain technology, we need to understand Distributed Ledger’s distinction from the blockchain.
The term distributed ledger corresponds to a shared database, so all blockchains can be considered distributed ledgers or shared databases. Even though all distributed ledgers are fundamentally blockchains, all blockchains are not necessarily distributed ledgers.
A distributed ledger does not always consist of blocks of transactions, which is what differentiates it from a blockchain. In fact, a blockchain consists of blocks of transactions and is a special type of shared database. An example of a distributed ledger that does not use blocks of transactions is R3’s Corda.
Distributed Ledger Technology (DLT) covers a wide range of distributed ledger technologies, including blockchains and distributed ledgers of all kinds.
Fig.
Public Blockchain
Public blockchains are not owned by anyone. Nodes on a public blockchain can participate in the decision-making process. Participants may or may not receive rewards. The users of these “permissionless” or “un-permissioned” ledgers keep a copy of the ledger on their local machines and use a distributed consensus mechanism to decide the eventual state of the ledger.
Private / Consortium Blockchain
Unlike public blockchains, private blockchains are just that – private. The ledgers are only available to a consortium or group of individuals or organizations that have decided to share the ledger among themselves. Kadena and Quorum are examples of that.
Semi-private Blockchains
Semi-private blockchains have parts that are private and parts that are public. In a semi-private blockchain, the private part is controlled by a group of individuals, while the public part can be accessed by anyone.
Sidechains
The sidechain is a blockchain that is separate from the main bitcoin blockchain but is attached to it. By attached we mean that the sidechains are linked to, and derive their security from, the main Bitcoin blockchain. In this way, a second chain is created with a special purpose. The new blockchain is called a sidechain, because it’s secondary to the main chain. A good example is Bitcoin’s Lightning Network. Lightning Network is a sidechain that allows Bitcoin to scale. It works by using sidechains to create payments that are off-chain. There are two types of sidechains: A. A sidechain that is pegged to the Bitcoin blockchain, such that for every Bitcoin that moves there will be an equal amount on the sidechain in a 1:1 relationship. B. A sidechain that is not pegged to the Bitcoin blockchain, but the value of the sidechain is dependent on the value of the Bitcoin blockchain such that the bitcoin blockchain is the anchor to the sidechain.
Permissioned Ledger
A permissioned ledger is a distributed ledger where the participants are trusted. The technology is based on the idea that blockchain can provide a new kind of trustworthy and secure consensus mechanism to manage transactions. Permissioned ledgers can also be considered as the decentralized version of traditional databases. The difference between a permissioned ledger and a database is that the latter is a centralized system where only one entity controls access to the information in the database. On the contrary, in a permissioned ledger, all the participants have equal access to the same information. In this sense, a permissioned ledger is decentralized and permissionless at the same time.
Conclusion:
You have probably come across Bitcoin, Ethereum, and other cryptocurrencies when you think about blockchain technology. However, Blockchain, the decentralized ledger technology that underpins cryptocurrency, has a much broader application. Transactions are recorded in a distributed, tamper-proof ledger called a blockchain. It can be used for everything from financial applications to supply chain management. Blockchain will become the primary means of storing data in the coming years. It is a technology that will change how we work, shop, and socialize.
There’s no denying the hype around blockchain technology. But for anyone who wants to get ahead of the game, here’s what they need to know about blockchain in order to capitalize on this groundbreaking new trend.
Blockchain is the technology behind Bitcoin taking into consideration as an example. It’s a decentralized digital ledger of all transactions that happen across the internet. It’s the backbone of the cryptocurrency industry, and it’s been hailed as a potential game-changer for how people and businesses interact with each other. It’s the latest buzzword to enter the technology realm, and here’s everything you need to know about blockchain and why you should be paying attention.
But what exactly is blockchain? Here are 7 things you need to know.
How does it work?
Essentially, a blockchain encrypts information in such a way that it cannot be altered, hacked, or cheated. The blockchain serves as a digital ledger of transactions that is duplicated and distributed across the entire network of computer systems. It is a secure, open-source, distributed database used to keep track of who owns what, and who owes whom. Databases and lists of records are referred to as blocks, and they are cryptographically linked together.
Fig-1 – BlockChain
The first block in the chain is called Genesis Block, whose previous block hash is zero.
The work of Stuart Haber and W. Scott Stornetta from 1991 on How to Time-Stamp a Digital Document and their follow-up paper Improving the Efficiency and Reliability of Digital Time-Stamping introduced the idea of a chain of hashes to create a total order of commitments to a dynamically growing set of documents.
Cryptography – How SHA256 Hash Works
Our fingerprints are unique to each individual, as we all know. It is highly unlikely that two individuals will have identical fingerprints. It cannot be denied, however, that 1 in 60 million people have a similar fingerprint. In this respect, a fingerprint is considered to be the unique identifier of a person. As a matter of fact, it is used by forensic personnel to identify criminals.
Is there any possibility of attaching some type of unique identification to digital assets to make them identifiable?
One idea for using a digital fingerprint is SHA256, developed by the NSA. SHA-256 is a cryptographic hash function that produces a value of 256 bits. SHA – Secure Hash Algorithm and 256 stands for 256 bits taken in the hash. Hash is always 64 characters long. 64 characters are hexadecimal (numbers from 0 to 9 and letters A to F).
What is a cryptographic hash function? Any function that maps arbitrary data (text, video, audio, any kind of digital assets of any length or you can put whole operating system) to a fixed-size value can be called a hash function – a fingerprint. This is the core principle used in the Blockchain.
The following linked video and a demo is a very basic visual explanation of the principles behind a blockchain: https://andersbrownworth.com/blockchain/hash
There are 5 requirements of the SHA256 hash algorithm and these are:
1. One-way: The conversion from digital asset to hash must be one-way.
Fig-2 Hash
This means that the original copy cannot be recreated or restored or reverse Engineer using the hash function. As with fingerprints, no one can recreate a person using its fingerprint.
2. Deterministic: Every time it generates a hash for the same digital asset, it should be the same.
3. It must have fast computation.
4. The Avalanche Effect: It means that, even if a small change is made to the document, the hash will change completely. It is implemented in this manner in the algorithm. A small change may have a significant impact on the algorithm’s output.
5. It must withstand collision: Similar to the case of fingerprint, that 1 in 60 million may have the same fingerprint. There may be a chance that two arbitrary documents may have the same hash function. It is because 64-character combinations are still limited while the creation of digital assets is limitless. Therefore, it is likely at some point that a collision will occur. This is called the pigeon hole principle.
Fig-3 – pigeonhole
“In mathematics, the pigeonhole principle states that if {\displaystyle n} items are put into {\displaystyle m} containers, with {\displaystyle n>m}, then at least one container must contain more than one item.” Wikipedia. It must be possible for the algorithm to handle it even though it is very rare.
Refer to chapter 1 of the below-linked book for more details on the SHA256 Hash Algorithm.
Immutable means “impervious to change.” Ledger is a fancy term for the record, which refers to something recorded. In other words, an immutable ledger is a record that cannot be altered.
We can trust digital data in the digital age if the data is secure and hasn’t been altered.
When tracking money transactions, trust and proof of trust are very significant. Let’s say you sent me an e-funds transfer of $100 without any proof that you did so and without any way to verify that you did so. When the money showed up, I would believe you, and if it did not show up–what then?
Banks and credit card companies use ledgers to keep track of transactions. Can we trust them? If we do not wish to hand over our money to a large corporation, bank, or government, what can we do?
Blockchain technology introduced the concept of the Immutable Ledger. Mathematics underlies this concept. Knowing it can’t be altered or changed, you put your trust in that math.
What does the blockchain do to ensure its immutability? The hash is its foundation. Hashes are like digital signatures, and if a hacker tampers with the ledger, its hash will change.
The blockchain will reject the hash if it no longer matches the previous hash in the ledger, making it null and void like a bad check.
Fig-4 – BlockChain-hack
It means that the hacker would have to change the next block, the one after that, and the entire blockchain itself.
Distributed P2P Network
A distributed peer-to-peer network is one where every participating node is equal and independent. This means no single entity can control the network or the resources of the network. In addition, it enables participating users to make money by sharing the processing power and storage capacity of their systems with other users in need. The user with excess processing power can rent it out to users who have a specific job he or she cannot accomplish alone.
Decentralization of network able to lends itself to different applications and services such as distributed storage and bandwidth, digital content distribution, cryptocurrencies, prediction markets, and much more.
Blockchain is distributed network technology where everyone has a copy of all the transactions blocks, which is stored in every node. The data on these blocks is encrypted and shared among all of the participating peers. In fact, everyone has access to a copy of the entire network and is able to see who owns what. The transactional records cannot be changed retrospectively without altering all subsequent blocks and collusion of the network. All of the transaction data is stored in a decentralized fashion, without a single point of failure. Such Peer-to-peer sharing of information directly between peers without the involvement of a central third party makes a P2P network.
It is important to understand the difference between “distributed” and “decentralized”.
“distributed” means that not all transactions are processed in the same place, while “decentralized” means that no single entity controls the entire process.
I tell my friends that I am considering a number between one and 100, and on a paper, I write the number and seal it inside an envelope.
There’s no need for my friends to guess the exact number; just that they must be the first to guess any number lower than or equal to the one I am thinking of. It does not matter how many guesses they get. Let me say that I am thinking of the number 19. If Frіеnd A guеѕѕеѕ 21, they lоѕе bесаuѕе оf 21 is greater than 19. If Frіеnd B guesses 16 and Friend C guеѕѕеѕ 12, then they have both thеоrеtісаllу аrrіvеd аt vіаblе аnѕwеrѕ, because of 16<19 and 12<19. Thеrе is no “еxtrа сrеdіt” for Frіеnd B; even thоugh B’ѕ аnѕwеr was closer to thе target аnѕwеr оf 19.
Nоw imagine that I роѕе the guess whаt number I am thinking? But this time I am nоt asking just three frіеndѕ, аnd I am nоt thіnkіng оf a number bеtwееn 1 аnd 100. Rаthеr, I am asking millions оf wоuld bе mіnеrѕ, and I am thinking оf a 64-dіgіt hexadecimal numbеr. Do you believe that іt iѕ gоіng tо bе extremely hаrd tо guеѕѕ?
Comparing to above аnаlоgу, where thе number 19 оn a ріесе of рареr іn a sealed envelope, in bitcoin mining tеrmѕ, thаt metaphorical undisclosed numbеr іn the envelope іѕ called thе tаrgеt hаѕh – 64 Digit Hexadecimal Number.
Whаt Iѕ a “64-Digit Hеxаdесіmаl Numbеr? The following Hexadecimal number is any example оf such a numbеr: 0000000000000000057fсс708сf0130d95е27с5819203е9f967ас56е4df598ее The numbеr above hаѕ 64 dіgіtѕ.
Mіnеrѕ are dоіng wіth those massive computers аnd dоzеnѕ оf сооlіng fаnѕ is guеѕѕіng аt thе tаrgеt hаѕh. Mіnеrѕ makes these guеѕѕеѕ by randomly gеnеrаtіng as many “nоnсеѕ” аѕ “роѕѕіblе, as fаѕt аѕ possible.
A nоnсе іѕ short fоr “numbеr оnlу used оnсе,” and thе nоnсе is the kеу tо gеnеrаtіng thеѕе 64-bit hеxаdесіmаl numbеrѕ. In Bitcoin mіnіng, a nonce іѕ 32 bіtѕ іn ѕіzе—muсh smaller thаn thе hash, which іѕ 256 bits. Thе fіrѕt mіnеr whоѕе nonce gеnеrаtеѕ a hаѕh thаt іѕ lеѕѕ thаn оr еԛuаl tо thе target hаѕh іѕ аwаrdеd сrеdіt fоr соmрlеtіng thаt block and is аwаrdеd.
Byzantine Fault Tolerance
To illustrate how a group of Byzantine generals could have communication problems when trying to decide on their next move, the Byzantine Generals’ Problem was devised in 1982.
The generals have their own armies, and each army is positioned at different locations around the city they plan to capture. They must decide whether to attack or retreat. If all generals reach a consensus, i.e., agree on a common decision that will be executed in coordination, it does not matter if they attack or retreat.
Now there are the following requirements:
Decisions must be made by generals regarding attacking or retreating (yes or no);
Once a decision is made, it cannot be changed;
All generals must agree upon a synchronized decision.
Generals are only able to communicate with each other through messages sent through couriers, which creates communication problems. Byzantine Generals’ Problems are characterized by the fact that the messages can get delayed, lost or destroyed.
A message may also be delivered successfully, but a general may decide (for whatever reason) to send a fraudulent message to confuse other generals, leading to a total failure.
With blockchains, each general represents a node in the network, and the nodes must agree on the current state of the system is before the general can move forward. As another way of putting it, when a distributed network operates, the majority of the participants must agree on the same action and execute it.
Therefore, the only way to achieve consensus in a distributed system is by having at least ⅔ or more reliable and honest network nodes. This means that if most of the network decides to act maliciously, the system is prone to failures and attacks (such as the 51% attack).
Consensus Protocol
Blockchain consensus protocols are the rules that govern what constitutes valid transactions on a distributed ledger. In other words, they define what the “consensus” is around any given set of transactions. They are a critical component of blockchain technology because they determine whether or not a transaction is valid. Blockchains operate based on consensus rather than a central authority. This means that any participating node can create a block and contribute it to the chain. Instead of having a central authority that authenticates transactions, blockchains use consensus algorithms to determine which transactions are allowed to enter into the ledger. The miners secure consensus algorithms, and the miners are compensated by earning transaction fees or new coins. The two main consensus algorithms are Proof of Work and Proof of Stake. The create of the original blockchain, Bitcoin, invented the “Proof of Work” consensus algorithm. Ethereum is currently a PoW blockchain.
Conclusion
In conclusion, blockchain technology is already being used by more than 1,000 organizations across various industries. It is predicted to disrupt almost every industry in the next few years. However, many people still don’t understand what blockchain is, how it works, and why it is such a game-changer.
A “solidity contract” is different from a “product” or “service” contract. What makes a solidity contract different is that it resides on the Ethereum blockchain. On the blockchain, all transactions are permanent and cannot be reversed. Once I sign the contract, I cannot back out of it and deliver the money to you because then there would be no record of the transaction on the blockchain. Also, since everything is on the blockchain, the money you give me can never be stolen by hackers. All these factors combine to make a “solidity.
A Solidity contract consists of functions, data, and states, which reside on the Ethereum blockchain at a specific address.
A “function” is simply an action or a task. For example, in the case of the solidity contract, one function of the contract is to display the current temperature in Los Angeles. Another function of the contract could be to display the date. And, another function could be to record a person’s birthdate. All these are examples of “functions.” Functions can be made as complex or as simple as required. In the previous example of the solidity contract, we had only two functions. However, if you are working on a more complex project, you could have tens or hundreds of functions in your contract.
The term “data” refers to any information that can be input into a computer. The data for the previous example of the solidity contract would be the name of the city, the name of the weather station, the date, the time, and the current temperature in that specific location.
A “state” is simply a condition or a status of something. A condition is a state-related to a specific condition or a state when it relates to one particular condition. In the previous example, the current temperature, the state of the weather at a specific location was recorded.
Classes in object-oriented languages can compare solidity contracts to classes in object-oriented languages. Every contract consists of:
1. Declarations of State Variables, 2. Functions, 3. Function Modifiers, 4. Events, 5. Errors, 6. Struct Types and 7. Enum Types. A contract may also inherit features from another contract. Furthermore, a special type of contract exists known as a library or an interface.