Mastering Ethereum
上QQ阅读APP看书,第一时间看更新

Infrastructure layer

Below the application layer, there is the infrastructure layer that provides a set of lower-level utilities to interact more closely with the blockchain. Things such as decentralized storage, peer-to-peer (P2P) real-time messaging, and Ethereum clients.

The following diagram shows what the infrastructure layer contains:

Because the blockchain is built on top of a P2P network where nodes interact with each other directly, we can take advantage of messaging utilities such as Whisper and PyDevp2p:

  • Whisper: This is a protocol maintained by the core Ethereum developers that you can use on your own dApps to send almost instant messages between apps. It's great for encrypted chat-like application, since you only exchange hashes.
  • PyDevp2p: This is a similar tool that works directly with the DEVP2P protocol to exchange messages without waiting for blocks to confirm transactions. It's fully written in Python, so it's great for personal projects connecting to Ethereum directly.

In this layer, you also have access to decentralized storage, which essentially allows you to keep your data on the blockchain without restrictions. This protocol is pretty similar to torrent, where large files are exchanged directly between peers.

The most popular storages that work with Ethereum are IPFS and Swarm:

  • Swarm: This is a decentralized storage built on top of Ethereum that is maintained by the core developers. With it, you can create decentralized applications that have the capacity to upload specific types of data while getting a hash with your content. The way it works is simple; a user uploads some files to swarm while keeping them online for other users and whenever someone else wants to get some of those files, he simply has to download it directly from the uploader without having to ask for permission. It provides a fault-tolerant system that is similar to the way the internet works, but without the centralization. This fact forces users to keep their content alive by themselves, which could become a problem when this technology starts gaining massive traction by general internet users.
  • InterPlanetary File System (IPFS): This, on the other hand, is almost identical to Swarm when it comes to having a decentralized protocol to store large amounts of data, including files, between users, with some notable differences. First of all, IPFS is focusing on removing redundancy from their network. You see, one of the problems with decentralized storage is the fact that you will have a great deal of identical copies from different nodes.

When you have the same file on different computers with different processing times, you have no choice but to choose the one that's fastest every time. You also don't know for sure whether the file that you're downloading from the network is actually what is says it is or not. It could contain malicious software full of malware. To solve that, IPFS provides a GitHub-like system where each specific file has a unique identifier. If two files have the exact same content, meaning that they are identical, they will have the exact same hash.

That is great, because it gives people a guarantee that they are getting the valid content without any modifications. It also increases the availability of the network so that you can reliably get the right file from many different providers. IPFS is still a work in progress and it's developing a coin that will be used to reward users for keeping files alive on the network.

Finally, we have the clients that work on top of Ethereum. This is the software that is directly used to mine and download the public Ethereum chain. The core Ethereum developers made sure that they provided a wide variety of similar clients so that people can choose which one fits their best interest openly, so that there isn't a monopoly of software that is forced onto people with all the centralization that it entails.

These are the main clients, although there are many more written in different languages and maintained by different organizations:

  • Geth: This is the most popular client written in Go language, popular because of its simplicity. You can use it to download the main blockchain, mine with your CPU, deploy contracts, and interact with them, create Ethereum accounts, and many more functions that are interesting to the general Ethereum developer. It provides a command line interface where you can quickly have access to all the functions.
  • Parity: This is a bigger client created by one of the co-founders of Ethereum and written in Rust, which is similar to C++ in syntax while leaning toward security in every aspect of it. Parity provides you with a command line and web interface that you can use to create accounts, download the blockchain, and deploy smart contracts, among many other tasks. Parity is famous for creating the multi-signature wallet, which is a smart contract that helps organizations reach decisions when dealing with funds and voting since all of the members have to agree on each decision being made.

Alternatively, you have clients written in Python, C++, and other languages that you can use for your personal projects. The choice is yours, so make sure that you check all of them for a better understanding of what each client can do for you.