Distributed vs. Decentralized

The blockchain is decentralized — but what does that mean? What’s the difference between distributed and decentralized?

For those who have heard of permissioned / permissionless blockchain have to bare with me at the moment till we get there little later in this blog.

A distributed system is a collection of nodes, with no shared memory between them and communicate with each other via message passing over a network. An important characteristic in a distributed system is the time it takes to communicate between nodes (communication time or the messaging time) is not negligible compared to the time it takes to complete some meaningful computation (or the event computational time) in a single node.

A decentralized system is one which requires multiple parties to make their own independent decisions. In that sense, a distributed system can be either centralized or decentralized. For example, both Facebook and Google are distributed systems, but centralized — while Bitcoin is a distributed system, which is also decentralized. Vitalik Buterin, the creator of Ethereum suggests there are actually three separate axes of centralization / decentralization.

Architectural (de)centralization — how many physical computers is a system made up of? How many of those computers can it tolerate breaking down at any single time?

— how many is a system made up of? How many of those computers can it tolerate breaking down at any single time? Political (de)centralization — how many individuals or organizations ultimately control the computers that the system is made up of?

— how many ultimately control the computers that the system is made up of? Logical (de)centralization — does the interface and data structures that the system presents and maintains look more like a single monolithic object, or an amorphous swarm?

As per the above categorization, blockchains are politically decentralized (no one controls them) and architecturally decentralized (no infrastructural central point of failure) but they are logically centralized (there is one commonly agreed state and the system behaves like a single computer). Languages are logically decentralized; the English spoken between Alice and Bob and the English spoken between Charlie and David do not need to agree at all. There is no centralized infrastructure required for a language to exist, and the rules of English grammar are not created or controlled by any one single person.

Immutability

Just as in a linked list, blockchain consists of blocks, where it starts with a genesis block, and each block since then, links to the block prior to it. Each block has it’s own hash and the hash of the block prior to it. Given a block, you can traverse back to the genesis block. Each block has a set of transactions in it — and once written to the blockchain, it is hard to change anything in the written block. Since all the later blocks are linked to this block, if you are to change a block, you also need to change all the other blocks written on top of it, till the very latest. When you change a block, it changes the hash of it — and since this block is referred by the hash, from the next block, then you need to update the previous block field of that block — then again, it will change the hash of that block and the story continues. The distributed consensus algorithm (which we discuss in the next section) followed by each blockchain implementation, makes this merely impossible both technically and economically.

Distributed Consensus

Blockchain is a decentralized system with no single authority to trust, but maintains a commonly agreed state between all the nodes in the network. This common state is maintained via a distributed consensus. Each blockchain has its own distributed consensus algorithm, which defines who can write to the blockchain, and what rules to be followed and the rules for conflict resolution. Bitcoin is an implementation of blockchain, ethereum is another implementation — both of them do have their own distributed consensus algorithm.

Both bitcoin and ethereum follow, proof-of-work as their distributed consensus algorithm. Ethereum, with it’s Serenity release, plans to move to the proof-of-stake algorithm. These are the two most popular, discussed consensus algorithms. There are few more. Hyperledger Fabric, a blockchain implementation by the Hyperledger project under the Linux Foundation uses practical byzantine fault tolerance (PBFT) distributed consensus algorithm — but then again it’s pluggable. You can plugin your own consensus algorithm to Hyperledger Fabric. Sovrin ledger another blockchain implementation by the Hyperledger project under the Linux Foundation uses plenum as its consensus algorithm. The plenum protocol is an enhancement of the redundant byzantine fault tolerance (RBFT) protocol. Couple of days back , on 14th September, the Sovrin Foundation announced the launch of the provisional Sovrin Network, the world’s first truly self-sovereign digital identity system based on Sovrin ledger. Ripple and Stellar two blockchain based payment protocols use federated byzantine agreement. IntelLedger, a blockchain platform developed by Intel (now open source) uses proof of elapsed time as it consensus algorithm. Corda, a blockchain implementation by R3, uses it’s own algorithm.

We’ll be discussing about most of the above projects in the part — II of this blog series. The bottom line is, blockchain has walked miles away from bitcoin — based on the core concepts introduced by Satoshi Nakamoto. Blockchain is no more synonymous to bitcoin. For any reader who wants to have a good understanding of distributed consensus algorithms, I would recommend looking at this white paper.

Proof-of-Work

Proof of work, is the distributed consensus algorithm behind the Bitcoin blockchain, and with some variations followed by Ethereum, NameCoin, LiteCoin, DodgeCoin and Monero blockchains. Under the proof-of-work algorithm no miner can add a block to the blockchain without a proper proof of work. The work here is to find a nonce, once added into the block header, the complete hash of the header falls under a given number. So — the nonce is the proof. Finding this nonce value to match the given number is a computationally very expensive process. There is no shortcut — you need to guess a nonce value, calculate the hash of the complete block header (with the nonce) and repeat it with different nonce values till you get the right hash. How quickly you can find this magic number will depend on how many hashes your computer can generate per second (or the hash power). Also note that the difficulty of this number will change with time.

The proof-of-work algorithm produces a set of computationally intensive operations. One study found that the electricity wasted in bitcoin mining is comparable to the average electricity consumption of Ireland. Bitcoin mining based on proof-of-work no more an option on commodity hardware. Most of the miners use ASICs (Application Specific Integrated Circuits) to produce high hash rates. ASIC is an integrated circuit (IC) customized for a particular use, rather than intended for general-purpose use. Since use of ASIC is not affordable to everyone, this could lead us into mining centralization. At the moment two mining rigs in China, owns more than 50% of the bitcoin mining power.

Proof of work idea did exist way before bitcoin. It was originally published by Cynthia Dwork and Moni Naor back in 1993, but the term “proof of work” was coined by Markus Jakobsson and Ari Juels in a document published in 1999.

To mine a block under bitcoin, takes around 10 minutes. This is a hard coded value in the bitcoin mining client. If the average speed of mining in the last 2016 blocks is less than 10 minutes — then the difficulty level to calculate the nonce will be increased. In case — the average is below 10 minutes, then the difficulty level will be decreased for the next 2016 blocks. The difficulty level is reevaluated after every 2016 blocks, that’s roughly after every 2 weeks.

Ethereum in its current version (homestead), uses its own proof-of-work algorithm called, Ethash. Ethash provides fast confirmation times and builds ASIC resistance to counter mining centralization. The Ethash algorithm relies on a pseudorandom dataset, initialized by the current blockchain length. This is called a DAG, and is regenerated every 30,000 blocks (or every ~5 days). The DAG will continue to grow in size as the blockchain grows. Two important design principles behind Ethash are, IO saturation and GPU friendliness. The algorithm consumes nearly the entire available memory access bandwidth (this is a strategy toward achieving ASIC resistance, the argument being that commodity RAM, especially in GPUs, is much closer to the theoretical optimum than commodity computing capacity) Also it tries to make it as easy as possible to mine with GPUs. Targeting CPUs is almost certainly impossible, as potential specialization gains are too great, and there do exist criticisms of CPU-friendly algorithms that they are vulnerable to botnets, so Ethash targets GPUs as a compromise.

For any reader who wants to have an in depth understanding of Ethash, I would recommend looking at here and here.

Proof-of-Stake

Proof of stake consensus algorithm is the most discussed one after the proof of work. It is designed to overcome the massive amount of wastage in electricity, resulted from proof-of-work mining. Ethereum is planning to move a head with proof of stake distributed consensus from the Serenity release on wards. Its proof of stake algorithm is called Casper. The basic idea behind proof of stake algorithm is, if you own more cryptocurrency (say ether), you get more opportunity mine. So, rather than spending $10,000 to buy the processing power to mine ether, you can use that amount to buy ether, and increase your stake. The rationale behind proof of stake is, more you own, less you want to destroy the network or do any harm.

Proof of stake first idea was suggested on the bitcointalk forum back in 2011, but the first digital currency to use this method was Peercoin in 2012, together with ShadowCash, Nxt, BlackCoin, NuShares/NuBits, Qora and Nav Coin.

At a high-level, this is how Casper works. First, whoever wants to be a miner needs to keep a security deposit of ether, as defined by the protocol. These nodes are known as bonded validators and maintained by a special smart contract called, Casper contract. Each validator is pseudo-randomly selected to produce a block from the active validator set, with the probability of selection linearly weighted by each validator’s deposit. If a validator is offline, a different validator is selected and this process repeats until an online validator is found that creates a block. If a validator produces a block that gets included in the chain, they receive a block reward equal to the total ether in the active validator set. If the validator produces a block that does not get included in the chain, the protocol works such that the validator loses the security deposit equal to the block reward. This mechanism proposes to solve the Nothing-at-Stake problem where it stop nodes from producing blocks that won’t get included in the main chain. For anyone keen on reading more about proof of stake, I would recommend going through this.

Byzantine Generals Problem

Let’s imagine we have an enemy camp in a valley surrounded by two army forces. You can beat the enemy only if both the army forces attacked at the same time, otherwise enemy is powerful enough to beat individual army forces. The two army forces are placed at the opposite side of the valley on two mountains. They had communicated nothing before. Now the challenge is, how do they agree upon a date and a time to attack the enemy. Only way to send a message from one camp to the other is across the valley, where the enemy is having the control. In other words you are trying to pass a message over an untrusted channel — and trying to preserve its integrity. This is a hard problem to solve in distributed computing. The messenger first has to go pass the valley to the other camp with the proposed date/time — and then come back to the first camp with the confirmation. Enemy camp can catch the messenger and change the confirmation. If the second army camp rejected to attack at the proposed time, then the enemy will change it to accepted. So, the first army camp will execute the attack, but not the second one and will loose the battle. If the second army camp accepted the proposed time, then the enemy camp will change it to rejected. So, the second army camp will execute the attack, but not the first one and will loose the battle. Also, one of the Army generals can be a traitor — so passes a misleading message to the other party.

In summary, the problem consists of trying to agree on a course of action or the state of a system by exchanging information over an unreliable and potentially compromised network. Bitcoin is the first to solve this with it’s distributed consensus algorithm, which uses the concept of proof-of-work to achieve consensus without a central trusted authority, represents a breakthrough in distributed computing and has wide applicability beyond currency. It can be used to achieve consensus on decentralized networks to prove the fairness of elections, lotteries, asset registries, digital notarization, and more.

Double Spending Problem

With paper currency, double spending is almost impossible. You would need complex machinery and material to print copies of the same note — or to produce forged notes. But with digital currency, you just need one command to copy and produce multiple copies of the same currency. Most of the cryptocurrencies prior to bitcoin, introduced a central trusted authority to validate transactions. Bitcoin is the first cryptocurrency which solved the double spending problem in a completely decentralized manner.

The central trusted authority is used by previous cryptocurrencies to avoid double spending. Since it’s central, it knows about all the transactions happen in the network. So, it can block any double spending transactions. How about let every node in the network know about each and every transaction? That removes the need of having a centralized transaction ledger. Now, each node can independently verify each transaction it receives. But this does not solve the ‘trust’ problem. If none of those are not trusted how do we trust the transaction ledger each one of them maintain. This is where the distributed consensus algorithm comes into play. Each node can update it’s copy of the ledger with the transactions (grouped into a block) — then broadcasts the block to the rest of the nodes in the network — and each node will independently verify the block, and update their copy of the ledger. Due to the globally distributed nature of the network there can be cases different ledgers under different nodes are out of sync. The system itself resolves this conflict by sticking to the longest blockchain in the network. Let’s say I am working (mining) on the block 3000 — now I receive a block with the identifier 3006. That means my blockchain is 6 blocks behind the longest blockchain (known to me) in the network. So, I have to update my copy to the longest chain. If you are interested in learning more about how this works in bitcoin, I recommend reading this.

CAP Theorem

CAP theorem in distributed computing states that no distributed system can satisfy consistency, availability and partition tolerance, all three properties together — but only any two out of three. Consistency means, the state of the system across all the nodes is consistent. When you write to one node and read from another — it will produce the same or the latest version of what you wrote. Availability means the system should respond to your queries with a reasonable response time. Partition tolerance means, the system should behave as normal, even after the system is partitioned. In a partitioned system, one partition cannot see what’s happening in the other.

Most of the relational database systems (Oracle, MySQL, MSSQL, etc) focus on consistency and availability, NoSQL systems like Cassandra, CouchDB, DynamoDB focus on availability and partition tolerance, while BigTable, MongoDB, HBase focus on partition tolerance and consistency.

In bitcoin (and most of the blockchain based cryptocurrencies) consistency means, each node maintains a copy of the distributed ledger shares the same state. Availability means, the bitcoin network is ready to accept transactions at any given point. Partition tolerance means, the network tolerates communication or whatever the failures in the nodes of the bitcoin network and functions as normal. Bitcoin clearly addresses availability and partition tolerance concerns — but there are two schools of thoughts on how bitcoin supports consistency. Some argue bitcoin is an eventually consistence system, while the rest argue it provides strong consistency. Here is a good summary of the discussion — and you may also be interested in checking out this and this.

Selfish Mining

As I explained in the previous section, once you mine a block, you need to broadcast it as soon as possible to the rest of the nodes in the network. Selfish miners won’t do that. They will continue mining without broadcasting — and at some point they will broadcast a set of blocks together. The selfish miner only publishes their blocks when the network has caught up to the point where the honest miners are one block behind the selfish miner.

Selfish mining can produce undesirable consequences for the rest of the network. Because a successful selfish mining attack occurs when the selfish miner releases a set of blocks that form a longer chain than the chain created by the rest of the network. This will make all the other miners to give up their own blockchain and join the longest blockchain of the selfish miner. All the blocks they created since the last sync point will be orphan blocks. An orphan block is a block added to the blockchain first as a confirmed block, but later after some time discovers it’s not in the longest chain. This is the reason why in bitcoin, it is told, you need to wait at least for 6 confirmations to accept a transaction as valid. That is, wait for another 6 blocks to be mined on top of the block which carries your transaction.Whenever there is an orphan block, there is a potential for negative consequences, so a process that creates more orphan blocks can harm the viability of bitcoin as a method of making transactions. Also, this will have an economic impact on miners. The only way miners could be profitable is after confirming a block mined by them on the blockchain. Under bitcoin, they will receive a reward in bitcoin, and same happens under ethereum with ether. But, when you discover the block you mined is not in the longest blockchain, you will also loose the reward, though in ethereum you will still receive some portion of the original blocks. In ethereum these are known as uncle blocks, not as orphan blocks.

Practically to execute selfish mining in the bitcoin network, you need to have a considerable processing power over other nodes. There have been BIPS (Bitcoin Improvement Proposals), to lower the probability of a selfish mining attack such as randomly assigning miners to various branches when a fork occurs — or alternatively providing a threshold limit to which a mining pool can reach. A further solution is to discriminate against a block depending on the timestamp it was released — so if a miner releases a long list of blocks in one shot — then the rest of the network would weight their validity against the timestamp they were hashed and the timestamp they were reported to the network.

If you are interested in learning more about selfish mining and some techniques to detect those, I recommend reading this.

Sybil Attack

The sybil attack in computer security is an attack wherein a reputation system is subverted by forging identities in peer-to-peer networks. It is named after the subject of the book Sybil, a case study of a woman diagnosed with dissociative identity disorder. In bitcoin or in any blockchain based system, its about gaining control of many number of mining nodes. The distributed consensus algorithm of bitcoin, makes this merely impossible — both from the technical and economical perspectives. Only possibility of executing such attack in the bitcoin network is by gaining more than 50% of the total hashing power of the network. This is also known as 51% attack.

Proof-of-work algorithm based mining in bitcoin is theoretically vulnerable to the 51% attack. This can be resulted in, one mining rig getting more than 50% of the mining power of the total bitcoin network. So it has more control over the Bitcoin network. I’ve explained 51% attack, in detail in this blog post, also if you are interested in learning more about 51% attack, I recommend reading this.

Permissioned/Permissionless

Most of the initial blockchain implementations are permissionless — public blockchains. For example, Bitcoin, Ethereum, NameCoin, LiteCoin, DodgeCoin and Monero, all are permissionless blockchains. In a permissionless blockchain, anyone can write to it — and anyone can read it. Who is eligible to write is decided by the corresponding distributed consensus algorithm.

Permissioned blockchains can be public or private. For example, Hyperledger Fabric, R3 Cord are private, permissioned blockchain implementation, while Sovrin Ledger is a public permissioned blockchain. In a permissioned blockchain, the trust is not completely decentralized — one party decides who can write to the blockchain. If it is private, then not all can even read the records from the blockchain. In a public permissioned blockchain, anyone can read. Permissioned blockchains immensely reduce the cost of the consensus protocol.

Smart Contracts

Smart contracts are the business rules running in a blockchain. In bitcoin, you can write these rules in a language called, script — which is stack-based — means that each data, input or output is put on a stack of other data. Bitcoin’s support for smart contracts is very limited. You can say, a given transaction can be claimed by an entity who can prove the possession of the public key corresponding to the provided hash of the public key in the script. This is how pay-to-public-key-hash transactions work in bitcoin. Also — multi signature transactions in bitcoin is done with a similar kind of script, where you can say, to claim a transaction 2 out of 3 signatures are required. Also — you can time lock transaction outputs with a script — that means you will not be able to claim that transaction output till the specified date.

Ethereum has more comprehensive support for smart contracts. You can write ethereum smart contracts in a language called Solidity. It’s a turing complete language. You can represent very complex business logic in an ethereum smart contract. Hyperledger Fabric has it’s own smart contracts — which is known as chain-code. This can be written in Java/Go and other programming languages and supposed to be run inside a docker container.

Smart contracts are executed independently by each mining node in the network at the point of validating transactions. Keep in mind that, how powerful the language you use to write smart contracts, you cannot do external calls while running a smart contract. If it relies on external data sources, then the end result of executing the same smart contract in different nodes will be different. You need to pass all the data it requires to execute a smart contract, in the transaction itself. An in-depth discussion about smart contracts is out of the scope of this blog, probably will write one on it later — or still there are plenty of resources out there on the web to learn about smart contracts.

Sidechains

A sidechain enables bitcoins and other ledger assets to be transferred between multiple blockchains. This gives users access to new and innovative cryptocurrency systems using the assets they already own. For example, Rootstock (RSK) is a smart contract platform that is connected to the bitcoin blockchain through sidechain technology. Although the smart contracts aren’t actually deployed on the bitcoin blockchain itself, RSK allows users to send bitcoin directly onto the rootstock chain, which are then converted into smart bitcoins on the rootstock blockchain. These RSK coins can be used to deploy or to interact with smart contracts on the RSK blockchain. These smart contracts on RSK are written in Solidity, which is compatible with the smart contracts running on ethereum. This makes bitcoin more powerful — and extends it’s functionality from just being a p2p digital cash system. You can read more about Rootstock from here.

By reusing bitcoin’s currency, these systems can more easily interoperate with each other and with bitcoin, avoiding the liquidity shortages and market fluctuations associated with new currencies. Since sidechains are separate systems, technical and economic innovation is not hindered. Despite bidirectional transferability between bitcoin and sidechains, they are isolated: in the case of a cryptographic break (or malicious design) in a sidechain, the damage is entirely confined to the sidechain itself. If you are interested in learning more about sidechains, I recommend reading this.

Merged Mining

Mining is the process of validating the transactions as per the rules defined in the corresponding blockchain implementation, build a block and then update the blockchain. Most of the cases miners will be offered a reward for mining — but not all the time. For example, Sovrin ledger offers no rewards for its miners. Merge mining allows to mine multiple crypto currencies together and write the blocks to the corresponding blockchain implementations. Rootstock and namecoin do merged mining with bitcoin, dogecoin does merged mining with litecoin. Merged mining can only be achieved once there are multiple currencies using the same algorithm. In the bitcoin example, it is possible to merged mine namecoin, rootstock and a few other coins which use the same SHA-256 algorithm. You can read more about merged mining from here.

Scalability

Scalability is the most concern in public permissionless blockchain implementations. Bitcoin blockchain can only process 3 to 7 transactions per second, while ethereum can only process around 10 to 15 transactions. Bitcoin, which is supposed to be a p2p digital cash system never comparable with the amount of transactions processed by VISA, PayPal or other payment systems. For example, VISA handles around 2000 transactions per second on average. Bitcoin’s transaction limits are enforced by the protocol itself. For example, it has a limit on the size of the block, which is set to 1000KB (~1MB) — and then again, the protocol itself sets difficulty level to maintain the time gap between two blocks to 10minutes. Let’s see what’s the reason behind these hard coded values. Bitcoin is a globally distributed network — there are around 5000–8000 mining nodes in the bitcoin network. To make sure all the blocks in the network are in sync, a block must traverse through all the nodes. If the block size is larger, then due to the delays caused by network bandwidth, it may take more time to sync all the nodes — so, the block size is picked as 1 MB. Then again, if blocks are mined quite frequently by different nodes in the network, still only one will be able to get into the blockchain. The rest will result in as orphan blocks — and also will create forks much frequently, which is not quite good — unnecessary wastage of resources. Because of that 10 minutes is picked as the block time by Satoshi, as a tradeoff between first confirmation time and the amount of work wasted due to chain splits (forks). SegWit/SegWit2/Lightening Network are three proposals brought into improve bitcoin scalability.

SegWit

On average a bitcoin block contains around 1000 transactions. If we can reduce the size of a transaction — then we can accommodate more transactions in a block. This is what is proposed by SegWit (Segregation of Witness). Each bitcoin transaction input has a script attached to it. These scripts are used to unlock outputs (from previous transactions) referred from the inputs from this transaction. Each script includes a signature to prove the possession of the corresponding public key. The signature itself is the witness. Scripts contribute to more than 50% to 75% of the size of a transaction. SegWit removes these scripts from the bitcoin transactions stored in blockchain — which nearly doubles the number of transactions that can be stored in a bitcoin block. SegWit was activated on bitcoin network on 23rd Aug 2017.

To learn more of SegWit, I would recommend you reading the Appendix D of Mastering Bitcoin 2nd Edition by Andreas M. Antonopoulos. This chapter is available on SafariBooksOnline too.

Transaction Malleability

In bitcoin, the transaction id is the hash of the transaction itself. The hash of the transaction includes the signature scripts too. One could change the orientation of the script, without invalidating the transaction — to change the hash of the transaction, hence the transaction id. This is known as transaction malleability.

What is the impact of transaction malleability? When you do a bitcoin transaction via a coin exchange (say, Coinbase, Poloniex, Kraken) it keeps track of those transactions with the transaction id, against your account. Once the transaction is broadcasted to the network, an attacker can copy it, and just change the orientation of the script tags to change the transaction id. Now, in the network there are two similar transactions with the same inputs and outputs — but with two different transaction ids. If the modified transaction gets into a block, before the original one, then the original one will get rejected as a double spending transaction. Now, the coin exchange has no proof to show it’s transaction went through — and will loose coins.

Segwit also fixes the transaction malleability. Since SegWit removes script tags from the transaction, script tags are not included in the hash of it — hence no impact on the transaction id. You cannot change anything else in the transaction, with the intention of altering the hash, because the integrity of the rest is protected by the signature. For those who interested in learning more about transaction malleability, I would recommend reading this.

Lightening Network

The lightening network is the most promising approach to address the bitcoin scalability problem and micropayments. In summary, lightning network provides a highly scalable solution that you can do thousands of bitcoin payments in a second. The way this happens is first the payer and the payee should establish a payment channel between those two, or find a payment route through other lightening network nodes. Lightning network exists out side the bitcoin network. Before you establish a payment channel, you first need to do a transaction in the bitcoin network. This is treated as a security deposit. Once that is done, all the payments happen outside the bitcoin network (the aggregated amount should be less than what’s in the security deposit) — and once everything is completed the last transaction from the payment channel is posted to the bitcoin network — and will close the payment channel.

The approach suggested by lightning network is not viable with the transaction malleability threat. Now, with the SegWit activation on the bitcoin network, lightning network is ready to go. Recently the lightning network was activated on the LiteCoin network. In this and this tweets by Charlie Lee, the creator of LiteCoin cryptocurrency — about the readiness of the LiteCoin network to support Lightning Network and the very first LiteCoin Lightening Network payment.

For those who are interested in learning more about the Lightning Network check this, this and this out. Also the chapter — 12 of Mastering Bitcoin 2nd Edition by Andreas M. Antonopoulos talks about the Lightning Network. This chapter is available on SafariBooksOnline too.

Sharding

Sharding is a solution developed by ethereum developers to address its scalability concerns. Generally speaking, a sharding is a type of database partitioning that separates very large databases the into smaller, faster, more easily managed parts called data shards. The word shard means a small part of a whole.

In ethereum the support for proof of stake (which we discussed before) is a pre-requisite to implement sharding. The validators (or miners) of each shard will only work within that shard. Instead of having one global state, seen by all the nodes, you split the state into chunks, which you call as shards. Or in other words, each shard will have its own state. A merkel tree will be built with all the states in each shard and finally the merkel root will represent the global state. Sharding approach in ethereum also proposes a way to cross-shard communication. You can find more in depth details about sharding here. Also, the ethereum creator Vitalik Buterin explains sharding in this devcon talk.

P2P Network

All of the blockchain implementations introduce their own p2p network to communicate between the nodes in each network. In permissionless blockchain implementation there are no special nodes — each of them carry the same responsibilities and the same level of trust. Once a transaction is verified by a mining node it broadcasts it to all the other mining nodes in the network, and each node will independently verify. Each mining node runs a mining software. The bitcoin p2p network runs over TCP and has a random topology, where each node peers with other random nodes. A new node can join the network anytime. It can first connect to an active node, which it already knows and then discovers other nodes in the network. This known active node is also known as a seed node — and there are various mechanisms to find a seed node. For example, the mining software knows about a set of DNS seeds (seed.bitcoin.sipa.be, dnsseed.bluematt.me, dnsseed.bitcoin.dashjr.org, seed.bitcoinstats.com, seed.bitcoin.jonasschnelli.ch, seed.btc.petertodd.org) — and doing a nslookup will return a set of IP addresses of available seed nodes.

Once one mining node hears about a bitcoin transaction, it validates it and then publishes it to all the nodes its aware of. The same thing will be repeated by all the mining nodes in the bitcoin network and ultimately all the nodes in the bitcoin network will be aware of this transaction. This happens through a simple flooding algorithm, sometimes called a gossip protocol.

Peer-to-peer communications between nodes running ethereum clients run using the underlying ÐΞVp2p Wire Protocol. You can read further details from here and here. The Hyperledger Fabric, an open source blockchain implementation under the Linux foundation uses Google RPC for its p2p communication.

Summary

This is the part-I of a series of blogs (three parts), that I will walk you through the innovation happens in the domain of identity, with respect to the adaptation of blockchain technologies, and discuss the impact of it to the rest of the world. This blog covers the key fundamentals of blockchain. In the part — II we will explore identity/naming systems built around blockchain.