forked from DECA/DAOTask
89 lines
4.2 KiB
Markdown
89 lines
4.2 KiB
Markdown
# Module 1 Specification
|
|
|
|
## Goal
|
|
|
|
This module 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.
|
|
|
|
|
|
## Dependencies
|
|
- [ ] Module 0
|
|
|
|
## ToDo
|
|
|
|
- [ ] 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.
|
|
|
|
## Report
|
|
|
|
* Upon doing reaserch on helia, we found that some of the methods on implementing JavaScript on Rust with callback and using yew have problems with the
|
|
imports of Helia.
|
|
The following are issues found with the different methods:
|
|
1. With web-pack: While trying to import Helia's libraries on a previosly working app using callback to implement JavaScript on a yew template, we
|
|
stumbled upon an error in which we couldn't install the Helia library due to there being too many packages.
|
|
Possible solutions implemented:
|
|
- Importing Helia from the import link instead of installing the library, though one of the problems with this solution is that you can't do imports
|
|
and at the same time export a function with the JS callback on Rust. It was necessary to first import the Helia library and then use it for the export function.
|
|
- Adding the import links to the index.html like script modules.
|
|
|
|
2. After not finding a concrete solution that would help us with the import, I decided to follow the yew tutorial drive through libraries that was very well
|
|
documented but a little outdated since it was using yew version 12. Now the problem was the it had two errors that wouldn't let me run the app.
|
|
Specific errors found:
|
|
* error [E0433]: failed to resolve: unresolved import (a function from the wasm-bindgen.rs that comes from the version of wasm-bindgen that you installed)
|
|
* error [E0425]: cannot find the function 'wasm_bindgen_initialized' in this scope (also coming from wasm-bindgen.rs).
|
|
|
|
|
|
Possible solutions implemented:
|
|
|
|
- Updating to the newest version of wasm_bindgen.
|
|
- Trying to change the imports of wasm_bindgen.
|
|
- Adding the dependency to de Cargo.toml file.
|
|
> None of these solutions worked
|
|
|
|
3. Currently using the yew-interop to asynchronously Load CSS or Javascript libraries which allows you to import libraries from links and also implements
|
|
JavaScript scripts to Rust.
|
|
Using the example provided in the examples GitHub repository to know how to have the correct structure and succesfully import everything necessary for the app.
|
|
|
|
### HELIA Specification
|
|
* [Helia library](https://github.com/ipfs/helia)[^1]
|
|
* [Helia Examples](https://github.com/ipfs-examples/helia-examples/tree/main/examples/helia-webpack)[^2]
|
|
* [Helia Example by Phind](https://www.phind.com/search?cache=v6nzolbm7xl10xvhgfih6bvz)[^3]
|
|
|
|
### 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
|
|
2.
|
|
|
|
## Notes and further developments.
|
|
|
|
1. Make the ENS Updateable by a DAO and a smart wallet.
|
|
|
|
## References
|
|
|
|
[^1]: https://github.com/ipfs/helia
|
|
[^2]: https://github.com/ipfs-examples/helia-examples/tree/main/examples/helia-webpack
|
|
[^3]: https://dev.to/davidedelpapa/yew-tutorial-05-drive-through-libraries-2gj5
|
|
[^4]: https://github.com/Madoshakalaka/yew-interop
|
|
[^5]: https://github.com/Madoshakalaka/yew-interop/tree/master/example
|
|
[^6]: https://rustwasm.github.io/wasm-bindgen/examples/import-js.html
|