The Celo Blog
Published in

The Celo Blog

Fast and Light

cLabs engineering and product updates

Sign up here to get the cLabs Tech Sync Newsletter in your inbox.

cLabs Tech Sync #4

Welcome to the cLabs engineering and product newsletter. This is the scoop on what’s on the minds and keyboards of the cLabs team. The most important part of any open source project is the people, and we hope to foster a little more of that connectedness.

This week, we’re looking at cLabs’ ongoing work to optimize the experience using Celo from mobile devices, which could be anywhere in the world, transiently connected, and have a connection where latency is high, and bandwidth is low or expensive.

Forno

cLabs operates Forno, an optional service that provides access to the Celo network for users choosing not to run their own full node. Valora uses Forno’s full nodes as its first peers in the network and in ‘data saver’ mode.

Trevor Porter just completed a revamp of the service to better serve Celo’s growing global user base. Forno is now accessible at https://forno.celo.org and now supports WebSockets at wss://forno.celo.org/ws. Through a single global IP, requests are now routed to the closest of one of five clusters spread around the world. Clusters are managed so that requests are not routed to overloaded nodes or ones that have fallen out of sync. It’s monitored 24x7 by cLabs engineers. Forno could be just one of several such full node services provided by the community in the near future.

Light client improvements

The cLabs blockchain team has been making a number of improvements to the celo-blockchain light client that Valora uses to communicate with the Celo network.

One of the first things the client does on startup is perform discovery: starting with a set of initial peers, it finds other suitable nodes to make requests from in the network. Valora now uses the geographically closest set of Forno nodes as its initial peers, so users are likely to see faster app startup and lower latency sending transactions. Using a set of cLabs nodes specific to the region will improve the user experience immediately.

Supporting the long-term where clients are served by a decentralized set of full nodes, Victor Graf is investigating making the whole discovery protocol latency-aware, so that light clients take latency into consideration when choosing their peers. This paves the way for full node operators to earn clients by providing timely responses and hence rewards through full-node incentives (see below).

Trevor also found that when Android or iOS terminated Valora, celo-blockchain wasn’t getting a chance to persist the identities of the peers it had established through discovery. By making the app start with the same peers as previously, he reduced startup time by up to 30 seconds.

Victor also improved light client retry logic, so that in the event a peer rejects a transaction or does not respond within half a second, it will retry the request with a new peer. This improves reliability in the face of connectivity issues.

Gas estimation, expedited

As Valora has gained users around the world, one of the biggest performance drains we’ve identified is gas estimation. Before finalizing a transaction, the Valora wallet currently runs the transaction locally to determine exactly how much gas, and thus cUSD, it will cost. This is a great feature, but unfortunately, it can take in the tens of seconds on the slowest connections.

We are working on solving this in a couple of ways. Simple things first: figure it out ahead of time. Most of our transactions (e.g. cUSD transfers) use a predictable amount of gas. In these cases, we can use “offline estimation”, which is often as simple as using a constant value, to give an immediate cost estimate. This is the solution we are working on now.

In the longer term, we are considering getting better-connected full nodes to help out. Gas estimation takes a long time because it requires many requests to be sequentially sent to the full node that is acting as a gateway for the client. In less than ideal network conditions, each request may take up to 500ms and if we need to do 12 of those requests, which is the case for a simple transfer, that’s already 6 seconds that the user has to wait! With an improvement to the light client protocol, this could be completed with one request and without any compromise on security. We are working on the design for “gateway-assisted gas estimation” now, and it is likely to be a long-term solution.

Instant syncing with Plumo

Typically, trusting the latest block in a blockchain relies on receiving the historical content of the chain back to the first block, the so-called genesis block. This process is ‘syncing’. Even on a powerful computer with a great connection, this can take days for some blockchains. To support its mobile-first approach, Celo has a “lightest” sync mode that allows nodes to trustlessly sync by downloading and verifying as little as one block header per day. While this already is hundreds of times faster than otherwise, it still depends on the length of the chain: every day that passes, syncing gets a tiny bit slower. Step in, Plumo.

Plumo is a zk-SNARK based syncing protocol that will take “lightest” sync mode to the next level, reducing the time and data needed to sync the chain by a factor of 10 and 100, respectively.

Over the next few weeks, cryptographers led by Kobi Gurkan will be finalizing the code for the multi-party computation setup ceremony needed to create and verify the SNARKs. The setup will require many processor-months of computation, and so the team has implemented significant optimizations and an optimistic setup protocol where participants can contribute in parallel.

Lucas Ege and others have been getting a head start on integrating Plumo based syncing into celo-blockchain with CIP-17. This will necessitate a couple of backwards-incompatible changes to block headers which will be proposed to be included as part of the upcoming Donut hard-fork.

Full node incentives

Since prior to mainnet launch, the Celo protocol has included support for a ‘gateway fee’, fields in every transaction that, when included in a block, allow a client like Valora to pay a variable amount to a full node providing services to that client. The vision is to enable a marketplace of full nodes able to serve light clients, and for light clients to be able to choose those clients based on location, quality of service, or other factors. This creates a powerful ‘permissionless onramp’ that allows node operators to earn CELO without putting down a stake or keeping a machine running 24x7. These incentives are going to be essential for Celo to scale to support a large globally dispersed user base.

However, a number of gaps remain before this is a reality. After completing his doctorate at the MIT Media Lab, Nazmus Saquib will be taking a hard look at the problem of incentivizing full nodes. We hope to see a robust solution that rewards full node operators and provides a seamless experience to light clients.

Meet the team! Victor Graf

We’re going to introduce you to one member of the team in each newsletter. In this edition, Victor Graf. In own words:

“I joined cLabs a little over a year ago, and what a year it has been. I was looking for a place where research ideas are being applied in ways that have truly transformative potential. When I was introduced to Celo and the cLabs team, I was inspired by the mission and amazed by the application of creative and deeply technical solutions with a diligent focus on the needs of real people.

Over the last year, I’ve worked on supporting the Baklava network for the Stake Off and in the lead up to Mainnet launch, and more recently I’ve been working on measuring and improving the performance of the light client running in the mobile wallet. Some interests of mine include networks, security, cryptography, automated manufacturing, lock picking, and most recently, typography. (Inspired by a realization that I spend most of my time staring at text on a screen)

I’m currently living in Seattle 🌲 so I of course drink exclusively beer or coffee, enjoy hiking in the beautiful mountains around here, and spend the winters wondering why I don’t just move to Austin. (I’m also from Texas originally 🤠)”

Community events you shouldn’t miss

Check celo.org for all kinds of community events.

Celo All Core Devs Community Call — Oct 29, 4 pm UTC, 12 pm EST, 9 am PST

  • Join community developers to chat about activating the CIP process and Celo’s first Hard Fork, as well as adding Meta CIPs for activated Ethereum-based forks.
  • Zoom link and details in the Calendar invite.

Developing on Celo Office Hours — every Tuesday

  • Hangout with cLabs developers about building on top of Celo and using the SDK.
  • 10/13 at 4pm PT, 10/20 at 8am PT. Calendar of future events here.

Celo Foundation Grants Wave III — Deadline Nov 6

  • The Celo Foundation is currently accepting applications for Wave III of the grants program. They are looking for mission-aligned projects that are interested in helping build, grow and support the Celo ecosystem

Get involved

If you’re interested in following the progress more closely, please take a look at the celo-org Github projects, consider joining the Celo Discord server, and if you’d like to contribute to the Celo ecosystem, please don’t hesitate to reach out!

Happy building and operating!

Tim

Sign up here to get the cLabs Tech Sync Newsletter in your inbox.

Celo is a carbon-negative, L1 protocol with a rich ecosystem of global partners building Web3, mobile-first applications to create a more accessible and inclusive global financial system. Visit celo.org to learn more about the Celo community, contributors, and technology.

Recommended from Medium

Key SaaS Website and Product Metrics to Track Using Mixpanel

Systems Design

Trusted Services: How does it work?

Spawning Objects in Unity without the Clutter

Flutter — Form Validation Using Cubit

The iPad Pro as a focused, simple coding machine

Starting from the bottom

Requirements of Compliant Data Backup for Cloud Native Applications on AWS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
cLabs

cLabs

Building financial technology to enable prosperity of all beings. cLabs started Celo in 2018 and is one of many contributors to the open source project.

More from Medium

Climbing Cathedral Mountains to see the Silver Clouds Below — Peak Finance Fundamental Analysis

The District Monthly — March 7th, 2022

Introducing Mune !

Hathor Wallet security best practices