-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(readme): Enhance readme #113
Changes from 5 commits
b09fdb7
95b0f6f
2065e63
31519c8
1b0f679
f8e431e
18e317d
6125f49
7d0b84d
1be33f2
c20221f
8976386
87fc619
af5cf72
c2e4265
777d01b
d0dbdd1
b05d4d2
79610cc
d8735e9
1d3419e
5ec5c33
58e9757
e07e926
1dcc2f0
7b37ab2
12b0681
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ If you don't have Fluence CLI installed, do: | |
npm -g i @fluencelabs/cli@unstable | ||
``` | ||
|
||
Before you proceed, you should have, say, three RPC endpoint urls, e.g., Infura, Alchemy and QuickNode, for the same EVM-based chain you are using in your dAPP. Update the `configs/quickstart_config.json` by providing your endpoint urls and ignore the rest of the parameters for now: | ||
Before you proceed, you should have, say, three RPC endpoint urls, e.g., Infura, Alchemy and QuickNode, for the same EVM-based chain you are using in your dAPP. Update the `configs/quickstart_config.json` by providing your endpoint urls and ignore the rest of the parameters for now: | ||
|
||
```json | ||
{ | ||
|
@@ -81,8 +81,15 @@ Before you proceed, you should have, say, three RPC endpoint urls, e.g., Infura | |
|
||
Now start the gateway: | ||
|
||
```bash | ||
**Command**: | ||
|
||
``` | ||
InversionSpaces marked this conversation as resolved.
Show resolved
Hide resolved
|
||
npm -C gateway run run configs/quickstart_config.json | ||
``` | ||
|
||
**Output**: | ||
|
||
```bash | ||
> @fluencelabs/aqua-eth-gateway@0.0.11 run | ||
> fluence aqua -i aqua/ -o aqua-compiled/ --js && node src/index.js configs/my_quickstart_config.json | ||
|
||
|
@@ -99,13 +106,19 @@ Server was started on port 3000 | |
|
||
With the gateway ready for action, all you have to do is change your dApps HTTP transport url to `http://127.0.0.1:3000` and keep using your dApp as usual. In the absence of a dAPP, we can interact with the gateway from the command line: | ||
|
||
**Command**: | ||
|
||
```bash | ||
curl http://127.0.0.1:3000 \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":100}' | ||
``` | ||
|
||
**Output**: | ||
|
||
{"jsonrpc":"2.0","id":100,"result":"0x82b950" | ||
```bash | ||
{"jsonrpc":"2.0","id":100,"result":"0x82b950"} | ||
InversionSpaces marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# with the corresponding gateway log output | ||
Receiving request 'eth_blockNumber' | ||
|
@@ -117,12 +130,18 @@ Call will be to : https://eth-goerli.g.alchemy.com/v2/<your api key> | |
|
||
Since we have specified *round-robin* in our config file and have more than one endpoint url in play, re-running the json-rpc call should result in a different endpoint selection: | ||
|
||
**Command**: | ||
|
||
```bash | ||
curl http://127.0.0.1:3000 \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":100}' | ||
``` | ||
|
||
**Output**: | ||
|
||
```bash | ||
{"jsonrpc":"2.0","id":100,"result":"0x82b956"} | ||
|
||
# with the corresponding gateway log output | ||
|
@@ -132,7 +151,6 @@ peerId: 12D3KooWKDnWpCLPJrycSevracdEgGznfDPwG1g5CWbt8uccdL79 | |
Counter: 2 | ||
Worker used: "12D3KooWKPcNwR6EMq3sqm4sKtUKmZbMhPQ2dk1zr8YNgjdu9Xqn" | ||
Call will be to : https://frequent-sleek-river.ethereum-goerli.discover.quiknode.pro/<your api key>/ | ||
|
||
``` | ||
|
||
Success! Go ahead and replace the `round-robin` mode with the `random` mode in your config file, stop and start the gateway and have a look at the different endpoint management. | ||
|
@@ -194,7 +212,7 @@ While this sounds, and is, elaborate, *Fluence CLI*, see below, takes care of mo | |
|
||
To get going, you need to install and setup a few dependencies. | ||
|
||
> Fluence tooling works on most *nix systems including OSX and Windows Linux Subsystem. At this time, Windows is not supported. | ||
> Fluence tooling works on most \*nix systems including OSX and Windows Linux Subsystem. At this time, Windows is not supported. | ||
|
||
### Off-chain Dependencies | ||
|
||
|
@@ -300,7 +318,6 @@ mountedBinaries: # effector module specific: what mechanism is used | |
|
||
The minimum key for a module file are: version, type and name. Effector modules, however, may need additional information such as [MountedBinaries](https://fluence.dev/docs/marine-book/marine-runtime/mounted-binaries). Such information needs to be manually added. | ||
|
||
|
||
#### project-secrets.yaml, user-secrets.yaml -- the cryptographic key file | ||
|
||
Fluence uses cryptographic keys in a variety of contexts including end-to-end encryption, client peer id determination and securing services. By default, Fluence CLI creates a keypair in *user-secrets.yaml*, which is placed in the global *.fluence* directory in your home directory. | ||
|
@@ -388,8 +405,15 @@ The *eth_rpc* module manages the json-rpc requests and responses initiated and c | |
|
||
Before you can deploy your service, use `fluence build` in the root dir to compile each module's Rust code to wasm32-wasi output: | ||
|
||
**Command**: | ||
|
||
```bash | ||
fluence build | ||
``` | ||
|
||
**Output**: | ||
|
||
```bash | ||
# Making sure all services are downloaded... | ||
# Making sure all services are built... | ||
Finished release [optimized] target(s) in 0.61s | ||
|
@@ -399,8 +423,15 @@ See [target dir]("./target/wasm32-wasi/release") for *curl_adapter.wasm* and *et | |
|
||
`fluence service repl` | ||
|
||
**Command**: | ||
|
||
```bash | ||
fluence service repl | ||
``` | ||
|
||
**Output**: | ||
|
||
```bash | ||
? Enter service name from fluence.yaml, path to a service or url to .tar.gz archive wasm-modules | ||
# Making sure service and modules are downloaded and built... | ||
Finished release [optimized] target(s) in 0.18s | ||
|
@@ -473,79 +504,106 @@ Regardless of your customization requirements, you probably will have no reason | |
|
||
Fluence CLI allows you to quickly create a new, or add an existing, module to your project. For example, | ||
|
||
**Command**: | ||
|
||
```bash | ||
fluence module new --path ./wasm-modules demo-module | ||
``` | ||
|
||
**Output**: | ||
|
||
```bash | ||
Successfully generated template for new module at demo-module | ||
``` | ||
|
||
Which created a Rust project in the *wasm-module/demo-module* directory ready for you to customize. When you're done, you add the new module to your service config, service.yaml: | ||
|
||
**Command**: | ||
|
||
```bash | ||
fluence module add | ||
``` | ||
|
||
**Output**: | ||
|
||
```bash | ||
? Enter path to a module or url to .tar.gz archive wasm-modules/demo | ||
? Enter service name from fluence.yaml or path to the service directory wasm-modules | ||
Added demo to ~/localdev/fRPC-Substrate/wasm-modules/service.yaml | ||
``` | ||
|
||
The demo module is now part of the service and `fluence build`, for example, now compiles the *demo* module as part of the project build. You can create a new service with the `fluence service new` command. Note that the implication of creating a new service, possibly in a new project directory, is that you intend to deploy that service separately from the *eth-rpc* service. Of course, you will need to write Aqua code to be able to interact with your new module. | ||
The demo module is now part of the service and `fluence build`, for example, now compiles the *demo* module as part of the project build. You can create a new service with the `fluence service new` command. Note that the implication of creating a new service, possibly in a new project directory, is that you intend to deploy that service separately from the *eth-rpc* service. Of course, you will need to write Aqua code to be able to interact with your new module. | ||
|
||
To get rid of the demo project for now, use `fluence module remove` to unlink the module from the *fluence.yaml* and *service.yaml* files; the old *rm -r <path/demo>* gets rid of the code template. | ||
|
||
### Deploying A Service | ||
|
||
With a service, in this case the *eth-rpc* service, ready for deployment, we simply use the `fluence deal deploy` command: | ||
> :warning: **Warning**: For quickstart, services are already deployed for you. But if you want to deploy services in this repository yourself, you should remove old deployment information first: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
> ```bash | ||
> rm -rf .fluence | ||
InversionSpaces marked this conversation as resolved.
Show resolved
Hide resolved
|
||
> ``` | ||
> `fluence deal deploy` is capable of redeploying services, so you don't have to do it every time. But one can't redeploy a deal he doesn't not own, so you will get a error without this step for this repository. | ||
InversionSpaces marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
With a service, in this case the *eth-rpc* service, ready for deployment, we simply use the `fluence deal deploy`: | ||
|
||
**Command**: | ||
|
||
```bash | ||
fluence deal deploy | ||
Connecting to: /dns4/stage.fluence.dev/tcp/19004/wss/p2p/12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE | ||
``` | ||
|
||
**Output**: | ||
|
||
```bash | ||
Using kras environment to sign contracts | ||
Finished release [optimized] target(s) in 0.05s # (1) | ||
Connecting to kras relay: /dns4/7-kras.fluence.dev/tcp/9000/wss/p2p/12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr | ||
Connected | ||
|
||
Creating deal for worker defaultWorker # (2) | ||
|
||
# 1 if Deal is already in place update or create new Deal? | ||
? Do you want to redeploy worker defaultWorker Yes | ||
Finished release [optimized] target(s) in 0.22s | ||
To approve transactions to your wallet using metamask, open the following url: # (3) | ||
|
||
# 2 upload packaged assets | ||
ipfs: did pin QmTvNwBeDop1yD9dLNjgrzfBMsgtrBmD859ahqQS1EWhbj to /dns4/ipfs.fluence.dev/tcp/5001 | ||
<...> | ||
ipfs: file bafkreichjd77xy3bz4whsuyo2rmtgtwfjh4mqcwlzb74mvpgn5xfrjm72a pinned to /dns4/ipfs.fluence.dev/tcp/5001 | ||
https://cli-connector.fluence.dev/?wc=3df74b36a4459be644172d82e114297a65330ada4e77bc8afba67688064f033e%402&relay-protocol=irn&symKey=5b9b1773203cfe98c86bb8d611ff7945173430f5fb056fcd95f79919adbb0bae | ||
InversionSpaces marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# 3 process upload responses for local updates in workers.yaml | ||
Updating deal for worker defaultWorker | ||
or go to https://cli-connector.fluence.dev and enter the following connection string there: | ||
|
||
# 4 request signing of escrow payment transaction | ||
wc:3df74b36a4459be644172d82e114297a65330ada4e77bc8afba67688064f033e@2?relay-protocol=irn&symKey=5b9b1773203cfe98c86bb8d611ff7945173430f5fb056fcd95f79919adbb0bae | ||
|
||
# Connecting to wallet...... | ||
To approve transactions to your wallet using metamask, open the following url: | ||
Confirm transaction in your wallet... | ||
# Waiting for transaction to be mined...... | ||
To approve transactions to your wallet using metamask, open the following url: # (4) | ||
|
||
https://cli-connector.fluence.dev/?wc=d5494d58588812c1ca148268c5a236daa127092d1a8a7a1db50c2ffdb1aa40be%402&relay-protocol=irn&symKey=d1a4b5954b6e46c1fd70174f0de7a5a78b14346d9d59963baf003d41c90e1284 | ||
https://cli-connector.fluence.dev/?wc=4c6084bf73667a0f02795048002dfdaff8e6b1be22495f989e6d04995ad2e8ba%402&relay-protocol=irn&symKey=8b19aba8c445bd37819f60ef0bafe2e4098424dc5d570a8dfeaf4b57cc1e794d | ||
|
||
or go to https://cli-connector.fluence.dev and enter the following connection string there: | ||
|
||
wc:d5494d58588812c1ca148268c5a236daa127092d1a8a7a1db50c2ffdb1aa40be@2?relay-protocol=irn&symKey=d1a4b5954b6e46c1fd70174f0de7a5a78b14346d9d59963baf003d41c90e1284 | ||
wc:4c6084bf73667a0f02795048002dfdaff8e6b1be22495f989e6d04995ad2e8ba@2?relay-protocol=irn&symKey=8b19aba8c445bd37819f60ef0bafe2e4098424dc5d570a8dfeaf4b57cc1e794d | ||
|
||
Confirm transaction in your wallet... | ||
# Waiting for transaction to be mined...... | ||
3 workers joined the deal 0x06AAe83F938890c47FA7C667392e01D9E3052961 # (5) | ||
|
||
# 5 if escrow payment is processed, deal deployment is finalized | ||
Success! | ||
|
||
Success! | ||
|
||
created deals: | ||
created deals: # (6) | ||
defaultWorker: | ||
deal: https://explorer.testnet.aurora.dev/address/0x258223B18962d804Fca4784245c3a5e0E3Bd8548 | ||
worker definition: bafkreichjd77xy3bz4whsuyo2rmtgtwfjh4mqcwlzb74mvpgn5xfrjm72a | ||
deal: https://mumbai.polygonscan.com/address/0x06AAe83F938890c47FA7C667392e01D9E3052961 | ||
worker definition: bafkreigzfyfis2pmfr425dwpeql4hsrat5d7hpdthlxwzhefd23kw7gtey | ||
timestamp: 2023-10-12T14:39:21.570Z | ||
``` | ||
|
||
One little command is doing quite a bit so you don't have to. Let's work through the process: | ||
|
||
* once we launch `fluence deal deploy` we create a (new) Deal with both on-chain and off-chain activities | ||
* for an up-to-date look, all service assets, i.e., modules, are (re-) compiled (1) | ||
* the wasm modules and config are uploaded to IPFS node where deal-participating peer's workers can fetch the package by CID (2) | ||
* get back CID and update local file(s) (3) | ||
* if a deal is already in place, which was so you could run the Quickstart demo *quickly*, either update the existing deal or create a new one: **create a new one!** (4) | ||
* now you have to get involved! you are presented with the uri to get metamask to ask you to sign your escrow payment to the contract (5). Copy and paste the uri to your browser and eventually, Metamask should pop-up with a signing request. The transaction displays only in hex, so double check the other request params to make sure you're signing the Mumbai transaction. This is what you should see: | ||
* a (new) Deal with both on-chain and off-chain activities is created (2) | ||
* the wasm modules and config are uploaded to IPFS node where deal-participating peer's workers can fetch the package by CID | ||
* now you have to get involved! you are presented with uris to get metamask to ask you to sign your escrow payment to the contract (3) (4). Copy and paste the uris to your browser and eventually, Metamask should pop-up with a signing request. A transaction is displayed only in hex, so double check the other request params to make sure you're signing the Mumbai transaction. This is what you should see: | ||
InversionSpaces marked this conversation as resolved.
Show resolved
Hide resolved
|
||
![Sign TX](./images/sign_tx_metamask.png) | ||
* once you signed the transaction and the contract was successfully updated, we are done! (6) | ||
* once you sign transactions, the deal is created and the workers join the deal, deploying your services (5) | ||
* finally, deployment information is saved for future use in Aqua scripts (6) | ||
InversionSpaces marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be a good time to demonstrate the |
||
|
||
Fluence CLI did a bunch of work for us behind the scenes and signing the transaction is a lot quicker than entering (virtual) credit card information. The parametric details necessary to write Aqua scripts are save in [deals.aqua](./.fluence/aqua/deals.aqua) and serves as an important dependency in your Aqua scripts, as we'll see in the next section. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the method selection should be addressed. currently, round-robin is suggested but it could be quorum, which requires specifying the quorumNumber.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why substitute QuickNode with Ankr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other algorithms are described later in the doc
Quickstart is about getting default thing working as fast as possible
Should we describe other algorithms right here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also quorum does not require
quorumNumber
, it has a default of2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they made the use of a free account very difficult with a lot of limitations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up to you. i actually think the entire document should be redone and all your work is getting us there. so much appreciated. re algo descritions, yes, that could work. want to give it a try?