About half year in since the first article on medium about SIDAN Lab’s early story & our open source strategy, we have continued to maintain and upgrade the open source libraries in SIDAN Lab. Here we give a quick pulse check, how these libraries have powered DeltaDeFi to the public testnet we launched in previous weeks, and how everyone can get started to make use of these public good!
What’s now, what’s next
| Funding Status | Feature | Coming Soon | |
|---|---|---|---|
| whisky | Completed - F11, F12; Proposing - F14 | Unified types support; Transaction building; Wallet | Pallas integration |
| vodka | Proposing - F14 | Onchain utility functions; Transaction building for unit testing | Revamp, performance optimization, and auditing of onchain utility functions; Feature-complete transaction building for unit testing |
| cardano-bar | Proposing - F14 | Typescript (Mesh) blueprint parser; Aiken validator code snippet | Rust (whisky) blueprint parser; Mesh code snippet; Whisky code snippet |
| rum | N/A | Unified types support Wallet | Transaction building |
| gin | N/A | Unified types support Wallet | Transaction building |
How we use these tools to build DeltaDeFi
DeltaDeFi is a multi-language micro-services architecture Cardano DApp, we have 10+ services connected with 3 core big components handling Cardano-related logics:
- Frontend in TypeScript - The frontend of testnet is built with NextJS in TypeScript. We use MeshJS to handle wallet connection and UTxOs fetching here.
- Core API services in Golang - We have the core of our backend in Golang. In the Golang micro-services, we conduct heavy Cardano value operations and prepare the necessary Cardano types like UTxOs and Value passing to other services to further process.
- Transaction building in Rust - The core transaction building is built with whisky. It receives information from Golang microservices and returns full transactions.
- Merkle computation in TypeScript - In the current version, we do not reimplement the off-chain of Aiken’s merkle-patricia-forestry in Rust. So for transactions like deposit, withdrawal, Hydra open and close, which require computation of Merkle root, we handle in a TypeScript server built with Mesh
This is where the type alignments amongst libraries are powerful. We centralized the development work into checking field names exactly once in the library level, then we can be hassle-free by the time of develop DeltaDeFi - all the types can be casted into each others without further conversion.
Public-facing SDKs
In DeltaDeFi, we have built SDKs in 4 languages to support traders in programmatic trading. However, we faced one problem before we implemented transaction signing in rum and gin.
Due to the unstandardized CBOR serialization in Cardano (why we don’t have a CIP for it yet!), the transaction body changed after signing with serialization logics from py-cardano and apollo, due to for example turning empty array into null. Eventually, it breaks the state tracing in DeltaDeFi backend since we index transactions with hashes.
Rather than working on a CIP (we wish! but it might take months or years to process), we solve by relying on one serialization core (whisky), exporting into multiple languages for signing:
- TypeScript: whisky → wasm → mesh
- Golang: whisky → cardano-golang-signing-module → rum
- Python: whisky → cardano-python-signing-module → gin
With that, we can support all clients signing transactions built by DeltaDeFi backend without augmenting the transaction body, empowering true programmatic trading.
Getting Started
Best way of getting started is to check the official documentation and examples
- mesh
- whisky
- Hosted documentation
- In repo examples - full stack example, tests
- Examples in DeltaDeFi - hibiki, bowmore, rust-sdk
- vodka
- Mesh open source libraries - repo
- Dev tutorial - Gimbalabs AikenPBL, cardano-builder-asia-course
- Examples in DeltaDeFi - core scripts, trading vault, L1-liquidity connector vault
- cardano-bar
- Dev tutorial - Gimbalabs AikenPBL, cardano-builder-asia-course
- rum (with cardano-golang-signing-module)
- Examples in DeltaDeFi - go-sdk
- gin (with cardano-python-signing-module)
- Examples in DeltaDeFi - python-sdk
We will continue building in the community, give it a try and we’d love to have your feedback!