The Jellyfish Story: Building DeFiChain’s SDK

Jul 18, 2022(2 years ago)-
Fuxing's Picture
Fuxing Loh

Written by Fuxing and originally published on Birthday Research Medium.

Jellyfish Banner

Building lite decentralized finance applications on DeFiChain can be complex. However, this should not be the case. Introducing Jellyfish, a bridge into an alternative future, where non-custodial decentralized transactions can be performed with speed and ease.

Jellyfish is DeFiChain’s SDK for building lite DeFi Applications at scale. Built using modern JavaScript approaches — ES6, Strict & Mono-repo — Jellyfish is transpiled and bundled for backward compatibility, and is written in TypeScript with added first-class support.

Although Jellyfish was incubated under Birthday Research as an infrastructure project, the team working on Jellyfish were neither part of the core maintainer nor the technical steering DeFiChain community; instead, the team acted as an advisory unit and built the JellyFish SDK to abstract away the complexity of writing C++ (which is what Native DeFi is based on) for developers.

In the initial days, bugs were aplenty. Motivated to fix these bugs, the team came together as a group and set an all-encompassing goal: The ability for anyone to create modern lite DeFi applications at scale.

Jellyfish started with 3 packages in a mono repository, but today, it has over 40 packages across the ecosystem and multiple ocean nodes distributed globally, serving millions of requests per hour.

A trip down memory lane

The Inception

Like any other ecosystem project, the foundation of the Jellyfish development was grounded in principles such as high standards, proper error handling, rigorous testing, and clear documentation.

Introducing the HD Wallet

Once the foundation was ready, the team then worked on high-level abstraction to expedite developers’ ability to perform non-custodial transactions with built-in HD wallet constructs.

Transactions were launched

After HD wallets were introduced, efforts were pivoted to blockchain scripting. To scale native DeFi scripting, scaling buffer composing had to be tackled. Similar to Bitcoin, which uses a scripting system for transactions, this script needed to be simple, stack-based, and processed from left to right. Furthermore, it had to be non-Turing-complete with no loops. The script features a composer-like, bi-directional toBuffer or fromBuffer implementation, which was created to have high compatibility with the Transaction Composer.

Playground

The team then worked on ‘Playground’ which was a side project to ocean infrastructure. It provided a deterministic DeFi playground for blockchain engineers to build applications without running their own nodes or using real funds.

Ocean APIs

Although the Jellyfish SDK provided a foundation for developers, providing access to promote scalability was still lacking. This is where Ocean played a key role; used by over 100 public and private community developers, the team built Ocean, a global API infrastructure project hosted by the Jellyfish team which democratized access for everyone.

After launching Ocean, the team went through several technical spikes to further Ocean’s ability to scale, including separating the network backbone (mainnet, testnet, playground) to allow fault tolerance in each namespace. The team started with 2 regional zones, but have since expanded to 3 to serve increasing traffic, and will continue to add other regions which become a hot zone to optimize latency.

Scaling Jellyfish request to billions

Since inception, the team has seen incredible growth:

  • 30x the volume of daily requests ocean nodes handle
  • 10x the size of the data indexes and node snapshots
  • 10x growth of node auto-scaling groups
  • 10x the memory footprint to scale traffic growth
  • 3x the number of services/APIs hosted
  • Expanded to an additional AWS region to serve traffic from the Americas

Throughout this period of tremendous growth, the team remained steadfast in their North Star: The ability for anyone to create modern lite DeFi applications at scale. In the earlier days of their journey, the team focused on the first part of the goal, which was to enable users to create modern lite DeFi applications. Today, the latter is the focus, enabling scale through sustained innovation and decentralized growth.

Accelerated growth of Ocean
Accelerated growth of Ocean