2021-08-12 18:03:19 +03:00
|
|
|
# IPFS code execution example
|
2021-09-12 00:51:50 +03:00
|
|
|
|
2021-07-21 11:37:25 +03:00
|
|
|
This example showcases 2 things:
|
2021-09-12 00:51:50 +03:00
|
|
|
|
2021-07-21 11:37:25 +03:00
|
|
|
1. how it's possible to store .wasm modules on IPFS, then deploy them to Fluence as a service
|
|
|
|
2. ability to process IPFS files via a Fluence service. In this example, we get a size of a file
|
|
|
|
|
2021-08-12 18:03:19 +03:00
|
|
|
## Learn about AquaIPFS
|
2021-09-12 00:51:50 +03:00
|
|
|
|
2021-08-12 18:03:19 +03:00
|
|
|
See [Aqua Book](https://doc.fluence.dev/aqua-book/libraries/aqua-ipfs).
|
|
|
|
|
|
|
|
## How to run & use this example
|
2021-09-12 00:51:50 +03:00
|
|
|
|
|
|
|
You need npm v7 or later to run the examples
|
|
|
|
|
2021-08-12 18:03:19 +03:00
|
|
|
### Web example
|
2021-09-12 00:51:50 +03:00
|
|
|
|
2021-07-21 11:37:25 +03:00
|
|
|
1. Run it
|
2021-09-12 00:51:50 +03:00
|
|
|
|
2022-02-08 14:01:15 -06:00
|
|
|
```bash
|
|
|
|
npm i
|
|
|
|
npm run build -w aqua
|
|
|
|
npm start -w web
|
|
|
|
```
|
2021-07-21 11:37:25 +03:00
|
|
|
|
|
|
|
2. Press "deploy"
|
|
|
|
3. Copy WASM service CID and press "get_size"
|
|
|
|
|
2021-08-12 18:03:19 +03:00
|
|
|
### NodeJS example
|
2021-09-12 00:51:50 +03:00
|
|
|
|
2022-02-08 14:01:15 -06:00
|
|
|
```bash
|
2021-08-12 18:03:19 +03:00
|
|
|
npm i
|
2021-10-13 19:19:53 +03:00
|
|
|
npm run build -w aqua
|
2021-09-12 00:51:50 +03:00
|
|
|
npm start -w nodejs
|
2021-08-12 18:03:19 +03:00
|
|
|
```
|
|
|
|
|
2021-07-21 11:37:25 +03:00
|
|
|
## Aqua implementation
|
|
|
|
|
2021-09-12 00:51:50 +03:00
|
|
|
The business logic is implemented in Aqua in [process.aqua](aqua/aqua/process.aqua)
|