Celer Network is one of the most exciting projects in the crypto space. It is a layer-2 scaling platform that allows fast, easy, and secure off-chain transactions for both payment transactions and off-chain smart contracts. However, before we gain a better understanding of Celer, let’s see why the crypto space needs this project in the first place.
Crypto has a scalability problem
If you have been in the blockchain/crypto space, then you must have heard about the “scalability problem.” Simply speaking, cryptocurrencies, got too popular for their own good. During the boom of 2017 – when Bitcoin charted its all-time high – more and more people entered the space. However, as we all soon found out, the traditional public blockchain architecture is not really meant to accommodate a lot of users.
This point was brutally driven home during the cryptokitties fiasco.
Cryptokitties is a game that was built on top of the Ethereum blockchain. In the game, you are supposed to nurture and breed virtual cats. The internet immediately fell in love with the game. It became so popular that even the mainstream media started to cover it. It felt like “Cryptokitties” was going to be that “magical dApp” that was going to make cryptocurrency mainstream.
Unfortunately, things soon took a turn for the worse. The Ethereum blockchain simply wasn’t well-equipped to take care of this sudden surge in users. It just couldn’t handle the stress. The number of unconfirmed transactions in the blockchain increased exponentially.
Image Credit: Quartz
Because of this, Axiom, aka the company behind cryptokitties, was forced to increase the gas fees. This is what they said in their medium article:
“The excitement and adoption we’ve seen this week has been overwhelming and we couldn’t be happier! However, the Ethereum network is completely full. The only way to keep CryptoKitties from lagging is to increase the gas prices so that all transactions can complete quickly. We know that increased prices will mean that some of you will need to slow down your breeding regimen, and we are incredibly disappointed by that. But who knows? Maybe this slowdown will just mean that you’ll love the Kitties you already have that much more.”
So, now that we know what the problem is, how do we fix it?
Fixing the blockchain’s scalability usually comes down to two things:
- Layer 1 scalability.
- Layer 2 scalability.
Layer 1 Scalability
Layer 1 or base-layer scalability means making modifications to the underlying blockchain architecture itself. The two main ways that this has been done so far is by:
- Increasing the block size.
- Opting for leader-based consensus algorithms.
Increasing the block size
One of the methods proposed to increase layer-1 scalability was to simply increase the block size. However, this method has three prominent drawbacks:
- In a proof-of-work system, this method requires the nodes to do more work. As it is, mining is a very expensive process. Making it more expensive will only make the bigger pools more powerful and decrease overall decentralization.
- As we have seen with the Bitcoin-Bitcoin Cash fiasco, increasing the block size can lead to a split community. No one wants a hard-fork if it can be completely avoided.
- Increasing the block size results in linear scalability as opposed to exponential scalability. Eg. Bitcoin Cash is just 10-15 times faster even though Bitcoin’s block size is 1 MB and Bitcoin Cash has an adjusted block size of 32 MB.
Leader-based consensus algorithms
The other approach that people have been taking is to use leader-based consensus algorithms. In these algorithms, there are specific nodes in the network which are considered more potent than the rest. These nodes are in charge of the consensus and overall network well-being. However, this solution goes against the principle of decentralization. Having a small number of nodes sure increases the speed, but it also makes the system more insecure and centralized.
Layer 2 Scalability
Layer 2 solutions are scalability solutions built on top of the existing base blockchain. These solutions leave the base-layer alone and create protocols on top of it. This is where we re-introduce ourselves to Celer. There are several layer 2 solutions like the lightning network and Raiden network already in the later stages of development. However, what makes Celer unique is that while those are for payment only, Celer can also execute generalized off-chain smart contracts.
Going deeper into Celer
At its very core, the two main components of Celer Network are:
- cStack: Celer’s off-chain technology stack that can be built on different blockchains.
- cEconomy: Celer Network’s cryptoeconomic mechanism.
cStack consists of the following layers in bottom-up order:
- cChannel: Generalized state channel and sidechain suite.
- cRoute: Provably optimal value transfer routing.
- cOS: Development framework and runtime for off-chain enabled applications.
What is cChannel?
cChannel uses the two cornerstones of off-chain scaling platforms – state channel and sidechains.
Firstly, let’s understand what a state channel is. It is a two-way communication channel between participants that enable them to conduct interactions. This interaction, which would normally occur on the blockchain, will be happening off the chain. Let’s do a quick run-through of the requirements to execute an off-chain state channel:
- A segment of the blockchain state is locked up via multi-signature or some sort of smart contract. This is pre-agreed upon by the participants.
- The participants interact with each other by signing transactions among each other without submitting anything to the miners.
- After the channel is closed down, the final state is added to the blockchain.
The Lightning Network is a specific form of state channels called “payment channels.” These channels track the state of payments between parties. A state channel like Celer’s tracks the state of any arbitrary program between the parties, which could include payments.
Why were state channels needed?
To understand why we need state channels, let’s look at how transactions work in Ethereum. The decentralized crypto ecosystem has been built using a Byzantine fault-tolerant model. This model always assumes that it is continuously working in an extremely hostile environment. Eg. In the case of Ethereum, individual users don’t trust the miners, miners don’t trust the user, and miners don’t even trust each other.
So, how does a transaction actually happen?
- Suppose Alice wants to send 3 ETH to Bob. She will signal this intent to the miners.
- She will also have to pay some extra transaction fees or gas fees to compensate the miners for their services.
- This state transition (the transaction in this case) needs to be approved by a majority of all the nodes within Ethereum’s network.
- Only after the verification has been received, will Bob’s account be updated by 3 ETH.
When you review this process, you will notice two possible weak points:
- The process itself is slow. Waiting for transactions to get a supermajority vote from a network as vast as Ethereum’s is not ideal.
- As Ethereum gets more popular, more nodes are going to enter the network. This will make the verification time even longer.
This is where state channels can completely change the game. By leveraging smart contracts and basic game theory, state channels will allow users to create an environment where they are incentivized to cooperate and progress the overall state of the application.
The best part? This entire interaction happens off the blockchain.
So, if Alice were to send 1 ETH to Bob within the state channel, she can do so without needing to gain approval from the super-majority of the network. It is simple, direct, and fast.
Having said that, there is an important thing that you need to keep in mind when it comes to state channels. It requires unanimous consent from the participants to update the state. In the channel, both the participants have to come to an agreement before conducting an operation. Since the number of participants is so low (two instead of the supermajority of an entire network), this agreement process is swift.
How do state channels work, and why are they useful?
Suppose Alice and Bob want to interact with each other through a state channel. Here is what happens:
- Alice and Bob lock up some of their funds into a smart contract. Both parties will need to give their consent to do anything with these locked funds.
- Alice and Bob will exchange messages over the internet to mutually consent on a particular payment. This will result in the exchange of funds between the two.
- At any time, either Alice or Bob can exit the smart contract by reinforcing the latest state and committing it to the blockchain.
Important features to keep in mind:
- Thanks to smart contracts, Alice and Bob don’t need a trusted third party to hold on to their assets, while they do their operations.
- Even if for some reason the state channels fail, the participants will be able to restore the original state in the blockchain itself.
- State channels also have strong privacy features. While blockchain transactions themselves are transparent and open for everyone to see, state channel interactions are only visible to the participants. For instance, Alice could send Bob a conditional payment in a state channel where no-one except Alice and Bob has to know the condition. When the conditional payment resolves, it will look like a normal payment and fund transfer from the outside world even when Alice “disconnects” from the state channel network.
Practical use of State Channels
While the explanation so far has been about individual state channels, Celer expects its users to mostly use state channel networks. A state channel network is a network of individual state channels that are connected in such a way that it will be possible to route state changes through them. Let’s take an example.
Suppose, Alice and Bob don’t have channels open with each other, but they want to play a game. As long as both of them have a channel with a common intermediary, they will be able to open a virtual channel with each other. Once a user connects to a state channel network, interacting with different channels becomes a natural, default experience. Users will be able to install, use, and uninstall applications instantly with zero transaction fees.
According to Celer, the following applications are most suitable for state channels:
- If the application has to deal with a large number of transactions or interactions between users.
- When a particular session of the application deals with a relatively small number of participants.
- When the application requires fast, near-instantaneous UX.
- When the set of participants in the application don’t have to change too often.
How does the cChannel use sidechains?
A sidechain is a separate blockchain that is attached to its parent blockchain using a two-way peg. The two-way peg enables the interchangeability of assets at a predetermined rate between the parent blockchain and the sidechain.
In conjunction with state channels, cChannel also uses sidechains. Eg. when multiple users need to pay each other, they can pool their deposits to a central contract. This central contract will act as a sidechain contract with the off-chain service providers forming a “multi-party hub.” This will enable one-to-many payment relationships within a hub.
The sidechain model has the following benefits over the state channel model:
- The receiver doesn’t need to be online and conduct an on-chain transaction. The reason is that they can receive their funds on the sidechain without performing any deposit themselves.
- Secondly, no per-party fund lock-up is required. When side-chain based channels are used for multi-party payment, each party (except for the block proposer) doesn’t need to lock their deposit in advance before they pay each other.
What is cRoute?
For a state channel network to scale up efficiently, the state routing needs to be designed appropriately. State routing determines the speed and volume of transactions flowing on a given system. Unfortunately, existing state channel networks, like Lightning Network and Raiden, have certain pitfalls that prevent efficient routing.
- Lightning Network: Lightning Network uses a form of Landmark Routing protocol called “Flare.” The idea of Landmark routing is to determine the shortest path from the sender to the receiver through an intermediate node called “Landmark,” which is usually a well-known node with high connectivity.
- Raiden Network: Raiden uses the A* tree search which is a distributed implementation of shortest path routing.
Long story short, both of these routing mechanisms are about “finding the shortest route between two points.” Pursuing this method in a traditional data model provides a good throughput. This is mainly because the overall network remains relatively stable and the link capacity is stateless (since each link is unaffected by past transmissions).
Unfortunately, the off-chain channels are stateful models since constant transactions are happening within it, changing individual capacity (or balances).
The shortest path routing leads to frequent changes in network topology and doesn’t account for channel balancing. Check out the figure below, which shows how the shortest path routing leads to topology changes every time slot.
Let’s look at what all is happening here:
- In the beginning, node A, node B and node C each initiate a payment of 100 tokens to node B, node C and node A, respectively.
- During the initial channel balance distribution (i.e. time slot 1), every pair of nodes are connected by a bi-directional link, and each node selects a direct route to its destination under the shortest path routing.
- However, over time, this results in a unidirectional transfer over each channel as is evident in time slot 2. Also, note that during this time, the network topology is anticlockwise.
- During this time slot, the shortest path routing keeps making uni-directional transfers (e.g., selects route A -> C -> B for payment A -> B). this reverses the channel balance topology from anticlockwise to a clockwise cycle. This will repeat indefinitely.
As you may imagine, this is not the most efficient way to go about things. In a decentralized ecosystem, the constant topology changes could lead to poor performance as it takes time for the algorithm to adjust to the new topology.
In fact, if node C took the longer route (C -> B -> A), not only will all the channels remain balanced, the network topology will be unchanged as well.
Celer’s solution: Distributed Balanced Routing
Celer’s routing mechanism is the Distributed Balanced Routing (DBR) which achieves transparency and optimal channel balancing during the routing process. To understand DBR’s design philosophy, imagine a water stream that’s flowing downhill. The water doesn’t know where its final destination is, it just follows gravity.
Similarly, DBR doesn’t perform any explicit path computation from source to destination. DBR merely follows the current network’s congestion gradients. The DBR algorithm has an innate state channel balancing ability that transparently maintains balanced transfer flows for each state channel.
The advantages of DBR algorithms are as follows:
- Provably optimal: DBR will always track the most optimal route for a given rate of value transfer requests.
- Transparent channel balancing: DBR rebalances each state channel to maintain balanced value transfers in the long term.
- Completely decentralized: DBR is a fully decentralized algorithm. Each node only needs to talk to its neighbors in the state channel network topology. DBR also happens to have low messaging costs in the protocol.
- Resilience to Failure: DBR is highly robust against failures. The algorithm can detect and adapt to unresponsive nodes quickly. In the case of node-failure, the remaining available nodes will be delivering the maximum possible throughput.
- Privacy: Since DBR favors a multi-path feature, the algorithm preserves the privacy of transferred values. They can do this without using any additional privacy-preserving techniques. DBR can also integrate onion routing to protect anonymity.
What is cOS?
cOS is a combination of application development framework (SDK) and runtime system. cOS aims to aid developers to quickly build, operate, and use scalable off-chain decentralized applications with a high level of abstraction.
Directed Acyclic Graph (DAG)
To support use cases beyond simple P2P payments, Celer uses a system of off-chain applications as a DAG of conditionally dependent states. Let’s see how generalized state channels can leverage dependency graphs to manage complex multi-party interaction.
Consider the diagram above.
- Let’s say that “Off-chain App 2” is a chess game that Alice is playing with Carl.
- Suppose Alice sets a condition – “I will pay Carl 10 ETH if Carl wins the game.”
- Even if Alice and Carl don’t have a direct channel between them, they can interact with each other through a common intermediary. In this case, that intermediary is Bob.
- This direct channel will be formed with two layers of conditions. The first layer is a simple time hashed lock to make sure that Bob relays and resolves the payment in a reasonable amount of time. The second layer locks the payment conditioning on the result of the chess game.
- This conditional statement can be settled via Bob even though he isn’t a part of the game.
Celer’s cOS SDK is a complete toolchain solution for the creation, tracking, and resolution of states in off-chain applications. Developers will be able to create applications using the SDK to accelerate the off-chain scaling solution and the payment network provided by Celer Network. This will help build a robust ecosystem. Developers will be able to create two classes of decentralized applications:
- Simple pay-per-use applications: In these applications users receive microservices from a real-world entity and streams payments through the payment network.
- Complex multi-party applications: Developers can leverage conditional state dependency graphs to build complex multi-party applications. Celer plans to extend the existing smart contract languages with modern software construction techniques such as metaprogramming, annotation processing, and dependency injection.
cOS Runtime acts as an interface between cApps and Celer Network transport layer.
It supports cApps in terms of both network communication and local off-chain state management. The runtime handles a lot of functions within the system:
- One the network front, the runtime handles multi-party communications during the cApp’s lifecycle.
- It provides a set of primitives for complex multi-party use cases such as gaming.
- If there are instances of counter-party failure, the runtime relays these disputes to the on-chain state.
- If the client goes offline, the runtime handles availability offloading to the State Guardian Network. When the client comes back online, the runtime synchronizes the local states with the State Guardian Network (more on it in a bit).
The second pillar of Celer’s value proposition is its cryptoeconomic model called “cEconomy.” This model has been built to provide network effect, stable liquidity, and high availability for the ecosystem. Any off-chain solution while gaining scalability needs to make trade-offs with liquidity and availability. The mechanisms used to manage these trade-offs are:
- Proof of LIquidity Commitment (PoLC).
- Liquidity Backing Auction.
- State Guardian Network.
Proof of Liquidity Commitment (PoLC)
PoLC is a virtual mining process that acquires abundant liquidity for the off-chain ecosystem. In Celer Network, there are individual members called “Network Liquidity Backers” (NLB). The mining process includes NLBs locking up their liquidity – which could be any type of digital assets like ETH – in Celer Network. They lock up the assets in a “dumb box” called Collateral Commitment Contract (CCC), for a certain time. In exchange, the NLBs get rewarded with the native CELR tokens. This maintains the liquidity of assets within the network.
Liquidity Backing Auction (LiBA)
LiBA enables off-chain service providers to obtain liquidity through “crowdlending.” The lender priorities are determined by the interest rate, the amount of provisioned liquidity, and the amount of staked CELR token. This is how the mechanism works:
- The service provider initiates a LiBA to borrow some of the liquidity for a specific amount of time.
- One of the interested liquidity backers submits a bid. The bid will include – the interest rate offered, the amount of liquidity, and the amount of CELR they are willing to stake.
- The amount of liquidity is submitted via a CCC.
- The borrowed liquidity will be used as a fraud-proof bond or an outgoing channel deposit.
State Guardian Network (SGN)
The SGN is a special sidechain to guard off-chain states when users are offline, to ensure availability. The CELR token holders can stake their CELR into SGN and become state guardians. The primary role of these guardians is to guard the state of a user for a specific time. A user can submit their state to the guardian in exchange for some fees. The number of guardians chosen to be responsible to guard a state is dependent upon:
- The state hash
- The Responsibility Score, which is the income flow generated by the user to the SGN.
What is CelerX?
CelerX is Celer’s consumer-facing product and it’s the first and only layer-2 application platform on iOS and Android. CelerX users will be able to:
- Use Celer Pay to instantly transfer money with zero fees.
- Play various skill-based games with no latency.
Since the July 8th mainnet launch, CelerX has reached $1.4M+ total prizes awarded, 11K players and 300K matches from 88 countries. Celer does not control the tokens deposited in Celer Pay and you have full control of your fund at all times. The Game Token (GT) is the native ERC-20 token used in the CelerX app. One can use the GT tokens to try and practice games in the app. CelerX provides real-money competitions for roughly 80% of the world and 38 US states – the exceptions being Arizona, Arkansas, Connecticut, Delaware, Florida, Louisiana, Maryland, Montana, South Carolina, South Dakota, and Tennessee.
As we have mentioned before, the biggest problem with blockchain space is the lack of adoption. However, the whole “Cryptokitty” thing showed us that there is a big market in the blockchain space for leisure/recreational dApps. This is something that we have seen time and time again. Between March 3-9, 2019, Tron was the biggest smart contract platform in the space:
- Tron DApps experienced a 207% rise in weekly transaction volume with a total volume of $180 million, which far exceeded that of EOS ($102 million) and Ethereum ($24 million).
- They acquired 33,000 new users, triggering a 64% growth.
During this period, the three most popular dApps on Tron were – Epic Dragons, CrazyDogs, and TronGo. As you can see, all three of them are recreational (gaming and gambling) Dapps. CelerX will capitalize on this market by providing a platform for skill-based gaming and mobile e-sports. CelerX offers buying cryptocurrencies within the app through Credit Cards, PayPal, and Apple Pay, which is an unprecedented approach in the mobile gaming industry, let alone blockchain gaming.
CelerX is going to be a critical component of the growth of Celer’s ecosystem. You can download CelerX here.
As you can imagine, Celer Network is a highly ambitious project. The project is led by – Dr. Mo Dong, Dr. Junda Liu, Dr. Xiaozhou Li, and Dr. Qingkai Liang, who have all received Ph.Ds from some of the most prestigious universities in the world. Celer Network resolves the scalability problem of cryptocurrencies by utilizing clever layer-2 tactics, which don’t compromise on overall system security.
On the technical front, Celer is working on some really promising developments:
- An open-source yellow paper which details its off-chain generalized state channel protocol and design rationale.
- Release a security audit report for cChannel smart contract and remove the security precautions.
- A full pen-test report for the Celer Network full node.
- Gradually roll out and build on the different cEconomy components – Proof of LIquidity Commitment (PoLC), Liquidity Backing Auction, and State Guardian Network.
- Complete a 5-lesson tutorial about how to build with CelerX eSport Gaming SDK.
With the cStack (technology) and cEconomy (cryptoeconomic) components working congruently, Celer is all set to dominate the crypto space. It will be very interesting to see how it grows in the future.