From 2ca2caddb3c27e1772bdac7479cecc9877ede319 Mon Sep 17 00:00:00 2001 From: YanOctavian Date: Wed, 22 Nov 2023 13:52:03 +0800 Subject: [PATCH] add subsmt.md --- applications/subsmt.md | 165 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 applications/subsmt.md diff --git a/applications/subsmt.md b/applications/subsmt.md new file mode 100644 index 00000000000..8d3d7070f4d --- /dev/null +++ b/applications/subsmt.md @@ -0,0 +1,165 @@ +# SubSMT + +- **Team Name:** farcloud-labs +- **Payment Address:** 0xd08aD17A0336b52099ae54C81E668aeBfB3c968e(USDC) +- **[Level](https://github.com/w3f/Grants-Program/tree/master#level_slider-levels):** 2 + +## Project Overview :page_facing_up: +On-chain resources are precious, and more and more teams, especially L2, +need to put data and calculations off-chain, and Merkel trees are used more frequently. +Sparse Merkle trees are widely used in blockchains, and have been used hundreds of thousands of times in the Ethereum community. +Polkadot uses the rust language as its development language, and the implementation of sparse Merkel trees currently lacks a unified solution. +Especially in substrate and ink, if there is an implementation template for sparse Merkle trees, +it will greatly save the community's development time and avoid repeated development. +This project will do just that. +### Overview + +- tags `rust, substrate, ink, sparse-merkle-tree, rocksdb, paritydb` +- Provides a substrate-based pallet, an ink-based smart contract and an off-chain data backend. +- Sparse Merkle trees are widely used in blockchain technology solutions and can be used to store data and verify data integrity, +reducing the computing and storage pressure of the chain. We noticed that there is currently only the MMT solution in substrate, +and sparse Merkle trees should also be provided to allow community developers to have more choices and avoid repeated development. + +### Project Details +#### technology stack +language: `rust, substrate, ink`. +1. Sparse Merkle tree and data backend implemented in rust. +2. Pallet for verifying sparse Merkle root. +3. Verify sparse Merkle tree root, ink contract. + +#### What your project is *not* or will *not* provide or implement +For the specific off-chain implementation of the sparse Merkle tree, +we will not reinvent the wheel and directly use [https://github.com/nervosnetwork/sparse-merkle-tree](https://github.com/nervosnetwork/sparse-merkle-tree), +but we may make necessary changes to it. such as in smart contracts, +resources are precious, so use the algorithm that consumes the least Gas as much as possible, and for example, change some of its code to be compatible with substrate. +Here’s to thanking them for their great work. +On-chain, we use the most intuitive and gas-saving verification method to meet the gas-saving needs of all teams. + +In orbiter's Ethereum smart contract, we originally planned to use [https://github.com/nervosnetwork/sparse-merkle-tree](https://github.com/nervosnetwork/sparse-merkle-tree) directly, +but later found that there are much serialization and verification algorithm levels that do not meet our needs to consume the least Gas. +This is also the reason why we provide this project for the Polkadot community to use. This will prevent community developers from having to do something like this repeatedly. + + +### Ecosystem Fit + +SubSMT serves projects that require off-chain storage and then on-chain verification of data integrity. +This project is suitable for teams that want to use sparse Merkel trees and is also the best choice. +In the Polkadot ecosystem, the only implementation of Merkle tree is MMT. This is an urgent need for sparse Merkle trees with a large user base. +With this unified solution, community tools are further improved and the development ecosystem is further prosperous, +which greatly helps developers spend more time. + +Our goal is to create a Polkadot eco-friendly sparse Merkle tree solution based on rust, substrate and ink, not other languages. Developing +based on rust will be beneficial to the use of ecological projects because it has greater compatibility. +And many zero-knowledge proofs use languages similar to rust or use rust directly, which can be used by them in the future. + +## Team :busts_in_silhouette: + +### Team members + +* YanOctavian +* octavei +* linkdrone1 + +### Contact + +- **Contact Name:** YanOctavian +- **Contact Email:** farcloud@proton.me + +### Legal Structure + +- **Registered Address:** Shore Residence, Tower C2, Sunrise Dr. FLOOR 17, Sea View, Pasay, Philippines +- **Registered Legal Entity:** N/A + +### Team's experience +* `YanOctavian` worked in the Ethereum L2 cross-chain bridge Orbiter team, responsible for decentralized sequencer development and decentralized client submitter development. He has 3 years of rust development experience and 5 years of blockchain smart contract development experience. +* `octavei` development engineer of Aband Network, with 4 years experience in substrate development. Familiar with Ethereum and EOS smart contracts. Have done many blockchain projects. +* `linkdrone1` Core developer and leader of the Ethereum L2 cross-chain bridge Orbiter team. +### Team Code Repos + +- https://github.com/farcloud-labs/submitter +- https://github.com/farcloud-labs/subsmt +- https://github.com/farcloud-labs/sparse-merkle-tree + +*** +- https://github.com/YanOctavian +- https://github.com/linkdrone +- https://github.com/Octavei + + +## Development Status :open_book: + +- https://github.com/farcloud-labs/subsmt + +## Development Roadmap :nut_and_bolt: + +### Overview + +- **Total Estimated Duration:** 3 months +- **Full-Time Equivalent (FTE):** 5 FTE +- **Total Costs:** 21000 USD + +### Milestone 1 - SMT pallet, SMT ink smart contract, and backend base on rocksdb. + +- **Estimated duration:** 1 month +- **FTE:** 2 +- **Costs:** 10,000 USD + +> :exclamation: **The default deliverables 0a-0d below are mandatory for all milestones**, and deliverable 0e at least for the last one. + +| Number | Deliverable | Specification | +|--------:|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **0a.** | License | Apache 2.0 | +| **0b.** | Documentation | We will provide both **inline documentation** of the code and a basic **tutorial** that explains how a user can (for example) spin up one of our Substrate nodes and send test transactions, which will show how the new functionality works. | +| **0c.** | Testing and Testing Guide | Core functions will be fully covered by comprehensive unit tests to ensure functionality and robustness. In the guide, we will describe how to run these tests. | +| **0d.** | Docker | We will provide a Dockerfile(s) that can be used to test all the functionality delivered with this milestone. | +| 1. | verify root | An intuitive and gas-saving method for verifying merkel roots. | +| 2. | Substrate module: SMT | We will create a Substrate module that will verify Merkle root | +| 3. | Smart contracts(ink): SMT | We will deliver a set of ink! smart contracts that will will verify Merkle root +| 4. | smt-rocksdb-store(backend) | Sparse merkle tree rocksdb store implementation | +| 5. | SDK | Provide rpc to the backend for updating and deleting, obtaining root, verifying root, etc. | + +### Milestone 2 - backend base on parity-db and common backend. +- **Estimated Duration:** 1 month +- **FTE:** 2 +- **Costs:** 8,000 USD + +| Number | Deliverable | Specification | +|--------:|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **0a.** | License | Apache 2.0 | +| **0b.** | Documentation | We will provide both **inline documentation** of the code and a basic **tutorial** that explains how a user can (for example) spin up one of our Substrate nodes and send test transactions, which will show how the new functionality works. | +| **0c.** | Testing and Testing Guide | Core functions will be fully covered by comprehensive unit tests to ensure functionality and robustness. In the guide, we will describe how to run these tests. | +| **0d.** | Docker | We will provide a Dockerfile(s) that can be used to test all the functionality delivered with this milestone. | +| **0e.** | Article | We will publish an **article** that explains How SubSMT works | +| 1. | smt-paritydb-store(backend) | Sparse merkle tree parity-db store implementation | +| 2. | SDK | Provide rpc to the backend for updating and deleting, obtaining root, verifying root, etc. | +| 3. | common-backend | A backend compatible with smt-rocksdb-store and smt-paritydb-store | + + +### Milestone 3 - Compatible with EVM, allowing it to be used in smart contracts on parallel chains such as moonbeam. +- **Estimated Duration:** 0.5 month +- **FTE:** 1 +- **Costs:** 3,000 USD + +| Number | Deliverable | Specification | +|--------:|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **0a.** | License | Apache 2.0 | +| **0b.** | Documentation | We will provide both **inline documentation** of the code and a basic **tutorial** that explains how a user can (for example) spin up one of our Substrate nodes and send test transactions, which will show how the new functionality works. | +| **0c.** | Testing and Testing Guide | Core functions will be fully covered by comprehensive unit tests to ensure functionality and robustness. In the guide, we will describe how to run these tests. | +| **0d.** | Docker | We will provide a Dockerfile(s) that can be used to test all the functionality delivered with this milestone. | +| 1. | Smart contracts(solidity): SMT | We will deliver a set of solidity smart contracts that will will verify Merkle root | +| 2. | backend | Based on the common-backend development of the second milestone, but the selection of data serialization and verification methods is slightly different. This part may tend to use abi or klp to serialize data. In short, it is compatible with Ethereum and saves gas, because the gas on EVM is more expensive. | + + +## Future Plans +- On-chain implementation of more functions besides verifying Merkel root. +- Provide more permanent storage solutions off-chain, not just rocksdb and parity-db. + +## Referral Program (optional) :moneybag: + +- **Referrer:** [JimYam](https://github.com/w3f/Grants-Program/pull/1050) +- **Payment Address:** 0x2c738f52A6BC738d556095A79b9fc49359fE0159(USDT) + +## Additional Information :heavy_plus_sign: + +**How did you hear about the Grants Program?** personal recommendation. +