Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgcardona/c42f83d4dfff3cbb9d9911e354b50219 to your computer and use it in GitHub Desktop.
Save cgcardona/c42f83d4dfff3cbb9d9911e354b50219 to your computer and use it in GitHub Desktop.

Scale Infinitely via Subnets

What is Avalanche?

Avalanche is a global financial network for the issuing and trading of all digital goods. We enable potentially millions of validators to process thousands of transactions per second with near instant finality using a protocol which is completely green and quiescent. We've paired this high throughput and fast finality protocol w/ an architecture that can meet the needs of unique financial services and decentralized apps.

We accomplish this through the notion of Subnets. Subnets allow anyone anywhere to spin up a taylor-made network w/ custom virtual machines and complex validator rulesets.

Avalanche is a network of networks. It's a platform of platforms where we invision thousands and thousands of public and private Subnets all emerging into this global marketplace which we call The Internet of Finance.

Avalanche Consensus

First off, what is consensus? If you work in the blockchain space you probably hear the word consensus a dozen times each day but what is it exactly? Consensus is the process by which a group of independent validators come into agreement on a decision. So it's that simple, how do you get a bunch of people or machines to agree on a decision. It's a very rich field of computer science that goes back at least 40 years.

Comparison Chart

Avalanche Consensus is the 3rd major paradigm in the field of consensus. The first was called Classical Consensus and it goes back to the 70s and 80s. Classical Consensus has low latency and very high throughput. It's lightweight and green. However it isn't very scalable nor robust and it performs poorly in adversarial conditions.

In 2008/2009 when Satoshi Nakamoto released Bitcoin the world was introduced to the 2nd major paradigm in the field of consensus, what ultimately became known as Nakamoto Consensus. Nakamoto Consensus is very scalable, robust and decentralized but it doesn't have low latency, as I mentioned it takes around an hour to be sure your transaction is sufficiently settled that you won't experience a reorg. It doesn't have high throughput, Bitcoin only does a handful of transaction per second. Of course I'm aware of 2nd layer solutions such as the lightning network. I'm referring to the layer 1 Bitcoin protocol and network here. It's not lightweigh or green, as I mentioned Bitcoin burns more energy each day than some nation states. Lastly, Nakamoto Consensus performs ok in adversarial conditions up to the famous 51% attack.

In 2018 a pseudonymous group going by the name "Team Rocket" released a white paper on the InterPlanetary File System, or the IPFS, describing a 3rd major paradigm shift in the field of consensus. This new breakthrough was known as Avalanche Consensus. Avalanche Consensus is the perfect storm of features from Classical and Nakamoto Consensus.

It's very scalable, robust and decentralized. There are currently around 1500 full block and vertex producing validators on the Avalanche network. The protocol theoretically enables millions of validators so it's very decentralized. Avalanche consensus has low latency with subsecond immutable and irreversible finality. There is no notion of a reorg on Avalanche. Within a literal blink of an eye your transaction has settled completely. Avalanche has high throughput with 4,500 transactions per second. It's very lightweight and green and can be run on a PC, a Macbook, a VPS droplet on the cloud and in the future on Internet of Things devices. And Avalanche consensus is parameterizable so it performs very well in adversarial conditions.

Demo

Technically Avalanche is a metastable consensus protocol inspired by epidemic protocols and gossip networks. The process used to determine whether a transaction is preferred or not is referred to as "repeated random subsampling." Here is a great demo created by our Chief Protocol Officer Ted Yin. As I mentioned, Ted was one of the creators of HotStuff, which is the classical consensus protocol behind Facebook's Libra or Diem network. He is now at Ava Labs working on Avalanche Consensus.

Here the squares represent different nodes, and the color of each square represents its current proposal. So, is this transaction blue or is orange. Briefly, it's worth noting that Avalanche consensus can handle non-binary decisions. So for example you can give it 5 options instead of 2 and it will still reach immutable and irreversible consensus. For the sake of this demo, and in most transaction related decisions we're going w/ a binary decision—blue or orange. The darkness of the color shows the node's conviction in that proposal. Does this node kind of think the decision is blue or does it really really believe the decision is blue.

When I click start each node will begin repeatedly and randomly sampling it's peers and changing it's own color and conviction based on the responses. Expectedly, all nodes will collapse to the same color in the end. You can see that it only takes a couple rounds of sampling and the entire set will tip and Avalanche into consensus. I'm going to play that again because I think it's so beautiful. It only takes a couple rounds of sampling and the entire set will tip and Avalanche into consensus.

Network of Networks

So that's Avalanche consensus, which is the 3rd major paradigm shift in the field of consensus. Next let's discuss how Avalanche is a Network of Networks. As I mentioned Avalanche is different than traditional crypto networks like bitcoin and ethereum that have 1 virtual machine and 1 set of miners or validators. Avalanche is a network of networks w/ compound network effects.

CryptoSeq Network Slide

To help visualize this I have a really great slide. Credit and shoutout to the amazing CryptoSeq. You can see the twitter handle at the bottom right. Please go follow them on twitter and check out their medium account for some incredibly deep and insightful posts on the blockchain. Thank you CryptoSeq.

Here you can see the grey oval represents the Avalanche network. Within the network are many different subnetworks or Subnets which are represented by the circles. In each of those Subnets are green squares which represent the different Virtual Machines are blockchains which are running on those Subnets. The lines between the Subnets show that you can move assets and users between the different Subnets. At the top you can see Bitcoin, Ethereum and Cosmos with lines representing the ability to bridge assets from those other networks into the Avalanche Network. Currently bridge.avax.network supports bridging assets from Ethereum into Avalanche and recently we announced that Bitcoin support is coming to the bridge soon. Since launch less than a year ago, the bridge has been used for has been used for nearly 300k transactions with around $50B in ERC-20 assets on Ethereum to be used on Avalanche. These are stunning numbers and with the addition of Bitcoin we expect that number to go up much higher.

I often say that Avalanche's Subnet architecture is primed for compound network effects and what do I mean by that? Most everyone has heard of network effects. Which technically are known as Metcalfe's Law. Metcalfe's Law says that a network's value is proportional to the square of the number of nodes in the network. For example, if a network has 10 nodes, its inherent value is 100 (10×10=100). In other words a product or service gains additional value as more people use it.

A great example of network effects is the telephone network. If only 1 person has a telephone then it's not very useful. For every additional person who plugs into the telephone network then the entire network grows in value for every other user. Perhaps the canonical example of network effects is money. If only 1 person accepts a currency then it's not very useful. For each additional person that accepts the currency then it becomes more valuable for every other user who can then use their currency for goods and services.

So that's network effects but what about compound network effects? Compount network effects are known as Reed's Law which states that the utility of large networks, particularly social networks, can scale exponentially with the size of the network as the number of possible sub-groups grows much more rapidly than either the number of participants or the number of possible pair connections. Even if the utility of groups available to be joined is very small on a per-group basis, eventually the network effect of potential group membership can dominate the overall economics of the system

Avalanche's Subnets are designed and primed for compound networks effects.

Virtual Machines

A Virtual Machine defines the application-level logic of a blockchain. In technical terms, it specifies the blockchain’s state, state transition function, transactions, and the API through which users can interact with the blockchain. Every blockchain on Avalanche is an instance of a VM.

The way to think of a VM is like a class in OOP. A class is a description or an object. It's a template from which you can instantiate as many objects as you wish. Each of these objects, though derived from a common template, are unique and logically separate entities with their own state. Similar to a class, a VM is a blueprint or template from which you can instantiate as many different instances of a blockchain as you wish. Each of these blockchains, though derived from a common template, are unique and logically separate entities with their own state.

As a developer when you write a VM, you don't need to concern yourself with lower-level logic like networking, consensus, or the structure of the blockchain. Avalanche does this behind the scenes so you can focus on the thing you would like to build.

Why VMs?

At first, blockchain networks had one Virtual Machine (VM) with a pre-defined, static set of functionality. This rigid, monolithic design limited what blockchain-based applications one could run on such networks.

People who wanted custom decentralized applications had to create their own, entirely new blockchain network from scratch. Doing so required a great deal of time and effort, offered limited security, and generally resulted in a bespoke, fragile blockchain that never got off the ground and achieved the network effects required to tip and go mainstream.

As mentioned before Ethereum made a huge step toward solving this problem with smart contracts so that developers didn’t need to worry about networking and consensus, but creating decentralized applications was still hard. The Ethereum VM has low performance and imposes restrictions on smart contract developers. Solidity and the other few languages for writing Ethereum smart contracts are unfamiliar to most programmers. They're not very expressive and they don't fit into the rest of your development workflow.

Avalanche VMs (AVMs) make it easy to define a blockchain-based decentralized application. Rather than new, limited languages like Solidity, developers can write VMs in Go and using a gRPC API you can actually write your VM in a language other than Golang as long as your VM implements a certain interface. Your blockchain can run as a separate process from AvalancheGo and can communicate with AvalancheGo over gRPC. This is enabled by rpcchainvm, a special VM that uses go-plugin and wraps another VM implementation. The C-Chain, for example, runs the Coreth VM in this fashion.

rpcchainvm has two important parts: a server and a client. The server runs in its own process and allows the underlying VM's methods to be called via gRPC. The client runs as part of AvalancheGo and makes gRPC calls to the corresponding server in order to update or query the state of the blockchain.

Subnets

Lastly we have Subnet, or subnetwork, which is a dynamic set of validators working together to achieve consensus on the state of a set of blockchains. Each blockchain is validated by exactly one Subnets. A Subnets can validate many blockchains. A node may be a member of many Subnets.

So to visualize the heterogenous, or rich and diverse nature of the Avalanche network picture this. A VM is the application level logic of your blockchain. It's the template and can be instantiated into many different blockchains, some of which are public and some of which are private. A blockchain is an instance of a VM. Each blockchain is validated by exactly 1 Subnet. A Subnet can be on a spectrum of public to private and can validate many different blockchains, including many instances of the same virtual machine. A node can be a member of many Subnets, validating many many blockchain including many instances of the same virtual machine, some public and some private. Avalanche is truly a heterogenous network.

Subnets manage their own membership, and may require that their constituent validators have certain properties which is very useful.

Compliance

Avalanche’s Subnet architecture makes regulatory compliance manageable. A Subnet may require validators to meet a set of requirements.

Some for example you can say that:

  • All validators in my Subnet must be located in a given country or legal jurisdiction
  • All validators must pass a KYC/AML checks
  • All validators must hold a certain license

Support for Private Blockchains

You can create a Subnet where only certain pre-defined validators may join and create a private Subnet where the contents of the blockchains would be visible only to those validators. This is ideal for organizations interested in keeping their information private.

Separation of Concerns

In a heterogeneous network of blockchains, some validators will not want to validate certain blockchains because they simply have no interest in those blockchains. The Subnet model allows validators to only concern themselves with blockchains that they care about. This reduces the burden on validators.

Application-Specific Requirements

Different blockchain-based applications may require validators to have certain properties. Suppose there is an application that requires large amounts of RAM or CPU power. A Subnet could require that validators meet certain hardware requirements so that the application doesn’t suffer from low performance due to slow validators.

Primary Subnet

Our mainnet launched in August 2020 w/ what we call the Primary Subnet. It has the X-Chain, C-Chain, and the P-Chain.

Summary

So in summary, Avalanche is a global financial network for the issuing and trading of all digital goods. We enable potentially millions of validators to process thousands of transactions per second with near instant finality using a protocol which is completely green and quiescent. We've paired this high throughput and fast finality protocol w/ an architecture that can meet the needs of unique financial services and decentralized apps.

We accomplish this through the notion of Subnets. Subnets allow anyone anywhere to spin up a taylor-made network w/ custom virtual machines and complex validator rulesets.

Avalanche is a network of networks. It's a platform of platforms where we invision thousands and thousands of public and private Subnets all emerging into this global marketplace which we call The Internet of Finance.

Thank You

Thank you very much. I want to express gratitude to everyone listening today and in the future. I'd like to express gratitude to the Consensus team for the opportunity to present and let everyone know about the amazing Avalanche network. And I'd like to express gratitude to the Ava Labs team. It's truly an honor and a pleasure to work w/ all of you amazing blockstars to change the world each day.

Final Slide

As I mentioned my name is Gabriel Cardona. I am Developer Evangelist at Ava Labs. You can find me at @cgcardona on twitter and telegram. Feel free to reach out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment