Javascript Chain Simulator for Rapid Prototyping

3yrs ago
1 Comments

Description

Over the course of development of DatDot we ended up developing a relatively fully featured substrate chain simulator (api)(logic) providing the same interface as polkadot.js, for the purposes of UI testing expressing expected behaviour, and writing implementation specs for later implementation in our pallets.

Currently, this chain simulation code is not very generic and is tailored to simulate the storage and functions we need for DatDot, but it would be reasonable to adapt the idea into a generic solution to allow arbitrary chain teams to specify some set of functions and storage, and generate a scaffold for them to fill out with their required business logic.

We intend to create a treasury proposal to fund the extraction and expansion of this part of our codebase into it's own standalone tool or library.

Team

Working on this tool:

Team's experience

Alexander Praetorius (serapath)

project lead & full stack javascript engineer

  • Linkedin

  • Twitter

  • Github

    (2014 - now) meetup.com/WizardAmigos - co-founder, dev community, meetups, workshops

    (2015 - 2018) fairydust.agency - co-founder, p2p web development agency

    (2017 - 2019) remix.ethereum.org - javascript/solidity engineer (solidity web IDE)

    (2018 - now) dat.foundation - dat consortium member

    (2018 - now) playproject.io - co-founder, p2p/blockchain engineer

    (2019 - 2020) smartcontract.codes - co-founder, search engine for solidity source code

    (2020 - now) datdot.org - co-founder, substrate-hyperprotocol bridge (p2p hosting)

Nina Breznik

ui/ux and frontend developer

Proposed Design

We intend to release a command line tool which spins up a local server that behaves as if it were a substrate chain;
the functionality of this server will probably require filling out a simple generated scaffold file (which we are considering watching with live updates) - this would allow substrate frontend devs to prototype their frontend from a single codebase with live updates.

We do not intend on simulating the RPC api of a substrate node (it is fairly trivial to implement "god mode" on a real node), so instead a second component is a drop-in replacement library with the same api as polkadot.js - possibly with the ability to swap between interfacing with a real instance of polkadot.js connected to a genuine substrate chain, and interfacing with our JS chain simulation server.

Work Done to Date

  • Simulated Block Production
  • Multiple account management (not cryptographic)
  • In-memory simulated database
  • simulated extrinsics
  • simulated events

Work to be Done / Milestones

  • Generating a scaffold from required functions and storage apis
  • Your suggestions?

Budget

budget range AND reasoning/time estimations are open to discussion -
ie, $10000-$20000 split between 2 devs for 2 weeks of full-time work (since project is already partially complete)

DatDot is W3F Grant funded but the scope of our project has changed over time, as such, we have not completed or requested our 2nd and 3rd grant milestones (the team has only received a total of $15k to date) - we have been self funded over the course of the past year as we did not intend for grant funding to cover all of our costs - funds from this proposal will go towards ongoing salary payments to the contractors in our team who cannot afford to self-fund, and potentially towards funding other projects in our ecosystem building components we will likely use in the future (https://github.com/datrs, as an example).

Onchain addresses we will use are listed on the datdot website

Up
Comments
No comments here