DAOTask/module2/module2_rust.md

113 lines
3.9 KiB
Markdown

# Alternative to Module 1 R&D in Rust and WASM
## Goal
the Car and Trunk R&D to ensure that the trunk build website (yew mostly)
builds a decentralizable website and assets. Consider using CAR
management for the assets.
HELIA R&D will ensure that the website and its assets runs in a HELIA instance.
This will add seeds and thus network speed to the content distribution. All the
assets should be integrated in the project so that it does not depend on centralized
systems. This module is important to ensure frontend decentralization.
Ethers-web with ethers-rs and wasm implementation, so that it connects
to the Ethereum blockchain and perform some testing operations. The Goal is to
ensure the ethers connector can be decentralized and included in the project code.
This module is important to ensure comunication with the smart contracts in a
decentralized way.
## RUST/WASM Architecture Diagram
![dig1](./diagram1.svg)
> dig1. Shows the front end DAPP architecture for SBT
## ToDo
- [ ] Research CAR
- [ ] Detect and Report issue (Update this specification)
- [ ] Research and test possible solutions.
- [ ] Implement solution to achieve the goal.
- [ ] Research HELIA
- [ ] How to solve the website hashing paradigm
- [ ] Detect and Report issue (Update this specification)
- [ ] Research and test possible solutions.
- [ ] Implement solution to achieve the goal.
- [ ] Basic understading YEW
- [ ] Basic understading Ethers-rs(similar sintax to ethers-web)
- [ ] Fork main chain
- [ ] Create a base project to interact with DECA Smart Contract
- [ ] Create some general access to functions for th DECA Smart Contract
## CAR Specification
* [CAR library](https://github.com/web3-storage/ipfs-car)[^1]
* [CAR Reference](https://ipld.io/specs/transport/car/)[^2]
### Trunk found issues
Trunk Creates the instances based a proyect path, we require something such as
[make relative](https://github.com/tmcw/make-relative)[^3] for IPFS support.
### Possible solutions
Fork and Rewrite Trunk.
### Cargo References
[^1]: https://github.com/web3-storage/ipfs-car
[^2]: https://ipld.io/specs/transport/car/
[^3]: https://github.com/tmcw/make-relative
## HELIA Specification
* [Helia library](https://github.com/ipfs/helia)[^4]
* [Helia Examples](https://github.com/ipfs-examples/helia-examples/tree/main/examples/helia-webpack)[^5]
* [Helia Example by Phind](https://www.phind.com/search?cache=v6nzolbm7xl10xvhgfih6bvz)[^6]
### Hashing paradigm
To have a self decentralized website we need to add a hash to the code this hash
known as CID is generated based on all the assets hashed data, so it makes a
paradigm problem to add the hash if its not know previously in the code, because
if we add it to the code of the site, the project hash will change.
### Possible solutions
1. Using SmartContract: Use a smart contract with an IPNS and a ENS
(Ethereum Name Service NFT) which points to an IPNS that will be updated by the
project developer. This gives us the flexibility to update, and security that
the blockchain offers. This can also be an alternative to avoid MITM and other
security issues.
* Pros: ToDo
* Cons: ToDo
### Notes and further developments.
1. Make the ENS Updateable by a DAO and a smart wallet.
### HELIA References
[^4]: https://github.com/ipfs/helia
[^5]: https://github.com/ipfs-examples/helia-examples/tree/main/examples/helia-webpack
[^6]: https://www.phind.com/search?cache=v6nzolbm7xl10xvhgfih6bvz
## ETHERS-WEB Specification
* [Alloy-rs library](https://github.com/tmcw/make-relative)[^7]
* [Ethers-web library](https://github.com/quay-rs/ethers-web/tree/main)[^8]
* [Ethers-rs docs](https://docs.rs/ethers/latest/ethers/index.html)[^9]
### Notes and further developments.
> Note1: Ethers-rs will be depercated in favor of [alloy](https://github.com/alloy-rs/) (yet alloy is not
production ready).
### Ethers References
[^7]: https://github.com/alloy-rs/
[^8]: https://github.com/quay-rs/ethers-web/tree/main
[^9]: https://docs.rs/ethers/latest/ethers/index.html