Code Monkey home page Code Monkey logo

examples's Introduction

Examples

This repo holds a collection of examples on how to build distributed applications with the Fluence stack.

The aqua-examples directory contains examples demonstrating the use of Aqua to compose decentralized applications from distributed services, whereas the marine-examples directory contains examples with respect to the development of Rust Wasm modules.

If you encounter a problem, please post an Issue or open a PR. If you want to contribute an example, please contact us by opening an Issue or a draft PR. See the contribution guidelines.

Resource Directory

  • The IPFS Integration shows how to use the aqua-ipfs library to deploy single-module Wasm services to a Fluence node from a IPFS sidecar

    • Fluence JS, Aqua
  • The Near Integration provides integration examples for the Near API JS and RPC API. We use Fluence JS to implement a minimal Near signing service and wrap a few select RPC examples into a Wasm module.

    • Fluence JS, Rust Wasm, Aqua
  • The Timestamp Oracle illustrates how to use builtin services to acquire timestamps from a node's Kademlia neighborhood and then process those timesstamps using Wasm services into point or range estimates.

    • Aqua, Rust Wasm
  • The Price Oracle provides a stylized example of how to create a price stream oracle using Rust Wasm services. Further provides a Fluent JS and Web client examples.

    • Rust Wasm, Fluence JS, Aqua
  • The EIP712 Validator Node provides a stylized example of validating signed EIP712 forms and storing the results in a local sqlite database. We use Fluence JS to implement both peer and client, where the peer expose sqlite crud interfaces allowing other peers to query validations and form a consensus.

    • Rust Wasm, Fluence JS, Aqua, SQLite

License

Unless otherwise indicated, the applicable license is Apache 2.0.

examples's People

Contributors

akim-bow avatar andreishapel avatar boneyard93501 avatar coder11 avatar dependabot[bot] avatar diemyst avatar folex avatar ig0r avatar inversionspaces avatar joera avatar meph avatar nahsi avatar raftedproc avatar renovate[bot] avatar shamsartem avatar valeryantopol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

WLS fluence init hello-world Error: No such file or directory (os error 2)

WLS

An error occurred while building the project

kevin@LAPTOP-42HSF5M2:/mnt/d/blockchain/fluence$ fluence init hello-world-20240413
? Select template quickstart
Using local blockchain environment
Error: No such file or directory (os error 2)
Error: Command: /home/kevin/.fluence/cargo/marine/0.19.7/bin/marine build -p myService --release exited with code 1
kevin@LAPTOP-42HSF5M2:/mnt/d/blockchain/fluence$

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @fluencelabs/aqua Unavailable
npm @fluencelabs/fluence Unavailable
npm @fluencelabs/js-client.api Unavailable
npm @fluencelabs/js-client.node Unavailable

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
aqua-examples/aqua-ipfs-integration/service/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/decentralized-blockchain-gateway/wasm-modules/curl-adapter/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/decentralized-blockchain-gateway/wasm-modules/eth-rpc/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/decentralized-blockchain-gateway/wasm-modules/ipfs-adapter/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/decentralized-blockchain-gateway/wasm-modules/ipfs-cli/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/decentralized-blockchain-gateway/wasm-modules/multi-provider-query/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/decentralized-blockchain-gateway/wasm-modules/simple-quorum/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/decentralized-blockchain-gateway/wasm-modules/utilities/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/drand/services/curl_adapter/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/drand/services/drand/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/echo-greeter/echo-service/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/echo-greeter/greeting/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/echo-greeter/secure-greeter/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/echo-greeter/utilities/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/near-integration/services/near-adapter/modules/curl-adapter/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/near-integration/services/near-adapter/modules/near-rpc-services/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/price-oracle/curl_adapter/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/price-oracle/mean_service/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/price-oracle/price_getter_service/Cargo.toml
  • marine-rs-sdk 0.10.1
aqua-examples/ts-oracle/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
aqua-examples/vrfun/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
marine-examples/build_rs/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
  • marine-rs-sdk-test 0.11.0
marine-examples/call_parameters/service/modules/call_parameters/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
marine-examples/greeting/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
marine-examples/multiservice_marine_test/Cargo.toml
  • marine-rs-sdk-test 0.11.0
marine-examples/multiservice_marine_test/consumer/Cargo.toml
  • marine-rs-sdk 0.10.1
marine-examples/multiservice_marine_test/producer/Cargo.toml
  • marine-rs-sdk 0.10.1
marine-examples/records/facade/Cargo.toml
  • marine-rs-sdk 0.10.1
marine-examples/records/pure/Cargo.toml
  • marine-rs-sdk 0.10.1
marine-examples/records/test-record/Cargo.toml
  • marine-rs-sdk 0.10.1
marine-examples/sqlite/service/modules/sqlite_test/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
marine-examples/url-downloader/service/modules/curl_adapter/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
marine-examples/url-downloader/service/modules/local_storage/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
marine-examples/url-downloader/service/modules/url_downloader/Cargo.toml
  • marine-rs-sdk 0.10.1
  • marine-rs-sdk-test 0.11.0
quickstart/2-browser-parallel-computation/src/services/adder/modules/adder/Cargo.toml
  • marine-rs-sdk 0.10.0
  • marine-rs-sdk-test 0.10.0
docker-compose
aqua-examples/aqua-ipfs-integration/local-network/docker-compose.yml
github-actions
.github/workflows/js-projects.yml
npm
aqua-examples/aqua-ipfs-integration/aqua/package.json
  • @fluencelabs/aqua-ipfs ^0.5.5
  • @fluencelabs/fluence ^0.28.0
  • @fluencelabs/fluence-network-environment 1.1.2
  • @fluencelabs/aqua 0.10.3
  • @fluencelabs/aqua-lib 0.7.7
aqua-examples/aqua-ipfs-integration/nodejs/package.json
  • @fluencelabs/fluence ^0.28.0
  • @fluencelabs/fluence-network-environment 1.1.2
  • @fluencelabs/aqua 0.10.3
  • @fluencelabs/aqua-lib 0.7.7
aqua-examples/aqua-ipfs-integration/package.json
  • @fluencelabs/aqua 0.10.3
  • @fluencelabs/fluence 0.28.0
aqua-examples/aqua-ipfs-integration/web/package.json
  • @fluencelabs/fluence 0.28.0
  • @fluencelabs/fluence-network-environment 1.1.2
aqua-examples/decentralized-blockchain-gateway/gateway/package.json
  • @fluencelabs/js-client.node 0.7.1
  • @fluencelabs/js-client.api 0.13.1
aqua-examples/echo-greeter/client-peer/package.json
  • @fluencelabs/fluence ^0.28.0
  • @fluencelabs/fluence-network-environment ^1.0.13
  • @fluencelabs/aqua 0.10.3
  • @fluencelabs/aqua-lib 0.7.7
aqua-examples/near-integration/near-signing-node/package.json
  • @fluencelabs/fluence 0.28.0
  • @fluencelabs/fluence-network-environment 1.1.2
  • @fluencelabs/aqua 0.10.3
  • @fluencelabs/aqua-lib 0.7.7
aqua-examples/price-oracle/client-peer/package.json
  • @fluencelabs/fluence ^0.28.0
  • @fluencelabs/fluence-network-environment 1.1.2
  • @fluencelabs/aqua 0.10.3
  • @fluencelabs/aqua-lib 0.7.7
aqua-examples/price-oracle/web/package.json
  • @fluencelabs/fluence 0.28.0
  • @fluencelabs/fluence-network-environment 1.1.2
  • @fluencelabs/aqua 0.10.3
js-client-examples/browser-example/src/frontend/package.json
  • @fluencelabs/js-client ^0.5.4
js-client-examples/hello-world/src/frontend/package.json
  • @fluencelabs/js-client ^0.5.4
js-client-examples/marine-service/src/frontend/package.json
  • @fluencelabs/js-client 0.5.4
js-client-examples/node-example/src/frontend/package.json
  • @fluencelabs/js-client ^0.5.4
marine-examples/url-downloader/src/package.json
quickstart/1-browser-to-browser/src/frontend/package.json
  • @fluencelabs/js-client ^0.5.4
quickstart/2-browser-parallel-computation/src/frontend/package.json
  • @fluencelabs/js-client ^0.5.4

  • Check this box to trigger a request for Renovate to run again on this repository

Use max_heap_size in service examples

Almost all service examples here use obsolete mem_pages_count setting in a Marine config. We need to replace them with superseeded max_heap_size instead to provide fully functional up-to-date examples.

Improvement: Include exact tooling versions in the docs

Hi,

I find the examples the best spot to learn the Aqua, Marine, and overall Fluence protocol. Due to the recent(good) improvements on Nodejs, it would be great to:

  1. Update project README.md to exclusively tell the user what versions of Nodejs, and Rust to use. This is super helpful to help people know what exact version of the tooling they should use.

So that a significant amount of time is not spent resolving incompatibilities and resolving breaking things.

Best,
Naftali

Example.browser-to-browser not working with Ubuntu bulseye

hi

I did comands
1 git clone https://github.com/fluencelabs/examples
2 cd examples/quickstart/1-browser-to-browser
3 npm install


[email protected] postinstall /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser
copy-avm-public public

ensure directory exists: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/public
copying AVM wasm
from: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/node_modules/@fluencelabs/avm/dist/avm.wasm
to: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/public/avm.wasm
done!
ensure directory exists: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/public
copying avm runner script
from: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/node_modules/@fluencelabs/avm-runner-background/dist/runnerScript.web.js
to: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/public/runnerScript.web.js
done!
ensure directory exists: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/public
copying marine-js wasm
from: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/node_modules/@fluencelabs/marine-js/dist/marine-js.wasm
to: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/public/marine-js.wasm
done!
npm WARN @testing-library/[email protected] requires a peer of @testing-library/dom@>=7.21.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of puppeteer@>= 1.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of node-fetch@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 1911 packages in 15.762s

190 packages are looking for funding
run npm fund for details

found 23 vulnerabilities (10 low, 13 moderate)
run npm audit fix to fix them, or npm audit for details


4 npm run compile-aqua


0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'compile-aqua' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'precompile-aqua', 'compile-aqua', 'postcompile-aqua' ]
5 info lifecycle [email protected]precompile-aqua: [email protected]
6 info lifecycle [email protected]
compile-aqua: [email protected]
7 verbose lifecycle [email protected]compile-aqua: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
compile-aqua: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/kirill/fluence/test/examples/quickstart/1-browser-to-browser/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle [email protected]compile-aqua: CWD: /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser
10 silly lifecycle [email protected]
compile-aqua: Args: [ '-c', 'aqua -i ./aqua/ -o ./src/_aqua' ]
11 silly lifecycle [email protected]compile-aqua: Returned: code: 1 signal: null
12 info lifecycle [email protected]
compile-aqua: Failed to exec compile-aqua script
13 verbose stack Error: [email protected] compile-aqua: aqua -i ./aqua/ -o ./src/_aqua
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/kirill/fluence/test/examples/quickstart/1-browser-to-browser
16 verbose Linux 5.13.0-35-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "compile-aqua"
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] compile-aqua: aqua -i ./aqua/ -o ./src/_aqua
22 error Exit status 1
23 error Failed at the [email protected] compile-aqua script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]


Failed to run browser-to-browser example in the devcontainer.

I trying to run browser-to-browser example in devcontainer (without vscode), but it fails.

  1. I pulled fluencelabs/devcontainer (image ID 8345668a42fe )

  2. I started it: docker run --rm -it fluencelabs/devcontainer. Working directory is the root directory.

  3. I executed git clone --depth 1 https://github.com/fluencelabs/examples.git examples, the first line from /download_examples.sh script. Current commit 013ceb6.

  4. In directory /examples/quickstart/1-browser-to-browser I issued npm install, as recommended by the tutorial.

  5. The command finished successfully (exit code 0), albeit with warnings and update notifications.

  6. I issued npm start, as recommended by the tutorial.

  7. I saw Starting the development server..., then

    Failed to compile.
    
    ./src/App.tsx
    Module not found: Can't resolve './_aqua/getting-started' in '/examples/quickstart/1-browser-to-browser/src'
    

Expected: it starts listening development server on port 3000, as per the tutorial.

  1. As a workaround attempt, I exited (Ctrl+C) the npm start and did this command: mkdir src/_aqua && aqua-cli --input aqua/getting-started.aqua --output src/_aqua (not taken from the tutorial). It had finished successfully and produced getting-started.ts file, but npm start still does not work:

    Failed to compile.
    
    ./src/App.tsx
    Attempted import error: 'registerHelloPeer' is not exported from './_aqua/getting-started'.
    

Does devcontainer and tutorial really support VSCode-less experimentation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.