forked from cerc-io/stack-orchestrator
Rename app -> stack_orchestrator (#625)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# act-runner stack
|
||||
|
||||
## Example
|
||||
|
||||
```
|
||||
$ laconic-so --stack act-runner deploy init --output act-runner-1.yml --config CERC_GITEA_RUNNER_REGISTRATION_TOKEN=FOO
|
||||
$ laconic-so --stack act-runner deploy create --spec-file act-runner-1.yml --deployment-dir ~/opt/deployments/act-runner-1
|
||||
$ laconic-so deployment --dir ~/opt/deployments/act-runner-1 up
|
||||
|
||||
$ laconic-so --stack act-runner deploy init --output act-runner-2.yml --config CERC_GITEA_RUNNER_REGISTRATION_TOKEN=BAR
|
||||
$ laconic-so --stack act-runner deploy create --spec-file act-runner-2.yml --deployment-dir ~/opt/deployments/act-runner-2
|
||||
$ laconic-so deployment --dir ~/opt/deployments/act-runner-2 up
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
version: "1.1"
|
||||
name: act-runner
|
||||
description: "Local act-runner"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/hosting
|
||||
- gitea.com/gitea/act_runner
|
||||
containers:
|
||||
- cerc/act-runner
|
||||
- cerc/act-runner-task-executor
|
||||
pods:
|
||||
- name: act-runner
|
||||
repository: cerc-io/hosting
|
||||
path: act-runner
|
||||
pre_start_command: "pre_start.sh"
|
||||
post_start_command: "post_start.sh"
|
||||
@@ -0,0 +1,72 @@
|
||||
# Azimuth Watcher
|
||||
|
||||
Instructions to setup and deploy Azimuth Watcher stack
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: `ipld-eth-server` RPC and GQL endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack azimuth setup-repositories
|
||||
```
|
||||
|
||||
NOTE: If the repository already exists and checked out to a different version, `setup-repositories` command will throw an error.
|
||||
For getting around this, the `azimuth-watcher-ts` repository can be removed and then run the command.
|
||||
|
||||
Checkout to the required versions and branches in repos
|
||||
|
||||
```bash
|
||||
# azimuth-watcher-ts
|
||||
cd ~/cerc/azimuth-watcher-ts
|
||||
git checkout v0.1.0
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack azimuth build-containers
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
### Configuration
|
||||
|
||||
* Create and update an env file to be used in the next step:
|
||||
|
||||
```bash
|
||||
# External ipld-eth-server endpoints
|
||||
CERC_IPLD_ETH_RPC=
|
||||
CERC_IPLD_ETH_GQL=
|
||||
```
|
||||
|
||||
* NOTE: If `ipld-eth-server` is running on the host machine, use `host.docker.internal` as the hostname to access host ports
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
* Deploy the containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack azimuth deploy-system --env-file <PATH_TO_ENV_FILE> up
|
||||
```
|
||||
|
||||
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack azimuth deploy-system down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=.*watcher_db_data"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*watcher_db_data")
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
version: "1.0"
|
||||
name: azimuth
|
||||
repos:
|
||||
- github.com/cerc-io/azimuth-watcher-ts@v0.1.1
|
||||
containers:
|
||||
- cerc/watcher-azimuth
|
||||
pods:
|
||||
- watcher-azimuth
|
||||
@@ -0,0 +1,62 @@
|
||||
# Build Support Stack
|
||||
|
||||
## Instructions
|
||||
|
||||
JS/TS/NPM builds need an npm registry to store intermediate package artifacts.
|
||||
This can be supplied by the user (e.g. using a hosted registry or even npmjs.com), or a local registry using gitea can be deployed by stack orchestrator.
|
||||
To use a user-supplied registry set these environment variables:
|
||||
|
||||
`CERC_NPM_REGISTRY_URL` and
|
||||
`CERC_NPM_AUTH_TOKEN`
|
||||
|
||||
Leave `CERC_NPM_REGISTRY_URL` un-set to use the local gitea registry.
|
||||
|
||||
### 1. Build support containers
|
||||
|
||||
Note: the scheme/gerbil container is excluded as it isn't currently required for the package registry.
|
||||
|
||||
```
|
||||
$ laconic-so --stack build-support build-containers
|
||||
```
|
||||
### 2. Deploy Gitea Package Registry
|
||||
|
||||
```
|
||||
$ laconic-so --stack package-registry setup-repositories
|
||||
$ laconic-so --stack package-registry build-containers
|
||||
$ laconic-so --stack package-registry deploy up
|
||||
[+] Running 3/3
|
||||
⠿ Network laconic-aecc4a21d3a502b14522db97d427e850_gitea Created 0.0s
|
||||
⠿ Container laconic-aecc4a21d3a502b14522db97d427e850-db-1 Started 1.2s
|
||||
⠿ Container laconic-aecc4a21d3a502b14522db97d427e850-server-1 Started 1.9s
|
||||
New user 'gitea_admin' has been successfully created!
|
||||
This is your gitea access token: 84fe66a73698bf11edbdccd0a338236b7d1d5c45. Keep it safe and secure, it can not be fetched again from gitea.
|
||||
To use with laconic-so set this environment variable: export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
|
||||
Created the organization cerc-io
|
||||
Gitea was configured to use host name: gitea.local, ensure that this resolves to localhost, e.g. with sudo vi /etc/hosts
|
||||
Success, gitea is properly initialized
|
||||
$
|
||||
```
|
||||
|
||||
Note: the above commands can take several minutes depending on the specs of your machine.
|
||||
|
||||
### 3. Configure the hostname gitea.local
|
||||
How to do this is OS-dependent but usually involves editing a `hosts` file. For example on Linux add this line to the file `/etc/hosts` (needs sudo):
|
||||
```
|
||||
127.0.0.1 gitea.local
|
||||
```
|
||||
Test with:
|
||||
```
|
||||
$ ping gitea.local
|
||||
PING gitea.local (127.0.0.1) 56(84) bytes of data.
|
||||
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.147 ms
|
||||
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.033 ms
|
||||
```
|
||||
Although not necessary in order to build and publish packages, you can now access the Gitea web interface at: [http://gitea.local:3000](http://gitea.local:3000) using these credentials: gitea_admin/admin1234 (Note: please properly secure Gitea if public internet access is allowed).
|
||||
|
||||
Now npm packages can be built:
|
||||
### Build npm Packages
|
||||
Ensure that `CERC_NPM_AUTH_TOKEN` is set with the token printed above when the package-registry stack was deployed (the actual token value will be different than shown in this example):
|
||||
```
|
||||
$ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
|
||||
$ laconic-so build-npms --include laconic-sdk,laconic-registry-cli
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
version: "1.2"
|
||||
name: build-support
|
||||
description: "Build Support Components"
|
||||
containers:
|
||||
- cerc/builder-js
|
||||
@@ -0,0 +1,15 @@
|
||||
version: "1.0"
|
||||
name: chain-chunker
|
||||
description: "Stack to build containers for chain-chunker"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/ipld-eth-state-snapshot@v5
|
||||
- git.vdb.to/cerc-io/eth-statediff-service@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v5
|
||||
- git.vdb.to/cerc-io/plugeth@statediff
|
||||
containers:
|
||||
- cerc/ipld-eth-state-snapshot
|
||||
- cerc/eth-statediff-service
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/plugeth
|
||||
@@ -0,0 +1,157 @@
|
||||
# ERC20 Watcher
|
||||
|
||||
Instructions to deploy a local ERC20 watcher stack (core + watcher) for demonstration and testing purposes using [stack orchestrator](/README.md#install)
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc20 setup-repositories
|
||||
```
|
||||
|
||||
Build the core and watcher container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc20 build-containers
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc20 deploy-system up
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
Find the watcher container's id using `docker ps` and export it for later use:
|
||||
|
||||
```bash
|
||||
export CONTAINER_ID=<CONTAINER_ID>
|
||||
```
|
||||
|
||||
Deploy an ERC20 token:
|
||||
|
||||
```bash
|
||||
docker exec $CONTAINER_ID yarn token:deploy:docker
|
||||
```
|
||||
|
||||
Export the address of the deployed token to a shell variable for later use:
|
||||
|
||||
```bash
|
||||
export TOKEN_ADDRESS=<TOKEN_ADDRESS>
|
||||
```
|
||||
|
||||
Open `http://localhost:3002/graphql` (GraphQL Playground) in a browser window
|
||||
|
||||
Connect MetaMask to `http://localhost:8545` (with chain ID `99`)
|
||||
|
||||
Add the deployed token as an asset in MetaMask and check that the initial balance is zero
|
||||
|
||||
Export your MetaMask account (second account) address to a shell variable for later use:
|
||||
|
||||
```bash
|
||||
export RECIPIENT_ADDRESS=<RECIPIENT_ADDRESS>
|
||||
```
|
||||
|
||||
To get the primary account's address, run:
|
||||
|
||||
```bash
|
||||
docker exec $CONTAINER_ID yarn account:docker
|
||||
```
|
||||
|
||||
To get the current block hash at any time, run:
|
||||
|
||||
```bash
|
||||
docker exec $CONTAINER_ID yarn block:latest:docker
|
||||
```
|
||||
|
||||
Fire a GQL query in the playground to get the name, symbol and total supply of the deployed token:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
name(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
token: "TOKEN_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
symbol(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
token: "TOKEN_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
totalSupply(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
token: "TOKEN_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Fire the following query to get balances for the primary and the recipient account at the latest block hash:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
fromBalanceOf: balanceOf(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
token: "TOKEN_ADDRESS",
|
||||
# primary account having all the balance initially
|
||||
owner: "PRIMARY_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
toBalanceOf: balanceOf(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
token: "TOKEN_ADDRESS",
|
||||
owner: "RECIPIENT_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- The initial balance for the primary account should be `1000000000000000000000`
|
||||
- The initial balance for the recipient should be `0`
|
||||
|
||||
Transfer tokens to the recipient account:
|
||||
|
||||
```bash
|
||||
docker exec $CONTAINER_ID yarn token:transfer:docker --token $TOKEN_ADDRESS --to $RECIPIENT_ADDRESS --amount 100
|
||||
```
|
||||
|
||||
Fire the above GQL query again with the latest block hash to get updated balances for the primary (`from`) and the recipient (`to`) account:
|
||||
|
||||
- The balance for the primary account should be reduced by the transfer amount (`100`)
|
||||
- The balance for the recipient account should be equal to the transfer amount (`100`)
|
||||
|
||||
Transfer funds between different accounts using MetaMask and use the playground to query the balance before and after the transfer.
|
||||
|
||||
## Clean up
|
||||
|
||||
To stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc20 deploy-system down
|
||||
```
|
||||
@@ -0,0 +1,20 @@
|
||||
version: "1.0"
|
||||
name: erc20-watcher
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||
- github.com/dboreham/foundry
|
||||
- github.com/cerc-io/erc20-watcher-ts
|
||||
containers:
|
||||
- cerc/foundry
|
||||
- cerc/go-ethereum
|
||||
- cerc/go-ethereum-foundry
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/watcher-erc20
|
||||
pods:
|
||||
- go-ethereum-foundry
|
||||
- ipld-eth-db
|
||||
- ipld-eth-server
|
||||
- watcher-erc20
|
||||
@@ -0,0 +1,214 @@
|
||||
# ERC721 Watcher
|
||||
|
||||
Instructions to deploy a local ERC721 watcher stack (core + watcher) for demonstration and testing purposes using [laconic-stack-orchestrator](../../README.md#setup)
|
||||
|
||||
## Setup
|
||||
|
||||
* Clone / pull required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc721 setup-repositories
|
||||
```
|
||||
|
||||
* Build the core and watcher container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc721 build-containers
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
* Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc721 deploy-system up
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
* Find the watcher container's id using `docker ps` and export it for later use:
|
||||
|
||||
```bash
|
||||
$ export CONTAINER_ID=<CONTAINER_ID>
|
||||
```
|
||||
|
||||
* Deploy an ERC721 token:
|
||||
|
||||
```bash
|
||||
$ docker exec $CONTAINER_ID yarn nft:deploy:docker
|
||||
```
|
||||
|
||||
Export the address of the deployed token to a shell variable for later use:
|
||||
|
||||
```bash
|
||||
$ export NFT_ADDRESS=<NFT_ADDRESS>
|
||||
```
|
||||
|
||||
* Open `http://localhost:3009/graphql` (GraphQL Playground) in a browser window
|
||||
|
||||
* Connect MetaMask to `http://localhost:8545` (with chain ID `99`)
|
||||
|
||||
* Export your MetaMask account (second account) address to a shell variable for later use:
|
||||
|
||||
```bash
|
||||
$ export RECIPIENT_ADDRESS=<RECIPIENT_ADDRESS>
|
||||
```
|
||||
|
||||
* To get the primary account's address, run:
|
||||
|
||||
```bash
|
||||
$ docker exec $CONTAINER_ID yarn account:docker
|
||||
```
|
||||
|
||||
Export it to shell variable for later use:
|
||||
|
||||
```bash
|
||||
$ export PRIMARY_ADDRESS=<PRIMARY_ADDRESS>
|
||||
```
|
||||
|
||||
* To get the current block hash at any time, run:
|
||||
|
||||
```bash
|
||||
$ docker exec $CONTAINER_ID yarn block:latest:docker
|
||||
```
|
||||
|
||||
* Fire the following GQL query (uses `eth_call`) in the playground:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
name(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
symbol(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
balanceOf(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
owner: "PRIMARY_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Balance for the `PRIMARY_ADDRESS` should be `0` as the token is yet to be minted.
|
||||
|
||||
* Fire the following GQL query (uses `storage` calls) in the playground:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
_name(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
_symbol(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
_balances(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
key0: "PRIMARY_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* Mint the token:
|
||||
|
||||
```bash
|
||||
$ docker exec $CONTAINER_ID yarn nft:mint:docker --nft $NFT_ADDRESS --to $PRIMARY_ADDRESS --token-id 1
|
||||
```
|
||||
|
||||
Fire the GQL query above again with latest block hash. The balance should increase to `1`.
|
||||
|
||||
* Get the latest block hash and run the following GQL query in the playground for `balanceOf` and `ownerOf` (`eth_call`):
|
||||
|
||||
```graphql
|
||||
query {
|
||||
fromBalanceOf: balanceOf(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
owner: "PRIMARY_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
toBalanceOf: balanceOf(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
owner: "RECIPIENT_ADDRESS"
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
ownerOf(
|
||||
blockHash: "LATEST_BLOCK_HASH"
|
||||
contractAddress: "NFT_ADDRESS"
|
||||
tokenId: 1
|
||||
) {
|
||||
value
|
||||
proof {
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Balance should be `1` for the `PRIMARY_ADDRESS`, `0` for the `RECIPIENT_ADDRESS` and owner value of the token should be equal to the `PRIMARY_ADDRESS`.
|
||||
|
||||
* Transfer the token:
|
||||
|
||||
```bash
|
||||
$ docker exec $CONTAINER_ID yarn nft:transfer:docker --nft $NFT_ADDRESS --from $PRIMARY_ADDRESS --to $RECIPIENT_ADDRESS --token-id 1
|
||||
```
|
||||
|
||||
Fire the GQL query above again with the latest block hash. The token should be transferred to the recipient.
|
||||
|
||||
## Clean up
|
||||
|
||||
* To stop all the services running in background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack erc721 deploy-system down
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
version: "1.0"
|
||||
name: erc721-watcher
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||
- github.com/cerc-io/watcher-ts
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/go-ethereum-foundry
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/watcher-erc721
|
||||
pods:
|
||||
- go-ethereum-foundry
|
||||
- ipld-eth-db
|
||||
- ipld-eth-server
|
||||
- watcher-erc721
|
||||
@@ -0,0 +1,6 @@
|
||||
# fixturenet-eth-loaded
|
||||
|
||||
A "loaded" version of fixturenet-eth, with all the bells and whistles enabled.
|
||||
|
||||
TODO: write me
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-eth-loaded
|
||||
description: "Loaded Ethereum Fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/tx-spammer
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/keycloak
|
||||
- cerc/tx-spammer
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- tx-spammer
|
||||
- fixturenet-eth-metrics
|
||||
- keycloak
|
||||
- ipld-eth-server
|
||||
- ipld-eth-db
|
||||
@@ -0,0 +1,37 @@
|
||||
# fixturenet-eth-tx
|
||||
|
||||
A variation of `fixturenet-eth` that automatically generates transactions using `tx-spammer`.
|
||||
|
||||
See `stacks/fixturenet-eth/README.md` for more information.
|
||||
|
||||
## Containers
|
||||
|
||||
* cerc/go-ethereum
|
||||
* cerc/lighthouse
|
||||
* cerc/fixturenet-eth-geth
|
||||
* cerc/fixturenet-eth-lighthouse
|
||||
* cerc/tx-spammer
|
||||
|
||||
## Deploy the stack
|
||||
```
|
||||
$ laconic-so --stack fixturenet-eth-tx setup-repositories
|
||||
$ laconic-so --stack fixturenet-eth-tx build-containers
|
||||
$ laconic-so --stack fixturenet-eth-tx deploy up
|
||||
```
|
||||
|
||||
## Export the ethdb (optional)
|
||||
|
||||
It is easy to export data from the fixturenet for offline processing of the raw ethdb files (eg, by eth-statediff-service) using the `export-ethdb.sh` script.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
$ app/data/container-build/cerc-fixturenet-eth-lighthouse/scripts/export-ethdb.sh 500
|
||||
Waiting for geth to generate DAG.... done
|
||||
Waiting for beacon phase0.... done
|
||||
Waiting for beacon altair.... done
|
||||
Waiting for beacon bellatrix pre-merge.... done
|
||||
Waiting for beacon bellatrix merge.... done
|
||||
Waiting for block number 500.... done
|
||||
Exporting ethdb.... ./ethdb.tgz
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
version: "1.2"
|
||||
name: fixturenet-eth-tx
|
||||
description: "Ethereum Fixturenet w/ tx-spammer"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/tx-spammer
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/tx-spammer
|
||||
- cerc/foundry
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- foundry
|
||||
- tx-spammer
|
||||
@@ -0,0 +1,124 @@
|
||||
# fixturenet-eth
|
||||
|
||||
Instructions for deploying a local a geth + lighthouse blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator (the installation of which is covered [here](https://github.com/cerc-io/stack-orchestrator)):
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```
|
||||
$ laconic-so --stack fixturenet-eth setup-repositories
|
||||
```
|
||||
|
||||
## Build the fixturenet-eth containers
|
||||
|
||||
```
|
||||
$ laconic-so --stack fixturenet-eth build-containers
|
||||
```
|
||||
|
||||
This should create several container images in the local image registry:
|
||||
|
||||
* cerc/go-ethereum
|
||||
* cerc/lighthouse
|
||||
* cerc/fixturenet-eth-geth
|
||||
* cerc/fixturenet-eth-lighthouse
|
||||
|
||||
## Deploy the stack
|
||||
|
||||
```
|
||||
$ laconic-so --stack fixturenet-eth deploy up
|
||||
```
|
||||
|
||||
## Check status
|
||||
|
||||
```
|
||||
$ laconic-so --stack fixturenet-eth deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh
|
||||
Waiting for geth to generate DAG.... done
|
||||
Waiting for beacon phase0.... done
|
||||
Waiting for beacon altair.... done
|
||||
Waiting for beacon bellatrix pre-merge.... done
|
||||
Waiting for beacon bellatrix merge.... done
|
||||
|
||||
$ laconic-so --stack fixturenet-eth deploy ps
|
||||
Running containers:
|
||||
id: c6538b60c0328dadfa2c5585c4d09674a6a13e6d712ff1cd82a26849e4e5679b, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-bootnode-geth-1, ports: 0.0.0.0:58909->30303/tcp, 0.0.0.0:58910->9898/tcp
|
||||
id: 5b70597a8211bc7e78d33e50486cb565a7f4a9ce581ce150b3bb450e342bdeda, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-bootnode-lighthouse-1, ports:
|
||||
id: 19ed78867b6c534d893835cdeb1e89a9ea553b8e8c02ab02468e4bd1563a340f, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-geth-1-1, ports: 0.0.0.0:58911->40000/tcp, 0.0.0.0:58912->6060/tcp, 0.0.0.0:58913->8545/tcp
|
||||
id: 8da0e30a1ce33122d8fd2225e4d26c7f30eb4bfbfa743f2af04d9db5d0bf7fa6, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-geth-2-1, ports:
|
||||
id: 387a42a14971034588ba9aeb9b9e2ca7fc0cc61b96f8fe8c2ab770c9d6fb1e0f, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-lighthouse-1-1, ports: 0.0.0.0:58917->8001/tcp
|
||||
id: de5115bf89087bae03b291664a73ffe3554fe23e79e4b8345e088b040d5580ac, name: laconic-b12fa16e999821562937781f8ab0b1e8-fixturenet-eth-lighthouse-2-1, ports:
|
||||
id: 2a7e5a0fb2be7fc9261a7b725a40818facbbe6d0cb2497d82c0e02de0a8e959b, name: laconic-b12fa16e999821562937781f8ab0b1e8-foundry-1, ports:
|
||||
|
||||
$ laconic-so --stack fixturenet-eth deploy exec foundry "cast block-number"
|
||||
3
|
||||
```
|
||||
|
||||
## Additional pieces
|
||||
|
||||
Several other containers can used with the basic `fixturenet-eth`:
|
||||
|
||||
* `ipld-eth-db` (enables statediffing)
|
||||
* `ipld-eth-server` (GQL and Ethereum API server, requires `ipld-eth-db`)
|
||||
* `ipld-eth-beacon-db` and `ipld-eth-beacon-indexer` (for indexing Beacon chain blocks)
|
||||
* `eth-probe` (captures eth1 tx gossip)
|
||||
* `keycloak` (nginx proxy with keycloak auth for API authentication)
|
||||
* `tx-spammer` (generates and sends automated transactions to the fixturenet)
|
||||
|
||||
It is not necessary to use them all at once, but a complete example follows:
|
||||
|
||||
```
|
||||
# Setup
|
||||
$ laconic-so setup-repositories --include git.vdb.to/cerc-io/go-ethereum,git.vdb.to/cerc-io/ipld-eth-db,git.vdb.to/cerc-io/ipld-eth-server,github.com/cerc-io/ipld-eth-beacon-db,github.com/cerc-io/ipld-eth-beacon-indexer,github.com/cerc-io/eth-probe,git.vdb.to/cerc-io/tx-spammer
|
||||
|
||||
# Build
|
||||
$ laconic-so build-containers --include cerc/go-ethereum,cerc/lighthouse,cerc/fixturenet-eth-geth,cerc/fixturenet-eth-lighthouse,cerc/ipld-eth-db,cerc/ipld-eth-server,cerc/ipld-eth-beacon-db,cerc/ipld-eth-beacon-indexer,cerc/eth-probe,cerc/keycloak,cerc/tx-spammer
|
||||
|
||||
# Deploy
|
||||
$ laconic-so deploy-system --include db,fixturenet-eth,ipld-eth-server,ipld-eth-beacon-db,ipld-eth-beacon-indexer,eth-probe,keycloak,tx-spammer up
|
||||
|
||||
# Status
|
||||
|
||||
$ container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh
|
||||
Waiting for geth to generate DAG.... done
|
||||
Waiting for beacon phase0.... done
|
||||
Waiting for beacon altair.... done
|
||||
Waiting for beacon bellatrix pre-merge.... done
|
||||
Waiting for beacon bellatrix merge.... done
|
||||
|
||||
$ docker ps -f 'name=laconic' --format 'table {{.Names}}\t{{.Ports}}' | cut -d'-' -f3- | sort
|
||||
NAMES PORTS
|
||||
eth-probe-db-1 0.0.0.0:55849->5432/tcp
|
||||
eth-probe-mq-1
|
||||
eth-probe-probe-1
|
||||
fixturenet-eth-bootnode-geth-1 8545-8546/tcp, 30303/udp, 0.0.0.0:55847->9898/tcp, 0.0.0.0:55848->30303/tcp
|
||||
fixturenet-eth-bootnode-lighthouse-1
|
||||
fixturenet-eth-geth-1-1 8546/tcp, 30303/tcp, 30303/udp, 0.0.0.0:55851->8545/tcp
|
||||
fixturenet-eth-geth-2-1 8545-8546/tcp, 30303/tcp, 30303/udp
|
||||
fixturenet-eth-lighthouse-1-1 0.0.0.0:55858->8001/tcp
|
||||
fixturenet-eth-lighthouse-2-1
|
||||
ipld-eth-beacon-db-1 127.0.0.1:8076->5432/tcp
|
||||
ipld-eth-beacon-indexer-1
|
||||
ipld-eth-db-1 127.0.0.1:8077->5432/tcp
|
||||
ipld-eth-server-1 127.0.0.1:8081-8082->8081-8082/tcp
|
||||
keycloak-1 8443/tcp, 0.0.0.0:55857->8080/tcp
|
||||
keycloak-db-1 0.0.0.0:55850->5432/tcp
|
||||
keycloak-nginx-1 0.0.0.0:55859->80/tcp
|
||||
migrations-1
|
||||
tx-spammer-1
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack fixturenet-eth deploy down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
$ docker volume ls -q --filter "name=.*fixturenet_eth_bootnode_geth_data|.*fixturenet_eth_geth_1_data|.*fixturenet_eth_geth_2_data|.*fixturenet_eth_lighthouse_1_data|.*fixturenet_eth_lighthouse_2_data"
|
||||
|
||||
# Remove all the listed volumes
|
||||
$ docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_eth_bootnode_geth_data|.*fixturenet_eth_geth_1_data|.*fixturenet_eth_geth_2_data|.*fixturenet_eth_lighthouse_1_data|.*fixturenet_eth_lighthouse_2_data")
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
version: "1.1"
|
||||
name: fixturenet-eth
|
||||
description: "Ethereum Fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/foundry
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- foundry
|
||||
@@ -0,0 +1,68 @@
|
||||
# Laconic Fixturenet (experimental)
|
||||
|
||||
Testing a "Loaded" fixturenet with console.
|
||||
|
||||
Instructions for deploying a local Laconic blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator.
|
||||
|
||||
**Note:** For building some NPMs, access to the @lirewine repositories is required. If you don't have access, see [this tutorial](/docs/laconicd-fixturenet.md) to run this stack
|
||||
|
||||
## 1. Install Laconic Stack Orchestrator
|
||||
Installation is covered in detail [here](https://github.com/cerc-io/stack-orchestrator#user-mode) but if you're on Linux and already have docker installed it should be as simple as:
|
||||
```
|
||||
$ mkdir my-working-dir
|
||||
$ cd my-working-dir
|
||||
$ curl -L -o ./laconic-so https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so
|
||||
$ chmod +x ./laconic-so
|
||||
$ export PATH=$PATH:$(pwd) # Or move laconic-so to ~/bin or your favorite on-path directory
|
||||
```
|
||||
## 2. Prepare the local build environment
|
||||
Note that this step needs only to be done once on a new machine.
|
||||
Detailed instructions can be found [here](../build-support/README.md). For the impatient run these commands:
|
||||
```
|
||||
$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
|
||||
$ laconic-so --stack package-registry setup-repositories
|
||||
$ laconic-so --stack package-registry build-containers
|
||||
$ laconic-so --stack package-registry deploy-system up
|
||||
```
|
||||
Then add the localhost alias `gitea.local` and set `CERC_NPM_AUTH_TOKEN` to the token printed when the package-registry stack was deployed above:
|
||||
```
|
||||
$ sudo vi /etc/hosts
|
||||
$ export CERC_NPM_AUTH_TOKEN=<my-token>
|
||||
```
|
||||
|
||||
## 3. Clone required repositories
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconic-loaded setup-repositories
|
||||
```
|
||||
## 4. Build the stack's packages and containers
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconic-loaded build-npms
|
||||
$ laconic-so --stack fixturenet-laconic-loaded build-containers
|
||||
```
|
||||
## 5. Deploy the stack
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconic-loaded deploy up
|
||||
```
|
||||
Correct operation should be verified by checking the laconicd container's logs with:
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconic-loaded deploy logs
|
||||
```
|
||||
## 6. Test with the Registry CLI
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconic-loaded deploy exec cli "laconic cns status"
|
||||
```
|
||||
## 7. View the laconic console
|
||||
Get the URL for the console web app with this command (the port number will be different for each deployment):
|
||||
```
|
||||
$ echo http://localhost:$(laconic-so --stack fixturenet-laconic-loaded deploy port laconic-console 80 | cut -d ':' -f 2)
|
||||
http://localhost:58364
|
||||
```
|
||||
Open that address with a browser. The console should display
|
||||
## 8. Load demo data into the registry
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconic-loaded deploy exec cli ./scripts/create-demo-records.sh
|
||||
Balance is: 99998999999999998999600000
|
||||
Created bond with id: dd88e8d6f9567b32b28e70552aea4419c5dd3307ebae85a284d1fe38904e301a
|
||||
Published demo-record-1.yml with id: bafyreierh3xnfivexlscdwubvczmddsnf46uytyfvrbdhkjzztvsz6ruly
|
||||
```
|
||||
The published record should be visible in the console.
|
||||
@@ -0,0 +1,33 @@
|
||||
version: "1.1"
|
||||
name: fixturenet-laconic-loaded
|
||||
description: "A full featured laconic fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/laconicd
|
||||
- github.com/lirewine/debug
|
||||
- github.com/lirewine/crypto
|
||||
- github.com/lirewine/gem
|
||||
- github.com/lirewine/sdk
|
||||
- git.vdb.to/cerc-io/laconic-sdk
|
||||
- git.vdb.to/cerc-io/laconic-registry-cli
|
||||
- git.vdb.to/cerc-io/laconic-console
|
||||
npms:
|
||||
- laconic-sdk
|
||||
- laconic-registry-cli
|
||||
- debug
|
||||
- crypto
|
||||
- sdk
|
||||
- gem
|
||||
- laconic-console
|
||||
containers:
|
||||
- cerc/laconicd
|
||||
- cerc/laconic-registry-cli
|
||||
- cerc/webapp-base
|
||||
- cerc/laconic-console-host
|
||||
pods:
|
||||
- fixturenet-laconicd
|
||||
- fixturenet-laconic-console
|
||||
config:
|
||||
cli:
|
||||
key: laconicd.mykey
|
||||
address: laconicd.myaddress
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# Laconicd Fixturenet
|
||||
|
||||
Instructions for deploying a local Laconic blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator.
|
||||
|
||||
## 1. Install Laconic Stack Orchestrator
|
||||
Installation is covered in detail [here](https://github.com/cerc-io/stack-orchestrator#user-mode) but if you're on Linux and already have docker installed it should be as simple as:
|
||||
```
|
||||
$ mkdir my-working-dir
|
||||
$ cd my-working-dir
|
||||
$ curl -L -o ./laconic-so https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so
|
||||
$ chmod +x ./laconic-so
|
||||
$ export PATH=$PATH:$(pwd) # Or move laconic-so to ~/bin or your favorite on-path directory
|
||||
```
|
||||
## 2. Prepare the local build environment
|
||||
Note that this step needs only to be done once on a new machine.
|
||||
Detailed instructions can be found [here](../build-support/README.md). For the impatient run these commands:
|
||||
```
|
||||
$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
|
||||
$ laconic-so --stack package-registry setup-repositories
|
||||
$ laconic-so --stack package-registry deploy-system up
|
||||
```
|
||||
Then add the localhost alias `gitea.local` and set `CERC_NPM_AUTH_TOKEN` to the token printed when the package-registry stack was deployed above:
|
||||
```
|
||||
$ sudo vi /etc/hosts
|
||||
$ export CERC_NPM_AUTH_TOKEN=<my-token>
|
||||
```
|
||||
|
||||
## 3. Clone required repositories
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd setup-repositories
|
||||
```
|
||||
## 4. Build the stack's packages and containers
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd build-npms
|
||||
$ laconic-so --stack fixturenet-laconicd build-containers
|
||||
```
|
||||
## 5. Deploy the stack
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd deploy up
|
||||
```
|
||||
Correct operation should be verified by checking the laconicd container's logs with:
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd deploy logs
|
||||
```
|
||||
## 6. Test with the Registry CLI
|
||||
```
|
||||
$ laconic-so --stack fixturenet-laconicd deploy exec cli "laconic cns status"
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-laconicd
|
||||
description: "A laconicd fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/laconicd
|
||||
- git.vdb.to/cerc-io/laconic-sdk
|
||||
- git.vdb.to/cerc-io/laconic-registry-cli
|
||||
npms:
|
||||
- laconic-sdk
|
||||
- laconic-registry-cli
|
||||
containers:
|
||||
- cerc/laconicd
|
||||
- cerc/laconic-registry-cli
|
||||
pods:
|
||||
- fixturenet-laconicd
|
||||
config:
|
||||
cli:
|
||||
key: laconicd.mykey
|
||||
address: laconicd.myaddress
|
||||
@@ -0,0 +1,47 @@
|
||||
# Lotus Fixturenet
|
||||
|
||||
Instructions for deploying a local Lotus (Filecoin) chain for development and testing purposes using laconic-stack-orchestrator.
|
||||
|
||||
## 1. Clone required repositories
|
||||
```
|
||||
$ laconic-so --stack fixturenet-lotus setup-repositories
|
||||
```
|
||||
## 2. Build the stack's packages and containers
|
||||
```
|
||||
$ laconic-so --stack fixturenet-lotus build-containers
|
||||
```
|
||||
## 3. Deploy the stack
|
||||
```
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus up
|
||||
```
|
||||
|
||||
Note: When running for the first time (or after clean up), the services will take some time to start properly as the Lotus nodes download the proof params (which are persisted to volumes)
|
||||
|
||||
Correct operation should be verified by checking the container logs with:
|
||||
```
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-miner
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-node-1
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-node-2
|
||||
```
|
||||
or by checking the chain status on each node:
|
||||
```
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-miner "lotus status"
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-node-1 "lotus status"
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-node-2 "lotus status"
|
||||
```
|
||||
|
||||
## 4. Clean up
|
||||
|
||||
Stop all the services running in background:
|
||||
```
|
||||
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
```
|
||||
# List all relevant volumes
|
||||
$ docker volume ls -q --filter "name=lotus"
|
||||
|
||||
# Remove all the listed volumes
|
||||
$ docker volume rm $(docker volume ls -q --filter "name=lotus")
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-lotus
|
||||
description: "A lotus fixturenet"
|
||||
repos:
|
||||
- github.com/filecoin-project/lotus
|
||||
containers:
|
||||
- cerc/lotus
|
||||
pods:
|
||||
- fixturenet-lotus
|
||||
@@ -0,0 +1,123 @@
|
||||
# fixturenet-optimism
|
||||
|
||||
Instructions to setup and deploy an end-to-end L1+L2 stack with [fixturenet-eth](../fixturenet-eth/) (L1) and [Optimism](https://stack.optimism.io) (L2)
|
||||
|
||||
We support running just the L2 part of stack, given an external L1 endpoint. Follow the [L2 only doc](./l2-only.md) for the same.
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism setup-repositories
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism build-containers
|
||||
|
||||
# If redeploying with changes in the stack containers
|
||||
laconic-so --stack fixturenet-optimism build-containers --force-rebuild
|
||||
|
||||
# If errors are thrown during build, old images used by this stack would have to be deleted
|
||||
```
|
||||
|
||||
Note: this will take >10 mins depending on the specs of your machine, and **requires** 16GB of memory or greater.
|
||||
|
||||
This should create the required docker images in the local image registry:
|
||||
* `cerc/go-ethereum`
|
||||
* `cerc/lighthouse`
|
||||
* `cerc/fixturenet-eth-geth`
|
||||
* `cerc/fixturenet-eth-lighthouse`
|
||||
* `cerc/foundry`
|
||||
* `cerc/optimism-contracts`
|
||||
* `cerc/optimism-l2geth`
|
||||
* `cerc/optimism-op-node`
|
||||
* `cerc/optimism-op-batcher`
|
||||
* `cerc/optimism-op-proposer`
|
||||
|
||||
## Deploy
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy up
|
||||
```
|
||||
|
||||
The `fixturenet-optimism-contracts` service takes a while to complete running as it:
|
||||
1. waits for the 'Merge' to happen on L1
|
||||
2. waits for a finalized block to exist on L1 (so that it can be taken as a starting block for roll ups)
|
||||
3. deploys the L1 contracts
|
||||
It may restart a few times after running into errors.
|
||||
|
||||
To list and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy ps
|
||||
|
||||
# With status
|
||||
docker ps
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy down 30
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
* If `op-geth` service aborts or is restarted, the following error might occur in the `op-node` service:
|
||||
|
||||
```bash
|
||||
WARN [02-16|21:22:02.868] Derivation process temporary error attempts=14 err="stage 0 failed resetting: temp: failed to find the L2 Heads to start from: failed to fetch L2 block by hash 0x0000000000000000000000000000000000000000000000000000000000000000: failed to determine block-hash of hash 0x0000000000000000000000000000000000000000000000000000000000000000, could not get payload: not found"
|
||||
```
|
||||
|
||||
* This means that the data directory that `op-geth` is using is corrupted and needs to be reinitialized; the containers `op-geth`, `op-node` and `op-batcher` need to be started afresh:
|
||||
|
||||
WARNING: This will reset the L2 chain; consequently, all the data on it will be lost
|
||||
|
||||
* Stop and remove the concerned containers:
|
||||
|
||||
```bash
|
||||
# List the containers
|
||||
docker ps -f "name=op-geth|op-node|op-batcher"
|
||||
|
||||
# Force stop and remove the listed containers
|
||||
docker rm -f $(docker ps -qf "name=op-geth|op-node|op-batcher")
|
||||
```
|
||||
|
||||
* Remove the concerned volume:
|
||||
|
||||
```bash
|
||||
# List the volume
|
||||
docker volume ls -q --filter name=l2_geth_data
|
||||
|
||||
# Remove the listed volume
|
||||
docker volume rm $(docker volume ls -q --filter name=l2_geth_data)
|
||||
```
|
||||
|
||||
* Re-run the deployment command used in [Deploy](#deploy) to restart the stopped containers
|
||||
|
||||
## Known Issues
|
||||
|
||||
* Resource requirements (memory + time) for building the `cerc/foundry` image are on the higher side
|
||||
* `cerc/optimism-contracts` image is currently based on `cerc/foundry` (Optimism requires foundry installation)
|
||||
@@ -0,0 +1,100 @@
|
||||
# fixturenet-optimism
|
||||
|
||||
Instructions to setup and deploy L2 fixturenet using [Optimism](https://stack.optimism.io)
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: An L1 Ethereum RPC endpoint
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism setup-repositories --exclude git.vdb.to/cerc-io/go-ethereum
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism build-containers --include cerc/foundry,cerc/optimism-contracts,cerc/optimism-op-node,cerc/optimism-l2geth,cerc/optimism-op-batcher,cerc/optimism-op-proposer
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry:
|
||||
* `cerc/foundry`
|
||||
* `cerc/optimism-contracts`
|
||||
* `cerc/optimism-l2geth`
|
||||
* `cerc/optimism-op-node`
|
||||
* `cerc/optimism-op-batcher`
|
||||
* `cerc/optimism-op-proposer`
|
||||
|
||||
## Deploy
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/fixturenet-optimism/l1-params.env)):
|
||||
|
||||
```bash
|
||||
# External L1 endpoint
|
||||
CERC_L1_CHAIN_ID=
|
||||
CERC_L1_RPC=
|
||||
CERC_L1_HOST=
|
||||
CERC_L1_PORT=
|
||||
|
||||
# URL to get CSV with credentials for accounts on L1
|
||||
# that are used to send balance to Optimism Proxy contract
|
||||
# (enables them to do transactions on L2)
|
||||
CERC_L1_ACCOUNTS_CSV_URL=
|
||||
|
||||
# OR
|
||||
# Specify the required account credentials
|
||||
CERC_L1_ADDRESS=
|
||||
CERC_L1_PRIV_KEY=
|
||||
CERC_L1_ADDRESS_2=
|
||||
CERC_L1_PRIV_KEY_2=
|
||||
```
|
||||
|
||||
* NOTE: If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism --env-file <PATH_TO_ENV_FILE> up
|
||||
```
|
||||
|
||||
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:
|
||||
1. waits for the 'Merge' to happen on L1
|
||||
2. waits for a finalized block to exist on L1 (so that it can be taken as a starting block for roll ups)
|
||||
3. deploys the L1 contracts
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism ps
|
||||
|
||||
# With status
|
||||
docker ps
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism down 30
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
See [Troubleshooting](./README.md#troubleshooting)
|
||||
@@ -0,0 +1,25 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-optimism
|
||||
description: "Optimism Fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- github.com/ethereum-optimism/optimism@v1.0.4
|
||||
- github.com/ethereum-optimism/op-geth@v1.101105.2
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/foundry
|
||||
- cerc/optimism-contracts
|
||||
- cerc/optimism-op-node
|
||||
- cerc/optimism-l2geth
|
||||
- cerc/optimism-op-batcher
|
||||
- cerc/optimism-op-proposer
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- fixturenet-optimism
|
||||
@@ -0,0 +1,84 @@
|
||||
# fixturenet-payments
|
||||
|
||||
Instructions to setup and deploy an end-to-end fixturenet-payments stack, on a local machine. Some tips are included for running on a remote cloud machine.
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-payments setup-repositories --pull
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-payments build-containers
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-payments deploy --cluster payments up
|
||||
```
|
||||
|
||||
```bash
|
||||
# Exposed on host ports:
|
||||
# 32***: geth in statediffing mode and ipld-eth-server(s)
|
||||
# 4005: in-process go-nitro node's RPC endpoint
|
||||
# 3005: in-process go-nitro node's p2p TCP endpoint
|
||||
# 5005: in-process go-nitro node's p2p WS endpoint
|
||||
# 4006: out-of-process go-nitro node's RPC endpoint
|
||||
# 3006: out-of-process go-nitro node's p2p TCP endpoint
|
||||
# 5006: out-of-process go-nitro node's p2p WS endpoint
|
||||
# 15432: MobyMask v3 watcher's db endpoint
|
||||
# 3001: MobyMask v3 watcher endpoint
|
||||
# 9090: MobyMask v3 watcher relay node endpoint
|
||||
# 8080: MobyMask snap
|
||||
# 3004: MobyMask v3 app
|
||||
# 42070: Ponder indexer-1
|
||||
# 42071: Ponder indexer-2
|
||||
# 42069: Ponder watcher
|
||||
```
|
||||
|
||||
If running in the cloud, ensure all the of the above ports are open. The geth port can be retrieved with:
|
||||
|
||||
```bash
|
||||
docker port payments-fixturenet-eth-geth-1-1 8545
|
||||
```
|
||||
|
||||
Then for every port above, run each line in a new terminal window (or use `screen`):
|
||||
|
||||
```bash
|
||||
ssh -L 4005:localhost:4005 user@<your-ip>
|
||||
ssh -L 5005:localhost:5005 user@<your-ip>
|
||||
ssh -L 8081:localhost:8081 user@<your-ip>
|
||||
# ... and so on for every port
|
||||
```
|
||||
|
||||
This will allow you to access the entirety of the app as if it were running locally.
|
||||
|
||||
## Demo
|
||||
|
||||
- Follow the [mobymask-demo](./mobymask-demo.md) to try out MobyMask end-to-end payments.
|
||||
- Follow the [ponder-demo](./ponder-demo.md) to try out Ponder end-to-end payments.
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-payments deploy --cluster payments down 30
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=payments"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=payments")
|
||||
```
|
||||
@@ -0,0 +1,223 @@
|
||||
# Demo
|
||||
|
||||
Stack components:
|
||||
* `ipld-eth-db` database for statediffed data
|
||||
* Local geth + lighthouse blockchain "fixturenet" running in statediffing mode
|
||||
* `ipld-eth-server-1` which runs an ETH RPC API and a GQL server; they both serve data from `ipld-eth-db`
|
||||
* It runs an in-process go-nitro node for payments required for configured RPC requests
|
||||
* A MobyMask v3 watcher that pays the `ipld-eth-server-1` for ETH RPC requests
|
||||
* A MobyMask v3 app that pays the watcher for reads (GQL queries) and writes
|
||||
|
||||
## Setup
|
||||
|
||||
* On starting the stack, MobyMask watcher creates a payment channel with the `ipld-eth-server-1`'s (in-process) Nitro node. Check watcher logs and wait for the same:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||
|
||||
# Expected output:
|
||||
# vulcanize:server Peer ID: 12D3KooWKLqLWU82VU7jmsmQMruRvZWhoBoVsf1UHchM5Nuq9ymY
|
||||
# vulcanize:server Using chain URL http://fixturenet-eth-geth-1:8546 for Nitro node
|
||||
# ...
|
||||
# ts-nitro:util:nitro Ledger channel created with id 0x65703ccdfacab09ac35367bdbe6c5a337e7a6651aad526807607b1c59b28bc1e
|
||||
# ...
|
||||
# ts-nitro:util:nitro Virtual payment channel created with id 0x29ff1335d73391a50e8fde3e9b34f00c3d81c39ddc7f89187f44dd51df96140e
|
||||
# vulcanize:server Starting server... +0ms
|
||||
```
|
||||
|
||||
* Keep the above command running to keep track of incoming payments and GQL requests from the MobyMask app
|
||||
|
||||
* In another terminal, export the payment channel id to a variable:
|
||||
|
||||
```bash
|
||||
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||
```
|
||||
|
||||
* Check the payment channel status:
|
||||
|
||||
```bash
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -s false -h ipld-eth-server-1 -p 4005"
|
||||
|
||||
# Expected output:
|
||||
# {
|
||||
# ID: '0x8c0d17639bd2ba07dbcd248304a8f3c6c7276bfe25c2b87fe41f461e20f33f01',
|
||||
# Status: 'Open',
|
||||
# Balance: {
|
||||
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||
# Payer: '0xbbb676f9cff8d242e9eac39d063848807d3d1d94',
|
||||
# PaidSoFar: 0n,
|
||||
# RemainingFunds: 1000000000n
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
* In another terminal, check `ipld-eth-server-1`'s logs to keep track of incoming payments and RPC requests from the MobyMask watcher:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="ipld-eth-server-1")
|
||||
```
|
||||
|
||||
* MetaMask flask wallet setup for running the MobyMask app:
|
||||
|
||||
* Get the geth node’s port mapped to host:
|
||||
|
||||
```bash
|
||||
docker port payments-fixturenet-eth-geth-1-1 8545
|
||||
```
|
||||
|
||||
* In MetaMask, add a custom network with the following settings:
|
||||
|
||||
```bash
|
||||
# Network name
|
||||
Local fixturenet
|
||||
|
||||
# New RPC URL
|
||||
http://127.0.0.1:<GETH_PORT>
|
||||
|
||||
# Chain ID
|
||||
1212
|
||||
|
||||
# Currency symbol
|
||||
ETH
|
||||
```
|
||||
|
||||
* Import a faucet account with the following private key:
|
||||
|
||||
```bash
|
||||
# Faucet PK
|
||||
# 0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
|
||||
```
|
||||
|
||||
* Create an additional account for usage in the app; fund it from the faucet account
|
||||
|
||||
* Get the generated root invite link for MobyMask from contract deployment container logs:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
|
||||
# Expected output:
|
||||
# ...
|
||||
# "key": "0x60e706fda4639fe0a8eb102cb0ce81231cf6e819f41cb4eadf72d865ea4c11ad"
|
||||
# }
|
||||
# http://127.0.0.1:3004/#/members?invitation=<INVITATION>
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
### MobyMask App
|
||||
|
||||
* Open app in a browser (where MetaMask was setup) using the invite link
|
||||
|
||||
* Run the following in browser console to enable logs:
|
||||
|
||||
```bash
|
||||
localStorage.debug = 'ts-nitro:*'
|
||||
# Refresh the tab for taking effect
|
||||
```
|
||||
|
||||
* In the app’s debug panel, check that the peer gets connected to relay node and watcher peer
|
||||
|
||||
* Open the `NITRO` tab in debug panel
|
||||
* Click on `Connect Wallet` to connect to MetaMask (make sure that the newly funded account is active)
|
||||
* Click on `Connect Snap` to install/connect snap
|
||||
|
||||
* Perform `DIRECT FUND` with the preset amount and wait for the MetaMask confirmation prompt to appear; confirm the transaction and wait for a ledger channel to be created with the watcher
|
||||
|
||||
* Perform `VIRTUAL FUND` with amount set to `10000` and wait for a payment channel to be created with the watcher
|
||||
|
||||
* Perform phisher status check queries now that a payment channel is created:
|
||||
|
||||
* Check the watcher logs for received payments along with the GQL queries:
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# laconic:payments Received a payment voucher of 50 from 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# laconic:payments Serving a paid query for 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# vulcanize:resolver isPhisher 0x98ae4f9e9d01cc892adfe6871e1db0287039e0c183d3b5bb31d724228c114744 0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9 TWT:ash1
|
||||
# vulcanize:indexer isPhisher: db miss, fetching from upstream server
|
||||
# laconic:payments Making RPC call: eth_chainId
|
||||
# laconic:payments Making RPC call: eth_getBlockByHash
|
||||
# 2023-10-13T06:33:58.443Z ts-nitro:engine{"msg":"Sent message","_msg":{"to":"0xAAA662","from":"0xBBB676", "payloadSummaries":[],"proposalSummaries":[],"payments":[{"amount":200,"channelId":"0x9a4bdfe03c8e72f368aab07e6bd18f1cd6821170e1a93e59864aad6ee6a853a2"}],"rejectedObjectives":[]}}
|
||||
# laconic:payments Making RPC call: eth_chainId
|
||||
# laconic:payments Making RPC call: eth_getStorageAt
|
||||
# 2023-10-13T06:34:00.483Z ts-nitro:engine {"msg":"Sent message","_msg":{"to":"0xAAA662","from":"0xBBB676",# "payloadSummaries":[],"proposalSummaries":[],"payments":[{"amount":300,"channelId":"0x9a4bdfe03c8e72f368aab07e6bd18f1cd6821170e1a93e59864aad6ee6a853a2"}],"rejectedObjectives":[]}}
|
||||
```
|
||||
|
||||
* The watcher makes several ETH RPC requests to `ipld-eth-server-1` to fetch data required for satisfying the GQL request(s); check `ipld-eth-server-1` logs for charged RPC requests (`eth_getBlockByHash`, `eth_getBlockByNumber`, `eth_getStorageAt`):
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# 2023/10/13 06:34:57 INFO Received a voucher payer=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 amount=100
|
||||
# 2023/10/13 06:34:59 INFO Serving a paid RPC request method=eth_getBlockByHash cost=50 sender=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=START api_method=eth_getBlockByHash api_params="[0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d false]" api_reqid=52 conn="192.168.64.4:59644" user_id= uuid=a1893211-6992-11ee-a67a-0242c0a8400c
|
||||
# WARN [10-13|06:34:59.133] Attempting GerRPCCalls, but default PluginLoader has not been initialized
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=END api_method=eth_getBlockByHash api_params="[0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d false]" api_reqid=52 conn="192.168.64.4:59644" duration=5 user_id= uuid=a1893211-6992-11ee-a67a-0242c0a8400c
|
||||
# 2023/10/13 06:34:59 INFO Serving a free RPC request method=eth_chainId
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=START api_method=eth_chainId api_params="[]" api_reqid=53 conn="192.168.64.4:59658" user_id= uuid=a18a96d9-6992-11ee-a67a-0242c0a8400c
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=END api_method=eth_chainId api_params="[]" api_reqid=53 conn="192.168.64.4:59658" duration=0 user_id= uuid=a18a96d9-6992-11ee-a67a-0242c0a8400c
|
||||
# 2023/10/13 06:34:59 INFO Received a voucher payer=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 amount=100
|
||||
# 2023/10/13 06:35:01 INFO Serving a paid RPC request method=eth_getStorageAt cost=50 sender=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
# time="2023-10-13T06:35:01Z" level=debug msg=START api_method=eth_getStorageAt api_params="[0x2b6afbd4f479ce4101df722cf4e05f941523ead9 0xf76621c2cc1c1705fabbc22d30ffc5ded7f26e4995feb8d1c9812a2697ba1278 0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d]" api_reqid=54 conn="192.168.64.4:59660" user_id= uuid=a2bd75d2-6992-11ee-a67a-0242c0a8400c
|
||||
# time="2023-10-13T06:35:01Z" level=debug msg=END api_method=eth_getStorageAt api_params="[0x2b6afbd4f479ce4101df722cf4e05f941523ead9 0xf76621c2cc1c1705fabbc22d30ffc5ded7f26e4995feb8d1c9812a2697ba1278 0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d]" api_reqid=54 conn="192.168.64.4:59660" duration=7 user_id= uuid=a2bd75d2-6992-11ee-a67a-0242c0a8400c
|
||||
```
|
||||
|
||||
* Change the amount besides `PAY` button in debug panel to `>=100` for phisher reports next
|
||||
|
||||
* Perform a phisher report and check the watcher logs for received payments:
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# vulcanize:libp2p-utils [6:50:2] Received a message on mobymask P2P network from peer: 12D3KooWRkxV9SX8uTUZYkbRjai4Fsn7yavB61J5TMnksixsabsP
|
||||
# ts-nitro:engine {"msg":"Received message","_msg":{"to":"0xBBB676","from":"0x868042","payloadSummaries":[],"proposalSummaries":[],"payments":[{"amount":200,"channelId":"0x557153d729cf3323c0bdb40a36b245f98c2d4562933ba2182c9d61c5cfeda948"}],"rejectedObjectives":[]}}
|
||||
# laconic:payments Received a payment voucher of 100 from 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# vulcanize:libp2p-utils Payment received for a mutation request from 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# vulcanize:libp2p-utils Transaction receipt for invoke message {
|
||||
# to: '0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9',
|
||||
# blockNumber: 232,
|
||||
# blockHash: '0x6a188722c102662ea48af3786fe9db0d4b6c7ab7b27473eb0e628cf95746a244',
|
||||
# transactionHash: '0x6521205db8a905b3222adc2b6855f9b2abc72580624d299bec2a35bcba173efa',
|
||||
# effectiveGasPrice: '1500000007',
|
||||
# gasUsed: '113355'
|
||||
# }
|
||||
```
|
||||
|
||||
* Check the watcher - ipld-eth-server-1 payment channel status after a few requests:
|
||||
|
||||
```bash
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -s false -h ipld-eth-server-1 -p 4005"
|
||||
|
||||
# Expected output ('PaidSoFar' should be non zero):
|
||||
# {
|
||||
# ID: '0x8c0d17639bd2ba07dbcd248304a8f3c6c7276bfe25c2b87fe41f461e20f33f01',
|
||||
# Status: 'Open',
|
||||
# Balance: {
|
||||
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||
# Payer: '0xbbb676f9cff8d242e9eac39d063848807d3d1d94',
|
||||
# PaidSoFar: 30000n,
|
||||
# RemainingFunds: 999970000n
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
|
||||
## Clean Up
|
||||
|
||||
* In the MobyMask app, perform `VIRTUAL DEFUND` and `DIRECT DEFUND` (in order) for closing the payment channel created with watcher
|
||||
|
||||
* Run the following in the browser console to delete the Nitro node's data:
|
||||
|
||||
```bash
|
||||
await clearNodeStorage()
|
||||
```
|
||||
|
||||
* Run the following in the browser console to clear data in local storage:
|
||||
```bash
|
||||
localStorage.clear()
|
||||
```
|
||||
|
||||
* On a fresh restart, clear activity tab data in MetaMask for concerned accounts
|
||||
@@ -0,0 +1,267 @@
|
||||
# Demo
|
||||
|
||||
Stack components:
|
||||
* `ipld-eth-db` database for statediffed data
|
||||
* Local geth + lighthouse blockchain "fixturenet" running in statediffing mode
|
||||
* `ipld-eth-server-2` which runs an ETH RPC API and a GQL server; they both serve data from `ipld-eth-db`
|
||||
* A go-nitro deployment acting as the remote Nitro node for `ipld-eth-server-2`
|
||||
* Example ERC20 Ponder apps
|
||||
* `ponder-app-indexer-1` that pays the `ipld-eth-server-2` for ETH RPC requests
|
||||
* `ponder-app-indexer-2` that pays `ponder-app-indexer-1` for GQL queries
|
||||
* `ponder-app-watcher` that pays `ponder-app-indexer-2` for GQL queries
|
||||
|
||||
## Setup
|
||||
|
||||
* In a terminal, check `ipld-eth-server-2`'s logs to keep track of incoming RPC requests from the `ponder-app-indexer-1`:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="ipld-eth-server-2")
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
### ERC20 Ponder App
|
||||
|
||||
* Run the first indexer Ponder app:
|
||||
|
||||
```bash
|
||||
docker exec -it payments-ponder-app-indexer-1-1 bash -c "DEBUG=laconic:payments pnpm start"
|
||||
|
||||
# Expected output:
|
||||
# 12:57:03.751 INFO payment Nitro node setup with address 0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# laconic:payments Starting voucher subscription... +0ms
|
||||
# ...
|
||||
# 09:58:54.288 INFO payment Creating ledger channel with nitro node 0x660a4bEF3fbC863Fcd8D3CDB39242aE513d7D92e ...
|
||||
# 09:59:14.230 INFO payment Creating payment channel with nitro node 0x660a4bEF3fbC863Fcd8D3CDB39242aE513d7D92e ...
|
||||
# 09:59:14.329 INFO payment Using payment channel 0x1ff59db391b7a55bed723b930ab53c80e7ce857487c1e58771aa5a0737d71625
|
||||
```
|
||||
|
||||
* Export the payment channel id to a variable:
|
||||
|
||||
```bash
|
||||
export PONDER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||
```
|
||||
|
||||
* On starting the Ponder app in indexer mode, it creates a payment channel with the `ipld-eth-server-2`'s (external) Nitro node and then starts the historical sync service
|
||||
|
||||
* The sync service makes several ETH RPC requests to the `ipld-eth-server-2` to fetch required data; check the `ipld-eth-server-2` logs for charged RPC requests (`eth_getBlockByNumber`, `eth_getLogs`):
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# 2023/10/18 05:29:38 INFO Serving a paid RPC request method=eth_getBlockByNumber cost=50 sender=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# time="2023-10-18T05:29:38Z" level=debug msg=START api_method=eth_getBlockByNumber api_params="[latest true]" api_reqid=0 conn="172.26.0.19:42306" user_id= uuid=54992dc3-6d77-11ee-9ede-0242ac1a000f
|
||||
# WARN [10-18|05:29:38.292] Attempting GerRPCCalls, but default PluginLoader has not been initialized
|
||||
# time="2023-10-18T05:29:38Z" level=debug msg=END api_method=eth_getBlockByNumber api_params="[latest true]" api_reqid=0 conn="172.26.0.19:42306" duration=22 user_id= uuid=54992dc3-6d77-11ee-9ede-0242ac1a000f
|
||||
# ...
|
||||
# 2023/10/18 05:29:40 INFO Serving a paid RPC request method=eth_getLogs cost=50 sender=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# WARN [10-18|05:29:40.340] Attempting GerRPCCalls, but default PluginLoader has not been initialized
|
||||
# time="2023-10-18T05:29:40Z" level=debug msg="retrieving log cids for receipt ids"
|
||||
# ...
|
||||
```
|
||||
|
||||
* Check the Ponder - ipld-eth-server-2 payment channel status:
|
||||
|
||||
```bash
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $PONDER_UPSTREAM_PAYMENT_CHANNEL -s false -h go-nitro -p 4006"
|
||||
|
||||
# Expected output ('PaidSoFar' is non zero):
|
||||
# {
|
||||
# ID: '0x1ff59db391b7a55bed723b930ab53c80e7ce857487c1e58771aa5a0737d71625',
|
||||
# Status: 'Open',
|
||||
# Balance: {
|
||||
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||
# Payee: '0x660a4bef3fbc863fcd8d3cdb39242ae513d7d92e',
|
||||
# Payer: '0x67d5b55604d1af90074fcb69b8c51838fff84f8d',
|
||||
# PaidSoFar: 7200n,
|
||||
# RemainingFunds: 999992800n
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
* In another terminal run the second indexer Ponder app:
|
||||
|
||||
```bash
|
||||
docker exec -it payments-ponder-app-indexer-2-1 bash -c "DEBUG=laconic:payments pnpm start"
|
||||
|
||||
# Expected output:
|
||||
# 08:00:28.701 INFO payment Nitro node setup with address 0xB2B22ec3889d11f2ddb1A1Db11e80D20EF367c01
|
||||
# laconic:payments Starting voucher subscription... +0ms
|
||||
# ...
|
||||
# 09:58:54.288 INFO payment Creating ledger channel with nitro node 0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d ...
|
||||
# 09:59:14.230 INFO payment Creating payment channel with nitro node 0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d ...
|
||||
# 09:59:14.329 INFO payment Using payment channel 0xfbf9d7eb7c18446883c7f57f4c94db5607f414a224b3e921c787db07371d2a70
|
||||
```
|
||||
|
||||
* On starting indexer Ponder app, it creates a payment channel with first indexer and then starts the sync services
|
||||
|
||||
* Check logs in `ponder-indexer-1` to see payments made from `ponder-indexer-2` from GQL queries to fetch network data
|
||||
|
||||
```bash
|
||||
# ...
|
||||
# laconic:payments Received a payment voucher of 100 from 0xB2B22ec3889d11f2ddb1A1Db11e80D20EF367c01 +23ms
|
||||
# laconic:payments Serving a paid query for 0xB2B22ec3889d11f2ddb1A1Db11e80D20EF367c01 +0ms
|
||||
# 13:01:05.671 DEBUG payment Verified payment for GQL queries getEthLogs
|
||||
# laconic:payments Received a payment voucher of 100 from 0xB2B22ec3889d11f2ddb1A1Db11e80D20EF367c01 +20ms
|
||||
# laconic:payments Serving a paid query for 0xB2B22ec3889d11f2ddb1A1Db11e80D20EF367c01 +0ms
|
||||
# 13:01:05.691 DEBUG payment Verified payment for GQL queries getEthBlock
|
||||
# 13:01:07.598 INFO realtime Fetched missing blocks [686, 687] (network=fixturenet)
|
||||
# 13:01:07.598 DEBUG realtime Started processing new head block 686 (network=fixturenet)
|
||||
# ...
|
||||
```
|
||||
|
||||
* Following are the example GQL queries (with payment headers) `ponder-indexer-2` makes to `ponder-indexer-1` for fetching data
|
||||
|
||||
```graphql
|
||||
{
|
||||
getEthLogs(
|
||||
chainId: 1212,
|
||||
address: "0x6325439389e0797ab35752b4f43a14c004f22a9c",
|
||||
fromBlock: 100,
|
||||
toBlock: 200,
|
||||
) {
|
||||
address
|
||||
blockHash
|
||||
blockNumber
|
||||
data
|
||||
logIndex
|
||||
removed
|
||||
topics
|
||||
transactionHash
|
||||
transactionIndex
|
||||
}
|
||||
|
||||
getEthBlock(
|
||||
chainId: 1212,
|
||||
blockNumber: 150,
|
||||
fullTransactions: false
|
||||
) {
|
||||
baseFeePerGas
|
||||
difficulty
|
||||
extraData
|
||||
gasLimit
|
||||
gasUsed
|
||||
hash
|
||||
logsBloom
|
||||
miner
|
||||
mixHash
|
||||
nonce
|
||||
number
|
||||
parentHash
|
||||
receiptsRoot
|
||||
sha3Uncles
|
||||
size
|
||||
stateRoot
|
||||
timestamp
|
||||
totalDifficulty
|
||||
transactionsRoot
|
||||
txHashes
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* In another terminal run the Ponder app in watcher mode:
|
||||
|
||||
```bash
|
||||
docker exec -it payments-ponder-app-watcher-1 bash -c "DEBUG=laconic:payments pnpm start"
|
||||
|
||||
# Expected output:
|
||||
# 11:23:22.057 DEBUG app Started using config file: ponder.config.ts
|
||||
# 08:02:12.548 INFO payment Nitro node setup with address 0x111A00868581f73AB42FEEF67D235Ca09ca1E8db
|
||||
# laconic:payments Starting voucher subscription... +0ms
|
||||
# 08:02:17.417 INFO payment Creating ledger channel with nitro node 0xB2B22ec3889d11f2ddb1A1Db11e80D20EF367c01 ...
|
||||
# 08:02:37.135 INFO payment Creating payment channel with nitro node 0xB2B22ec3889d11f2ddb1A1Db11e80D20EF367c01 ...
|
||||
# 08:02:37.313 INFO payment Using payment channel 0xc48622577dfa389283beb19ed946274eb034587d72e61445dc997304be671f1a
|
||||
# ...
|
||||
# 11:23:22.436 INFO server Started responding as healthy
|
||||
```
|
||||
|
||||
* Check the terminal of the second indexer Ponder app. Logs of payment for `getLogEvents` queries can be seen:
|
||||
|
||||
```bash
|
||||
# ...
|
||||
# 08:02:37.763 DEBUG realtime Finished processing new head block 89 (network=fixturenet)
|
||||
# laconic:payments Received a payment voucher of 50 from 0x111A00868581f73AB42FEEF67D235Ca09ca1E8db +444ms
|
||||
# laconic:payments Serving a paid query for 0x111A00868581f73AB42FEEF67D235Ca09ca1E8db +1ms
|
||||
# 08:02:37.804 DEBUG payment Verified payment for GQL queries getLogEvents
|
||||
# laconic:payments Received a payment voucher of 50 from 0x111A00868581f73AB42FEEF67D235Ca09ca1E8db +45ms
|
||||
# laconic:payments Serving a paid query for 0x111A00868581f73AB42FEEF67D235Ca09ca1E8db +0ms
|
||||
# 08:02:37.849 DEBUG payment Verified payment for GQL queries getLogEvents
|
||||
```
|
||||
|
||||
* Following are the example GQL queries (with payment headers) `ponder-watcher` makes to `ponder-indexer-2` for fetching data
|
||||
|
||||
```graphql
|
||||
getLogEvents(
|
||||
fromTimestamp: 1695303079,
|
||||
toTimestamp: 1695304156,
|
||||
filters: [
|
||||
{
|
||||
name: "AdventureGold"
|
||||
chainId: 1212,
|
||||
address: ["0x6325439389e0797ab35752b4f43a14c004f22a9c"],
|
||||
fromBlock: 100,
|
||||
toBlock: 200,
|
||||
includeEventSelectors: ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
|
||||
}
|
||||
]
|
||||
) {
|
||||
events {
|
||||
transaction {
|
||||
hash
|
||||
}
|
||||
log {
|
||||
id
|
||||
}
|
||||
block {
|
||||
number
|
||||
}
|
||||
}
|
||||
metadata {
|
||||
pageEndsAtTimestamp
|
||||
isLastPage
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* Open watcher Ponder app endpoint http://localhost:42069
|
||||
|
||||
* Try GQL query to see transfer events
|
||||
|
||||
```graphql
|
||||
{
|
||||
transferEvents (orderBy: "timestamp", orderDirection: "desc") {
|
||||
id
|
||||
amount
|
||||
from {
|
||||
id
|
||||
}
|
||||
to {
|
||||
id
|
||||
}
|
||||
timestamp
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* Transfer an ERC20 token on chain
|
||||
|
||||
* Get the deployed ERC20 token address
|
||||
|
||||
```bash
|
||||
export TOKEN_ADDRESS=$(docker exec payments-ponder-er20-contracts-1 jq -r '.address' ./deployment/erc20-address.json)
|
||||
```
|
||||
|
||||
* Transfer token
|
||||
|
||||
```bash
|
||||
docker exec -it payments-ponder-er20-contracts-1 bash -c "yarn token:transfer:docker --token ${TOKEN_ADDRESS} --to 0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a --amount 5000"
|
||||
```
|
||||
|
||||
* Wait for a log in watcher Ponder app
|
||||
|
||||
```bash
|
||||
06:40:47.567 INFO handlers Processed 1 event (up to Oct 19, 2023)
|
||||
```
|
||||
|
||||
* Check the GQL query again in http://localhost:42069 to see a new `TransferEvent` entity
|
||||
@@ -0,0 +1,59 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-payments
|
||||
description: "Stack to demonstrate payments between various services"
|
||||
repos:
|
||||
# fixturenet repos
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
# ipld-eth-server with payments -- to be used by ipld-eth-server-payments pod
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@payments
|
||||
# nitro repo
|
||||
- github.com/cerc-io/ts-nitro@v0.1.15
|
||||
- github.com/cerc-io/go-nitro@v0.1.2-ts-port-0.1.9
|
||||
# mobymask watcher repos
|
||||
- github.com/cerc-io/watcher-ts@v0.2.66
|
||||
# this is mobymask-v3
|
||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.4
|
||||
- github.com/cerc-io/MobyMask@v0.1.3
|
||||
# mobymask app repos
|
||||
- github.com/cerc-io/mobymask-snap
|
||||
- github.com/cerc-io/mobymask-ui@v0.2.2
|
||||
# ponder repo
|
||||
- github.com/cerc-io/ponder@laconic-esm
|
||||
- github.com/cerc-io/erc20-watcher-ts
|
||||
containers:
|
||||
# fixturenet images
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/nitro-contracts
|
||||
- cerc/go-nitro
|
||||
- cerc/nitro-rpc-client
|
||||
# mobymask watcher images
|
||||
- cerc/watcher-ts
|
||||
- cerc/watcher-mobymask-v3
|
||||
- cerc/mobymask
|
||||
# mobymask app images
|
||||
- cerc/mobymask-snap
|
||||
- cerc/mobymask-ui
|
||||
# ponder image
|
||||
- cerc/ponder
|
||||
- cerc/watcher-erc20
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- ipld-eth-server-payments
|
||||
- ipld-eth-db
|
||||
- nitro-contracts
|
||||
- go-nitro
|
||||
- nitro-rpc-client
|
||||
- watcher-mobymask-v3
|
||||
- mobymask-snap
|
||||
- mobymask-app-v3
|
||||
- ponder-indexer
|
||||
- ponder-watcher
|
||||
@@ -0,0 +1,20 @@
|
||||
# fixturenet-plugeth-tx
|
||||
|
||||
A variation of `fixturenet-eth` that uses `plugeth` instead of `go-ethereum`.
|
||||
|
||||
See `stacks/fixturenet-eth/README.md` for more information.
|
||||
|
||||
## Containers
|
||||
|
||||
* cerc/lighthouse
|
||||
* cerc/fixturenet-eth-plugeth
|
||||
* cerc/fixturenet-eth-lighthouse
|
||||
* cerc/tx-spammer
|
||||
|
||||
## Deploy the stack
|
||||
Note: if there are any private Go dependencies, `CERC_GO_AUTH_TOKEN` must be set to a valid Gitea access token before running the `build-containers` command.
|
||||
```
|
||||
$ laconic-so --stack fixturenet-plugeth-tx setup-repositories
|
||||
$ laconic-so --stack fixturenet-plugeth-tx build-containers
|
||||
$ laconic-so --stack fixturenet-plugeth-tx deploy up
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
version: "1.2"
|
||||
name: fixturenet-plugeth-tx
|
||||
description: "plugeth Ethereum Fixturenet w/ tx-spammer"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/plugeth@statediff
|
||||
- git.vdb.to/cerc-io/plugeth-statediff
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v5
|
||||
- git.vdb.to/cerc-io/tx-spammer
|
||||
- github.com/dboreham/foundry
|
||||
containers:
|
||||
- cerc/plugeth-statediff
|
||||
- cerc/plugeth
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-plugeth-plugeth
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/tx-spammer
|
||||
- cerc/foundry
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/ipld-eth-server
|
||||
pods:
|
||||
- fixturenet-plugeth
|
||||
- ipld-eth-db
|
||||
- ipld-eth-server
|
||||
- tx-spammer
|
||||
- foundry
|
||||
@@ -0,0 +1,60 @@
|
||||
# Pocket Fixturenet
|
||||
|
||||
Instructions for deploying a local single-node Pocket chain alongside a geth + lighthouse blockchain "fixturenet" for development and testing purposes using Stack Orchestrator.
|
||||
|
||||
## 1. Clone required repositories
|
||||
```
|
||||
$ laconic-so --stack fixturenet-pocket setup-repositories
|
||||
```
|
||||
## 2. Build the stack's containers
|
||||
```
|
||||
$ laconic-so --stack fixturenet-pocket build-containers
|
||||
```
|
||||
## 3. Deploy the stack
|
||||
```
|
||||
$ laconic-so --stack fixturenet-pocket deploy up
|
||||
```
|
||||
It may take up to 10 minutes for the Eth Fixturenet to fully come online and start producing blocks.
|
||||
|
||||
## 4. Check status
|
||||
**Eth Fixturenet:**
|
||||
```
|
||||
$ laconic-so --stack fixturenet-pocket deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh
|
||||
```
|
||||
Response:
|
||||
```
|
||||
Waiting for geth to generate DAG.... done
|
||||
Waiting for beacon phase0.... done
|
||||
Waiting for beacon altair.... done
|
||||
Waiting for beacon bellatrix pre-merge.... done
|
||||
Waiting for beacon bellatrix merge.... done
|
||||
```
|
||||
|
||||
**Pocket node:**
|
||||
```
|
||||
$ laconic-so --stack fixturenet-pocket deploy exec pocket "pocket query height"
|
||||
```
|
||||
Response:
|
||||
```
|
||||
2023/04/20 08:07:46 Initializing Pocket Datadir
|
||||
2023/04/20 08:07:46 datadir = /home/app/.pocket
|
||||
http://localhost:8081/v1/query/height
|
||||
{
|
||||
"height": 4
|
||||
}
|
||||
```
|
||||
or see the full logs:
|
||||
```
|
||||
$ laconic-so --stack fixturenet-pocket deploy logs pocket
|
||||
```
|
||||
## 5. Send a relay request to Pocket node
|
||||
The Pocket node serves relay requests at `http://localhost:8081/v1/client/sim`
|
||||
|
||||
Example request:
|
||||
```
|
||||
$ curl -X POST --data '{"relay_network_id":"0021","payload":{"data":"{\"jsonrpc\": \"2.0\",\"id\": 1,\"method\": \"eth_blockNumber\",\"params\": []}","method":"POST","path":"","headers":{}}}' http://localhost:8081/v1/client/sim
|
||||
```
|
||||
Response:
|
||||
```
|
||||
"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x6fe\"}\n"
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-pocket
|
||||
description: "A single node pocket chain that can serve relays from the geth-1 node in eth-fixturenet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/pokt-network/pocket-core
|
||||
- github.com/pokt-network/pocket-core-deployments # contains the dockerfile
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/pocket
|
||||
pods:
|
||||
- fixturenet-pocket
|
||||
- fixturenet-eth
|
||||
@@ -0,0 +1,204 @@
|
||||
# Fixturenet SushiSwap Subgraph
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-sushiswap-subgraph setup-repositories --pull
|
||||
```
|
||||
|
||||
Checkout to a non-default branch in the cloned repos if required:
|
||||
|
||||
```bash
|
||||
# Default repo base dir
|
||||
cd ~/cerc
|
||||
|
||||
# Example
|
||||
cd graph-node
|
||||
git checkout <your-branch> && git pull
|
||||
|
||||
# Remove the corresponding docker image if it already exists
|
||||
docker image rm cerc/graph-node:local
|
||||
# Remove any dangling images
|
||||
docker image prune
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-sushiswap-subgraph build-containers
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-sushiswap-subgraph deploy --cluster sushigraph up
|
||||
|
||||
# Note: Remove any existing volumes for the cluster for a fresh start
|
||||
```
|
||||
|
||||
After all services have started:
|
||||
|
||||
* Follow `graph-node` logs:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-sushiswap-subgraph deploy --cluster sushigraph logs -f graph-node
|
||||
```
|
||||
|
||||
* Check that the subgraphs have been deployed:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-sushiswap-subgraph deploy --cluster sushigraph logs -f sushiswap-subgraph-v3
|
||||
|
||||
# Expected output:
|
||||
# .
|
||||
# .
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | - Deploying to Graph node http://graph-node:8020/
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Deployed to http://graph-node:8000/subgraphs/name/sushiswap/v3-lotus/graphql
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Subgraph endpoints:
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Queries (HTTP): http://graph-node:8000/subgraphs/name/sushiswap/v3-lotus
|
||||
# .
|
||||
# .
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | - Deploying to Graph node http://graph-node:8020/
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Deployed to http://graph-node:8000/subgraphs/name/sushiswap/blocks/graphql
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Subgraph endpoints:
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Queries (HTTP): http://graph-node:8000/subgraphs/name/sushiswap/blocks
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Done
|
||||
```
|
||||
|
||||
After `graph-node` has fetched the latest blocks from upstream, use the subgraph (GQL) endpoints for querying:
|
||||
|
||||
```bash
|
||||
# Find out the mapped host port for the subgraph endpoint
|
||||
laconic-so --stack fixturenet-sushiswap-subgraph deploy --cluster sushigraph port graph-node 8000
|
||||
# 0.0.0.0:HOST_PORT
|
||||
|
||||
# Blocks subgraph endpoint:
|
||||
http://127.0.0.1:<HOST_PORT>/subgraphs/name/sushiswap/blocks/graphql
|
||||
|
||||
# v3 subgraph endpoint:
|
||||
http://127.0.0.1:<HOST_PORT>/subgraphs/name/sushiswap/v3-lotus/graphql
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
* Deploy an ERC20 token:
|
||||
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
|
||||
|
||||
# Deploy two tokens and set the addresses to variables TOKEN1_ADDRESS and TOKEN2_ADDRESS
|
||||
export TOKEN1_ADDRESS=<TOKEN1_ADDRESS>
|
||||
export TOKEN2_ADDRESS=<TOKEN2_ADDRESS>
|
||||
```
|
||||
|
||||
* Get contract address of factory deployed:
|
||||
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 jq -r '.address' /app/deployments/docker/UniswapV3Factory.json
|
||||
|
||||
# Set the address to variable FACTORY_ADDRESS
|
||||
export FACTORY_ADDRESS=<FACTORY_ADDRESS>
|
||||
```
|
||||
|
||||
* Create a pool:
|
||||
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:create:docker --factory $FACTORY_ADDRESS --token0 $TOKEN1_ADDRESS --token1 $TOKEN2_ADDRESS --fee 500
|
||||
|
||||
# Set the created pool address to variable POOL_ADDRESS
|
||||
export POOL_ADDRESS=<POOL_ADDRESS>
|
||||
```
|
||||
|
||||
* Initialize the pool:
|
||||
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:initialize:docker --sqrt-price 4295128939 --pool $POOL_ADDRESS
|
||||
```
|
||||
|
||||
* Set the recipient address to the contract deployer:
|
||||
|
||||
```bash
|
||||
export RECIPIENT=0xD375B03bd3A2434A9f675bEC4Ccd68aC5e67C743
|
||||
```
|
||||
|
||||
* Trigger pool `Mint` event:
|
||||
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:mint:docker --pool $POOL_ADDRESS --recipient $RECIPIENT --amount 10
|
||||
```
|
||||
|
||||
* Trigger pool `Burn` event:
|
||||
|
||||
```bash
|
||||
docker exec -it sushigraph-sushiswap-v3-core-1 pnpm run pool:burn:docker --pool $POOL_ADDRESS --amount 10
|
||||
```
|
||||
|
||||
* Query the sushiswap v3-lotus subgraph GQL after running above commands
|
||||
|
||||
```graphql
|
||||
{
|
||||
_meta {
|
||||
block {
|
||||
number
|
||||
}
|
||||
deployment
|
||||
hasIndexingErrors
|
||||
}
|
||||
|
||||
factories {
|
||||
poolCount
|
||||
id
|
||||
}
|
||||
|
||||
pools {
|
||||
id
|
||||
token0 {
|
||||
id
|
||||
name
|
||||
symbol
|
||||
}
|
||||
mints {
|
||||
id
|
||||
owner
|
||||
}
|
||||
burns {
|
||||
id
|
||||
owner
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-sushiswap-subgraph deploy --cluster sushigraph down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=sushigraph"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=sushigraph")
|
||||
|
||||
# WARNING: To avoid refetching the Lotus proof params on the next run,
|
||||
# avoid removing the corresponding volumes
|
||||
|
||||
# To remove volumes that do not contain Lotus params
|
||||
docker volume rm $(docker volume ls -q --filter "name=sushigraph" | grep -v "params$")
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
version: "1.0"
|
||||
name: fixturenet-sushiswap-subgraph
|
||||
description: "An end-to-end SushiSwap Subgraph stack"
|
||||
repos:
|
||||
# fixturenet-lotus repo
|
||||
- github.com/filecoin-project/lotus
|
||||
# graph-node repo
|
||||
- github.com/graphprotocol/graph-node
|
||||
# sushiswap repos
|
||||
- github.com/cerc-io/sushiswap-v3-core@watcher-ts
|
||||
- github.com/cerc-io/sushiswap-v3-periphery@watcher-ts
|
||||
# sushiswap subgraph repo
|
||||
- github.com/sushiswap/subgraphs
|
||||
containers:
|
||||
# fixturenet-lotus image
|
||||
- cerc/lotus
|
||||
# graph-node image
|
||||
- cerc/graph-node
|
||||
# sushiswap contract deployment images
|
||||
- cerc/sushiswap-v3-core
|
||||
- cerc/sushiswap-v3-periphery
|
||||
# sushiswap subgraphs image
|
||||
- cerc/sushiswap-subgraphs
|
||||
pods:
|
||||
- fixturenet-lotus
|
||||
- graph-node
|
||||
- contract-sushiswap
|
||||
- fixturenet-sushiswap-subgraph-v3
|
||||
@@ -0,0 +1,98 @@
|
||||
# Gelato watcher
|
||||
|
||||
Instructions to setup and deploy Gelato watcher using [laconic-stack-orchestrator](/README.md#install)
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: `ipld-eth-server` RPC and GQL endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato setup-repositories
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
Checkout to required version in the repo:
|
||||
|
||||
```bash
|
||||
# gelato-watcher-ts
|
||||
cd ~/cerc/gelato-watcher-ts
|
||||
git checkout v0.1.0
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato build-containers
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-gelato/watcher-params.env)):
|
||||
|
||||
```bash
|
||||
# External ipld-eth-server endpoints
|
||||
CERC_IPLD_ETH_RPC=
|
||||
CERC_IPLD_ETH_GQL=
|
||||
|
||||
# Whether to use a state snapshot to initialize the watcher
|
||||
CERC_USE_STATE_SNAPSHOT=false
|
||||
|
||||
# State snapshot params
|
||||
# Required if CERC_USE_STATE_SNAPSHOT is set to true
|
||||
CERC_SNAPSHOT_GQL_ENDPOINT=
|
||||
CERC_SNAPSHOT_BLOCKHASH=
|
||||
```
|
||||
|
||||
* NOTE: If `ipld-eth-server` is running on the host machine, use `host.docker.internal` as the hostname to access the host port(s)
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato deploy --env-file <PATH_TO_ENV_FILE> up
|
||||
```
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato deploy ps
|
||||
|
||||
# With status
|
||||
docker ps
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
The stack runs an active watcher with following endpoints exposed on the host ports:
|
||||
* `3008`: watcher endpoint
|
||||
* `9000`: watcher metrics
|
||||
* `9001`: watcher GQL metrics
|
||||
|
||||
## Web Apps
|
||||
|
||||
TODO
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato deploy down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=.*gelato_watcher_db_data|.*gelato_watcher_state_gql"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*gelato_watcher_db_data|.*gelato_watcher_state_gql")
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
version: "1.0"
|
||||
name: gelato
|
||||
repos:
|
||||
- github.com/cerc-io/gelato-watcher-ts
|
||||
containers:
|
||||
- cerc/watcher-gelato
|
||||
pods:
|
||||
- watcher-gelato
|
||||
@@ -0,0 +1,157 @@
|
||||
# Graph Node
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack graph-node setup-repositories --pull
|
||||
```
|
||||
|
||||
Checkout to a non-default branch in the cloned repos if required:
|
||||
|
||||
```bash
|
||||
# Default repo base dir
|
||||
cd ~/cerc
|
||||
|
||||
# Example
|
||||
cd graph-node
|
||||
git checkout <your-branch> && git pull
|
||||
|
||||
# Remove the corresponding docker image if it already exists
|
||||
docker image rm cerc/graph-node:local
|
||||
# Remove any dangling images
|
||||
docker image prune
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack graph-node build-containers
|
||||
```
|
||||
|
||||
## Create a deployment
|
||||
|
||||
Initialize deployment and create "spec" file:
|
||||
|
||||
```bash
|
||||
laconic-so --stack graph-node deploy init --output graph-node-spec.yml
|
||||
```
|
||||
|
||||
We need to assign fixed ports: `8000` for subgraph GQL endpoint, `8020` for subgraph deployment and `5001` for IPFS. The values can be
|
||||
customized by editing the "spec" file generated by `laconic-so deploy init`.
|
||||
```
|
||||
$ cat graph-node-spec.yml
|
||||
stack: graph-node
|
||||
ports:
|
||||
graph-node:
|
||||
- '8000:8000'
|
||||
- '8001'
|
||||
- '8020:8020'
|
||||
- '8030'
|
||||
ipfs:
|
||||
- '8080'
|
||||
- '4001'
|
||||
- '5001:5001'
|
||||
...
|
||||
```
|
||||
|
||||
Create deployment:
|
||||
|
||||
```bash
|
||||
laconic-so deploy create --spec-file graph-node-spec.yml --deployment-dir graph-node-deployment
|
||||
```
|
||||
|
||||
## Start the stack
|
||||
|
||||
Create an env file with the following values to be set before starting the stack:
|
||||
|
||||
```bash
|
||||
# Set ETH RPC endpoint the graph node will use
|
||||
|
||||
# Host and port of the ETH RPC endpoint to check before starting graph-node
|
||||
export ETH_RPC_HOST=
|
||||
export ETH_RPC_PORT=
|
||||
|
||||
# The etherum network(s) graph-node will connect to
|
||||
# Set this to a space-separated list of the networks where each entry has the form NAME:URL
|
||||
export ETH_NETWORKS=
|
||||
```
|
||||
|
||||
Example env file:
|
||||
|
||||
```bash
|
||||
export ETH_RPC_HOST=filecoin.chainup.net
|
||||
export ETH_RPC_PORT=443
|
||||
|
||||
export ETH_NETWORKS=filecoin:https://filecoin.chainup.net/rpc/v1
|
||||
```
|
||||
|
||||
Set the environment variables:
|
||||
|
||||
```bash
|
||||
source <PATH_TO_ENV_FILE>
|
||||
```
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir graph-node-deployment start
|
||||
|
||||
# Note: Remove any existing volumes in the cluster for a fresh start
|
||||
```
|
||||
|
||||
After all services have started, follow `graph-node` logs:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir graph-node-deployment logs -f graph-node
|
||||
```
|
||||
|
||||
Subgraphs can now be deployed to the graph-node.
|
||||
Follow [Deploy the Subgraph](https://github.com/graphprotocol/graph-node/blob/v0.32.0/docs/getting-started.md#24-deploy-the-subgraph) section in graph-node docs for an existing subgraph.
|
||||
|
||||
## Set environment variables
|
||||
|
||||
* The graph-node environment variable `ETHEREUM_REORG_THRESHOLD` can be set in the deployment compose file
|
||||
```bash
|
||||
$ cat graph-node-deployment/compose/docker-compose-graph-node.yml
|
||||
services:
|
||||
graph-node:
|
||||
image: cerc/graph-node:local
|
||||
...
|
||||
environment:
|
||||
...
|
||||
GRAPH_LOG: debug
|
||||
ETHEREUM_REORG_THRESHOLD: 3
|
||||
```
|
||||
Change `ETHEREUM_REORG_THRESHOLD` to desired value
|
||||
|
||||
* To restart graph-node with updated values
|
||||
* Stop the stack first
|
||||
```bash
|
||||
laconic-so deployment --dir graph-node-deployment stop
|
||||
```
|
||||
* Start the stack again
|
||||
```
|
||||
laconic-so deployment --dir graph-node-deployment start
|
||||
```
|
||||
* To check if environment variable has been updated in graph-node container
|
||||
```bash
|
||||
$ laconic-so deployment --dir graph-node-deployment exec graph-node bash
|
||||
root@dc4d3abe1615:/# echo $ETHEREUM_REORG_THRESHOLD
|
||||
16
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir graph-node-deployment stop
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir graph-node-deployment stop --delete-volumes
|
||||
```
|
||||
@@ -0,0 +1,68 @@
|
||||
# Deploying Subgraph
|
||||
|
||||
## Setup
|
||||
|
||||
We will use the [ethereum-gravatar](https://github.com/graphprotocol/graph-tooling/tree/%40graphprotocol/graph-cli%400.58.0/examples/ethereum-gravatar) example subgraph from `graphprotocol/graph-tooling` repo
|
||||
|
||||
- Clone the repo
|
||||
```bash
|
||||
git clone git@github.com:graphprotocol/graph-tooling.git
|
||||
|
||||
cd graph-tooling
|
||||
```
|
||||
|
||||
- Install dependencies
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
- Change directory to example-subgraph
|
||||
```bash
|
||||
cd examples/ethereum-gravatar
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
The following steps should be similar for every subgraph
|
||||
|
||||
- Change the network and address in `subgraph.yaml`
|
||||
```yaml
|
||||
...
|
||||
dataSources:
|
||||
- kind: ethereum/contract
|
||||
name: Gravity
|
||||
network: <NETWORK_NAME>
|
||||
source:
|
||||
address: '<CONTRACT_ADDRESS>'
|
||||
abi: Gravity
|
||||
startBlock: <START_BLOCK>
|
||||
...
|
||||
```
|
||||
- `CONTRACT_ADDRESS` is the address of the deployed contract on the desired network
|
||||
- `START_BLOCK` is the block number after which we want to process events
|
||||
- `NETWORK_NAME` is the name of the network specified when deploying graph-node
|
||||
- When deploying graph-node `ETH_NETWORKS` env is set to a space-separated list of the networks where each entry has the form `NAME:URL`
|
||||
- The `NAME` can be used in subgraph to specify which network to use
|
||||
- More details can be seen in [Start the stack](./README.md#start-the-stack) section
|
||||
|
||||
- Build the subgraph
|
||||
```bash
|
||||
pnpm codegen
|
||||
pnpm build
|
||||
```
|
||||
|
||||
- Create and deploy the subgraph
|
||||
```bash
|
||||
pnpm graph create example --node <GRAPH_NODE_DEPLOY_ENDPOINT>
|
||||
|
||||
pnpm graph deploy example --ipfs <GRAPH_NODE_IPFS_ENDPOINT> --node <GRAPH_NODE_DEPLOY_ENDPOINT>
|
||||
```
|
||||
- `GRAPH_NODE_DEPLOY_ENDPOINT` and `GRAPH_NODE_IPFS_ENDPOINT` will be available after graph-node has been deployed
|
||||
- More details can be seen in [Create a deployment](./README.md#create-a-deployment) section
|
||||
|
||||
- The subgraph GQL endpoint will be seen after deploy command runs successfully
|
||||
|
||||
- To remove the subgraph
|
||||
```bash
|
||||
pnpm graph remove --node <GRAPH_NODE_DEPLOY_ENDPOINT> example
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
version: "1.0"
|
||||
name: graph-node
|
||||
description: "Stack for running graph-node"
|
||||
repos:
|
||||
- github.com/graphprotocol/graph-node
|
||||
containers:
|
||||
- cerc/graph-node
|
||||
pods:
|
||||
- graph-node
|
||||
@@ -0,0 +1,30 @@
|
||||
# Kubo (IPFS)
|
||||
|
||||
The Kubo stack currently uses the native IPFS docker image, therefore a single command will do:
|
||||
|
||||
```
|
||||
laconic-so --stack kubo deploy up
|
||||
```
|
||||
|
||||
If running locally, visit: http://localhost:5001/webui and explore the functionality of the WebUI.
|
||||
|
||||
If running in the cloud, visit `IP:5001/webui` and you'll likely see this error: "Could not connect to the IPFS API". To fix it:
|
||||
|
||||
1. Get the container name with `docker ps`:
|
||||
|
||||
2. Go into the container:
|
||||
|
||||
```
|
||||
laconic-so --stack kubo deploy exec ipfs sh
|
||||
```
|
||||
|
||||
3. Enable CORS as described in point 2 of the error message. Copy/paste/run each line in sequence, then run `exit` to exit the container.
|
||||
|
||||
4. Restart the container:
|
||||
|
||||
```
|
||||
laconic-so --stack kubo deploy down
|
||||
laconic-so --stack kubo deploy up
|
||||
```
|
||||
|
||||
5. Refresh the `IP:5001/webui` URL in your browser, you should now be connected to IPFS.
|
||||
@@ -0,0 +1,7 @@
|
||||
version: "1.0"
|
||||
name: kubo
|
||||
description: "Run kubo (IPFS)"
|
||||
repos:
|
||||
containers:
|
||||
pods:
|
||||
- kubo
|
||||
@@ -0,0 +1,9 @@
|
||||
# laconic-dot-com
|
||||
|
||||
```
|
||||
laconic-so --stack laconic-dot-com setup-repositories
|
||||
laconic-so --stack laconic-dot-com build-containers
|
||||
laconic-so --stack laconic-dot-com deploy init --output laconic-website-spec.yml --map-ports-to-host localhost-same
|
||||
laconic-so --stack laconic-dot-com deploy create --spec-file laconic-website-spec.yml --deployment-dir lx-website
|
||||
laconic-so deployment --dir lx-website start
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
version: "0.1"
|
||||
name: laconic-dot-com
|
||||
repos:
|
||||
- github.com/LaconicNetwork/laconic.com@v0.0.1
|
||||
containers:
|
||||
- cerc/laconic-dot-com
|
||||
pods:
|
||||
- laconic-dot-com
|
||||
@@ -0,0 +1,7 @@
|
||||
# lasso
|
||||
|
||||
```
|
||||
laconic-so --stack lasso setup-repositories
|
||||
laconic-so --stack lasso build-containers
|
||||
laconic-so --stack lasso deploy up
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
version: "0.1"
|
||||
name: lasso
|
||||
repos:
|
||||
- github.com/cerc-io/lasso
|
||||
containers:
|
||||
- cerc/lasso
|
||||
pods:
|
||||
- lasso
|
||||
@@ -0,0 +1,141 @@
|
||||
# mainnet-eth-plugeth
|
||||
|
||||
Deploys a "head-tracking" mainnet Ethereum stack comprising a [plugeth](https://git.vdb.to/cerc-io/plugeth) execution layer node and a [lighthouse](https://github.com/sigp/lighthouse) consensus layer node, with [plugeth-statediff](https://git.vdb.to/cerc-io/plugeth-statediff) for statediffing, [ipld-eth-db](https://git.vdb.to/cerc-io/ipld-eth-db) for storage, and [ipld-eth-server](https://git.vdb.to/cerc-io/ipld-eth-server) for indexed ETH IPLD objects.
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-eth-plugeth setup-repositories
|
||||
```
|
||||
|
||||
## Build containers
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-eth-plugeth build-containers
|
||||
```
|
||||
|
||||
## Create a deployment
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-eth-plugeth deploy init --map-ports-to-host any-same --output mainnet-eth-plugeth-spec.yml
|
||||
$ laconic-so --stack mainnet-eth-plugeth deploy create --spec-file mainnet-eth-plugeth-spec.yml --deployment-dir mainnet-eth-plugeth-deployment
|
||||
```
|
||||
## Start the stack
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-plugeth-deployment start
|
||||
```
|
||||
Display stack status:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-plugeth-deployment ps
|
||||
Running containers:
|
||||
id: f39608eca04d72d6b0f1f3acefc5ebb52908da06e221d20c7138f7e3dff5e423, name: laconic-ef641b4d13eb61ed561b19be67063241-foundry-1, ports:
|
||||
id: 4052b1eddd886ae0d6b41f9ff22e68a70f267b2bfde10f4b7b79b5bd1eeddcac, name: laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-geth-1-1, ports: 30303/tcp, 30303/udp, 0.0.0.0:49184->40000/tcp, 0.0.0.0:49185->6060/tcp, 0.0.0.0:49186->8545/tcp, 8546/tcp
|
||||
id: ac331232e597944b621b3b8942ace5dafb14524302cab338ff946c7f6e5a1d52, name: laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-lighthouse-1-1, ports: 0.0.0.0:49187->8001/tcp
|
||||
```
|
||||
See stack logs:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-plugeth-deployment logs
|
||||
time="2023-07-25T09:46:29-06:00" level=warning msg="The \"CERC_SCRIPT_DEBUG\" variable is not set. Defaulting to a blank string."
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-lighthouse-1-1 | Jul 25 15:45:13.362 INFO Logging to file path: "/var/lighthouse-data-dir/beacon/logs/beacon.log"
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-lighthouse-1-1 | Jul 25 15:45:13.365 INFO Lighthouse started version: Lighthouse/v4.1.0-693886b
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-lighthouse-1-1 | Jul 25 15:45:13.365 INFO Configured for network name: mainnet
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-lighthouse-1-1 | Jul 25 15:45:13.366 INFO Data directory initialised datadir: /var/lighthouse-data-dir
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-lighthouse-1-1 | Jul 25 15:45:13.366 INFO Deposit contract address: 0x00000000219ab540356cbb839cbe05303d7705fa, deploy_block: 11184524
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-plugeth-lighthouse-1-1 | Jul 25 15:45:13.424 INFO Starting checkpoint sync remote_url: https://beaconstate.ethstaker.cc/, service: beacon
|
||||
```
|
||||
## Monitoring stack sync progress
|
||||
Both go-ethereum and lighthouse will engage in an initial chain sync phase that will last up to several hours depending on hardware performance and network capacity.
|
||||
Syncing can be monitored by looking for these log messages:
|
||||
```
|
||||
Jul 24 12:34:17.001 INFO Downloading historical blocks est_time: 5 days 11 hrs, speed: 14.67 slots/sec, distance: 6932481 slots (137 weeks 3 days), service: slot_notifier
|
||||
INFO [07-24|12:14:52.493] Syncing beacon headers downloaded=145,920 left=17,617,968 eta=1h23m32.815s
|
||||
INFO [07-24|12:33:15.238] Syncing: chain download in progress synced=1.86% chain=148.94MiB headers=368,640@95.03MiB bodies=330,081@40.56MiB receipts=330,081@13.35MiB eta=37m54.505s
|
||||
INFO [07-24|12:35:13.028] Syncing: state download in progress synced=1.32% state=4.64GiB accounts=2,850,314@677.57MiB slots=18,663,070@3.87GiB codes=26662@111.14MiB eta=3h18m0.699s
|
||||
```
|
||||
Once synced up these log messages will be observed:
|
||||
```
|
||||
INFO Synced slot: 6952515, block: 0x5bcb…f6d9, epoch: 217266, finalized_epoch: 217264, finalized_root: 0x6342…2c5c, exec_hash: 0x8d8c…2443 (verified), peers: 31, service: slot_notifier
|
||||
INFO [07-25|03:04:48.941] Imported new potential chain segment number=17,767,316 hash=84f6e7..bc2cb0 blocks=1 txs=137 mgas=16.123 elapsed=57.087ms mgasps=282.434 dirty=461.46MiB
|
||||
INFO [07-25|03:04:49.042] Chain head was updated number=17,767,316 hash=84f6e7..bc2cb0 root=ca58b2..8258c1 elapsed=2.480111ms
|
||||
```
|
||||
## Clean up
|
||||
|
||||
Stop the stack:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-plugeth-deployment stop
|
||||
```
|
||||
This leaves data volumes in place, allowing the stack to be subsequently re-started.
|
||||
To permanently *delete* the stack's data volumes run:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-plugeth-deployment stop --delete-data-volumes
|
||||
```
|
||||
After deleting the volumes, any subsequent re-start will begin chain sync from cold.
|
||||
|
||||
## Ports
|
||||
It is usually necessary to expose certain container ports on one or more the host's addresses to allow incoming connections.
|
||||
Any ports defined in the Docker compose file are exposed by default with random port assignments, bound to "any" interface (IP address 0.0.0.0), but the port mappings can be
|
||||
customized by editing the "spec" file generated by `laconic-so deploy init`.
|
||||
|
||||
In this example, ports `8545` and `5052` have been assigned to a specific addresses/port combination on the host, while
|
||||
port `40000` has been left with random assignment:
|
||||
```
|
||||
$ cat mainnet-eth-plugeth-spec.yml
|
||||
stack: mainnet-eth-plugeth
|
||||
ports:
|
||||
mainnet-eth-plugeth-geth-1:
|
||||
- '10.10.10.10:8545:8545'
|
||||
- '40000'
|
||||
mainnet-eth-plugeth-lighthouse-1:
|
||||
- '10.10.10.10:5052:5052'
|
||||
volumes:
|
||||
mainnet_eth_plugeth_config_data: ./data/mainnet_eth_plugeth_config_data
|
||||
mainnet_eth_plugeth_geth_1_data: ./data/mainnet_eth_plugeth_geth_1_data
|
||||
mainnet_eth_plugeth_lighthouse_1_data: ./data/mainnet_eth_plugeth_lighthouse_1_data
|
||||
```
|
||||
In addition, a stack-wide port mapping "recipe" can be applied at the time the
|
||||
`laconic-so deploy init` command is run, by supplying the desired recipe with the `--map-ports-to-host` option. The following recipes are supported:
|
||||
| Recipe | Host Port Mapping |
|
||||
|--------|-------------------|
|
||||
| any-variable-random | Bind to 0.0.0.0 using a random port assigned at start time (default) |
|
||||
| localhost-same | Bind to 127.0.0.1 using the same port number as exposed by the containers |
|
||||
| any-same | Bind to 0.0.0.0 using the same port number as exposed by the containers |
|
||||
| localhost-fixed-random | Bind to 127.0.0.1 using a random port number selected at the time the command is run (not checked for already in use)|
|
||||
| any-fixed-random | Bind to 0.0.0.0 using a random port number selected at the time the command is run (not checked for already in use) |
|
||||
## Data volumes
|
||||
Container data volumes are bind-mounted to specified paths in the host filesystem.
|
||||
The default setup (generated by `laconic-so deploy init`) places the volumes in the `./data` subdirectory of the deployment directory:
|
||||
```
|
||||
$ cat mainnet-eth-plugeth-spec.yml
|
||||
stack: mainnet-eth-plugeth
|
||||
ports:
|
||||
mainnet-eth-plugeth-geth-1:
|
||||
- '10.10.10.10:8545:8545'
|
||||
- '40000'
|
||||
mainnet-eth-plugeth-lighthouse-1:
|
||||
- '10.10.10.10:5052:5052'
|
||||
volumes:
|
||||
mainnet_eth_plugeth_config_data: ./data/mainnet_eth_plugeth_config_data
|
||||
mainnet_eth_plugeth_geth_1_data: ./data/mainnet_eth_plugeth_geth_1_data
|
||||
mainnet_eth_plugeth_lighthouse_1_data: ./data/mainnet_eth_plugeth_lighthouse_1_data
|
||||
```
|
||||
A synced-up stack will consume around 900GB of data volume space:
|
||||
```
|
||||
$ sudo du -h mainnet-eth-plugeth-deployment/data/
|
||||
150M mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_lighthouse_1_data/beacon/freezer_db
|
||||
25G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_lighthouse_1_data/beacon/chain_db
|
||||
16K mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_lighthouse_1_data/beacon/network
|
||||
368M mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_lighthouse_1_data/beacon/logs
|
||||
26G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_lighthouse_1_data/beacon
|
||||
26G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_lighthouse_1_data
|
||||
8.0K mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_config_data
|
||||
4.0K mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/keystore
|
||||
527G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/geth/chaindata/ancient/chain
|
||||
527G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/geth/chaindata/ancient
|
||||
859G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/geth/chaindata
|
||||
4.8M mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/geth/nodes
|
||||
242M mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/geth/ethash
|
||||
669M mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/geth/triecache
|
||||
860G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data/geth
|
||||
860G mainnet-eth-plugeth-deployment/data/mainnet_eth_plugeth_geth_1_data
|
||||
885G mainnet-eth-plugeth-deployment/data/
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
# Copyright © 2023 Vulcanize
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||
|
||||
from secrets import token_hex
|
||||
|
||||
|
||||
def init(ctx):
|
||||
return None
|
||||
|
||||
|
||||
def setup(ctx):
|
||||
return None
|
||||
|
||||
|
||||
def create(ctx, extra_args):
|
||||
# Generate the JWT secret and save to its config file
|
||||
secret = token_hex(32)
|
||||
jwt_file_path = ctx.deployment_dir.joinpath("data", "mainnet_eth_plugeth_config_data", "jwtsecret")
|
||||
with open(jwt_file_path, 'w+') as jwt_file:
|
||||
jwt_file.write(secret)
|
||||
@@ -0,0 +1,29 @@
|
||||
version: "1.2"
|
||||
name: mainnet-eth
|
||||
description: "Ethereum Mainnet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/plugeth@statediff
|
||||
- git.vdb.to/cerc-io/plugeth-statediff
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v5
|
||||
- git.vdb.to/cerc-io/keycloak-reg-api
|
||||
- git.vdb.to/cerc-io/keycloak-reg-ui
|
||||
containers:
|
||||
- cerc/plugeth-statediff
|
||||
- cerc/plugeth
|
||||
- cerc/plugeth-with-plugins
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/keycloak
|
||||
- cerc/webapp-base
|
||||
- cerc/keycloak-reg-api
|
||||
- cerc/keycloak-reg-ui
|
||||
pods:
|
||||
- mainnet-eth-plugeth
|
||||
- mainnet-eth-ipld-eth-db
|
||||
- mainnet-eth-ipld-eth-server
|
||||
- mainnet-eth-keycloak
|
||||
- mainnet-eth-metrics
|
||||
@@ -0,0 +1,141 @@
|
||||
# mainnet-eth
|
||||
|
||||
Deploys a "head-tracking" mainnet Ethereum stack comprising a [go-ethereum](https://github.com/cerc-io/go-ethereum) execution layer node and a [lighthouse](https://github.com/sigp/lighthouse) consensus layer node.
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-eth setup-repositories
|
||||
```
|
||||
|
||||
## Build containers
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-eth build-containers
|
||||
```
|
||||
|
||||
## Create a deployment
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-eth deploy init --map-ports-to-host any-same --output mainnet-eth-spec.yml
|
||||
$ laconic-so deploy create --spec-file mainnet-eth-spec.yml --deployment-dir mainnet-eth-deployment
|
||||
```
|
||||
## Start the stack
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-deployment start
|
||||
```
|
||||
Display stack status:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-deployment ps
|
||||
Running containers:
|
||||
id: f39608eca04d72d6b0f1f3acefc5ebb52908da06e221d20c7138f7e3dff5e423, name: laconic-ef641b4d13eb61ed561b19be67063241-foundry-1, ports:
|
||||
id: 4052b1eddd886ae0d6b41f9ff22e68a70f267b2bfde10f4b7b79b5bd1eeddcac, name: laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-geth-1-1, ports: 30303/tcp, 30303/udp, 0.0.0.0:49184->40000/tcp, 0.0.0.0:49185->6060/tcp, 0.0.0.0:49186->8545/tcp, 8546/tcp
|
||||
id: ac331232e597944b621b3b8942ace5dafb14524302cab338ff946c7f6e5a1d52, name: laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-lighthouse-1-1, ports: 0.0.0.0:49187->8001/tcp
|
||||
```
|
||||
See stack logs:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-deployment logs
|
||||
time="2023-07-25T09:46:29-06:00" level=warning msg="The \"CERC_SCRIPT_DEBUG\" variable is not set. Defaulting to a blank string."
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-lighthouse-1-1 | Jul 25 15:45:13.362 INFO Logging to file path: "/var/lighthouse-data-dir/beacon/logs/beacon.log"
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-lighthouse-1-1 | Jul 25 15:45:13.365 INFO Lighthouse started version: Lighthouse/v4.1.0-693886b
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-lighthouse-1-1 | Jul 25 15:45:13.365 INFO Configured for network name: mainnet
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-lighthouse-1-1 | Jul 25 15:45:13.366 INFO Data directory initialised datadir: /var/lighthouse-data-dir
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-lighthouse-1-1 | Jul 25 15:45:13.366 INFO Deposit contract address: 0x00000000219ab540356cbb839cbe05303d7705fa, deploy_block: 11184524
|
||||
laconic-ef641b4d13eb61ed561b19be67063241-mainnet-eth-lighthouse-1-1 | Jul 25 15:45:13.424 INFO Starting checkpoint sync remote_url: https://beaconstate.ethstaker.cc/, service: beacon
|
||||
```
|
||||
## Monitoring stack sync progress
|
||||
Both go-ethereum and lighthouse will engage in an initial chain sync phase that will last up to several hours depending on hardware performance and network capacity.
|
||||
Syncing can be monitored by looking for these log messages:
|
||||
```
|
||||
Jul 24 12:34:17.001 INFO Downloading historical blocks est_time: 5 days 11 hrs, speed: 14.67 slots/sec, distance: 6932481 slots (137 weeks 3 days), service: slot_notifier
|
||||
INFO [07-24|12:14:52.493] Syncing beacon headers downloaded=145,920 left=17,617,968 eta=1h23m32.815s
|
||||
INFO [07-24|12:33:15.238] Syncing: chain download in progress synced=1.86% chain=148.94MiB headers=368,640@95.03MiB bodies=330,081@40.56MiB receipts=330,081@13.35MiB eta=37m54.505s
|
||||
INFO [07-24|12:35:13.028] Syncing: state download in progress synced=1.32% state=4.64GiB accounts=2,850,314@677.57MiB slots=18,663,070@3.87GiB codes=26662@111.14MiB eta=3h18m0.699s
|
||||
```
|
||||
Once synced up these log messages will be observed:
|
||||
```
|
||||
INFO Synced slot: 6952515, block: 0x5bcb…f6d9, epoch: 217266, finalized_epoch: 217264, finalized_root: 0x6342…2c5c, exec_hash: 0x8d8c…2443 (verified), peers: 31, service: slot_notifier
|
||||
INFO [07-25|03:04:48.941] Imported new potential chain segment number=17,767,316 hash=84f6e7..bc2cb0 blocks=1 txs=137 mgas=16.123 elapsed=57.087ms mgasps=282.434 dirty=461.46MiB
|
||||
INFO [07-25|03:04:49.042] Chain head was updated number=17,767,316 hash=84f6e7..bc2cb0 root=ca58b2..8258c1 elapsed=2.480111ms
|
||||
```
|
||||
## Clean up
|
||||
|
||||
Stop the stack:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-deployment stop
|
||||
```
|
||||
This leaves data volumes in place, allowing the stack to be subsequently re-started.
|
||||
To permanently *delete* the stack's data volumes run:
|
||||
```
|
||||
$ laconic-so deployment --dir mainnet-eth-deployment stop --delete-data-volumes
|
||||
```
|
||||
After deleting the volumes, any subsequent re-start will begin chain sync from cold.
|
||||
|
||||
## Ports
|
||||
It is usually necessary to expose certain container ports on one or more the host's addresses to allow incoming connections.
|
||||
Any ports defined in the Docker compose file are exposed by default with random port assignments, bound to "any" interface (IP address 0.0.0.0), but the port mappings can be
|
||||
customized by editing the "spec" file generated by `laconic-so deploy init`.
|
||||
|
||||
In this example, ports `8545` and `5052` have been assigned to a specific addresses/port combination on the host, while
|
||||
port `40000` has been left with random assignment:
|
||||
```
|
||||
$ cat mainnet-eth-spec.yml
|
||||
stack: mainnet-eth
|
||||
ports:
|
||||
mainnet-eth-geth-1:
|
||||
- '10.10.10.10:8545:8545'
|
||||
- '40000'
|
||||
mainnet-eth-lighthouse-1:
|
||||
- '10.10.10.10:5052:5052'
|
||||
volumes:
|
||||
mainnet_eth_config_data: ./data/mainnet_eth_config_data
|
||||
mainnet_eth_geth_1_data: ./data/mainnet_eth_geth_1_data
|
||||
mainnet_eth_lighthouse_1_data: ./data/mainnet_eth_lighthouse_1_data
|
||||
```
|
||||
In addition, a stack-wide port mapping "recipe" can be applied at the time the
|
||||
`laconic-so deploy init` command is run, by supplying the desired recipe with the `--map-ports-to-host` option. The following recipes are supported:
|
||||
| Recipe | Host Port Mapping |
|
||||
|--------|-------------------|
|
||||
| any-variable-random | Bind to 0.0.0.0 using a random port assigned at start time (default) |
|
||||
| localhost-same | Bind to 127.0.0.1 using the same port number as exposed by the containers |
|
||||
| any-same | Bind to 0.0.0.0 using the same port number as exposed by the containers |
|
||||
| localhost-fixed-random | Bind to 127.0.0.1 using a random port number selected at the time the command is run (not checked for already in use)|
|
||||
| any-fixed-random | Bind to 0.0.0.0 using a random port number selected at the time the command is run (not checked for already in use) |
|
||||
## Data volumes
|
||||
Container data volumes are bind-mounted to specified paths in the host filesystem.
|
||||
The default setup (generated by `laconic-so deploy init`) places the volumes in the `./data` subdirectory of the deployment directory:
|
||||
```
|
||||
$ cat mainnet-eth-spec.yml
|
||||
stack: mainnet-eth
|
||||
ports:
|
||||
mainnet-eth-geth-1:
|
||||
- '10.10.10.10:8545:8545'
|
||||
- '40000'
|
||||
mainnet-eth-lighthouse-1:
|
||||
- '10.10.10.10:5052:5052'
|
||||
volumes:
|
||||
mainnet_eth_config_data: ./data/mainnet_eth_config_data
|
||||
mainnet_eth_geth_1_data: ./data/mainnet_eth_geth_1_data
|
||||
mainnet_eth_lighthouse_1_data: ./data/mainnet_eth_lighthouse_1_data
|
||||
```
|
||||
A synced-up stack will consume around 900GB of data volume space:
|
||||
```
|
||||
$ sudo du -h mainnet-eth-deployment/data/
|
||||
150M mainnet-eth-deployment/data/mainnet_eth_lighthouse_1_data/beacon/freezer_db
|
||||
25G mainnet-eth-deployment/data/mainnet_eth_lighthouse_1_data/beacon/chain_db
|
||||
16K mainnet-eth-deployment/data/mainnet_eth_lighthouse_1_data/beacon/network
|
||||
368M mainnet-eth-deployment/data/mainnet_eth_lighthouse_1_data/beacon/logs
|
||||
26G mainnet-eth-deployment/data/mainnet_eth_lighthouse_1_data/beacon
|
||||
26G mainnet-eth-deployment/data/mainnet_eth_lighthouse_1_data
|
||||
8.0K mainnet-eth-deployment/data/mainnet_eth_config_data
|
||||
4.0K mainnet-eth-deployment/data/mainnet_eth_geth_1_data/keystore
|
||||
527G mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth/chaindata/ancient/chain
|
||||
527G mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth/chaindata/ancient
|
||||
859G mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth/chaindata
|
||||
4.8M mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth/nodes
|
||||
242M mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth/ethash
|
||||
669M mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth/triecache
|
||||
860G mainnet-eth-deployment/data/mainnet_eth_geth_1_data/geth
|
||||
860G mainnet-eth-deployment/data/mainnet_eth_geth_1_data
|
||||
885G mainnet-eth-deployment/data/
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
# Copyright © 2023 Vulcanize
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||
|
||||
from secrets import token_hex
|
||||
|
||||
|
||||
def init(ctx):
|
||||
return None
|
||||
|
||||
|
||||
def setup(ctx):
|
||||
return None
|
||||
|
||||
|
||||
def create(ctx, extra_args):
|
||||
# Generate the JWT secret and save to its config file
|
||||
secret = token_hex(32)
|
||||
jwt_file_path = ctx.deployment_dir.joinpath("data", "mainnet_eth_config_data", "jwtsecret")
|
||||
with open(jwt_file_path, 'w+') as jwt_file:
|
||||
jwt_file.write(secret)
|
||||
@@ -0,0 +1,23 @@
|
||||
version: "1.2"
|
||||
name: mainnet-eth
|
||||
description: "Ethereum Mainnet"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- git.vdb.to/cerc-io/keycloak-reg-api
|
||||
- git.vdb.to/cerc-io/keycloak-reg-ui
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/foundry
|
||||
- cerc/keycloak
|
||||
- cerc/webapp-base
|
||||
- cerc/keycloak-reg-api
|
||||
- cerc/keycloak-reg-ui
|
||||
pods:
|
||||
- mainnet-eth
|
||||
- mainnet-eth-keycloak
|
||||
- mainnet-eth-metrics
|
||||
- foundry
|
||||
@@ -0,0 +1,88 @@
|
||||
# Opera (Fantom)
|
||||
|
||||
Deploy a Fantom API node.
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera setup-repositories
|
||||
```
|
||||
|
||||
## Build the fixturenet-eth containers
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera build-containers
|
||||
```
|
||||
|
||||
## Deploy the stack
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera deploy up
|
||||
```
|
||||
|
||||
## Check logs
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera deploy logs
|
||||
```
|
||||
|
||||
You'll see something like:
|
||||
|
||||
```
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | Connecting to download.fantom.network (65.108.45.88:443)
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | saving to 'mainnet-109331-no-history.g'
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | mainnet-109331-no-hi 100% |********************************| 16326 0:00:00 ETA
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | 'mainnet-109331-no-history.g' saved
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.034] Maximum peer count total=50
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.034] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.034] Genesis file is a known preset name="Mainnet-109331 without history"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.052] Applying genesis state
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.052] - Reading epochs unit 0
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.054] - Reading blocks unit 0
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.530] Applied genesis state name=main id=250 genesis=0x4a53c5445584b3bfc20dbfb2ec18ae20037c716f3ba2d9e1da768a9deca17cb4
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.531] Regenerated local transaction journal transactions=0 accounts=0
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.532] Starting peer-to-peer node instance=go-opera/v1.1.2-rc.5-50cd051d-1677276206/linux-amd64/go1.19.10
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.536] New local node record seq=1 id=5e40f984908317cd ip=127.0.0.1 udp=5050 tcp=5050
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.537] Started P2P networking self=enode://3ffb15988ca5a79b63dbe48be89d9d8b48dc4845d318fe08231a0ab49d3b23476e2561044311dc257405f882f7c52ff7b128c8bd1b6d85cf7205a6fed6555443@127.0.0.1:5050
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.537] IPC endpoint opened url=/root/.opera/opera.ipc
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] HTTP server started endpoint=[::]:18545 prefix= cors=* vhosts=localhost
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] WebSocket enabled url=ws://[::]:18546
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] Rebuilding state snapshot
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] EVM snapshot module=gossip-store at=000000..000000 generating=true
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] Resuming state snapshot generation accounts=0 slots=0 storage=0.00B elapsed="189.74µs"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] Generated state snapshot accounts=0 slots=0 storage=0.00B elapsed="265.061µs"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:34.788] New LLR summary last_epoch=0 last_block=37676611 new_evs=0 new_ers=0 new_bvs=64 new_brs=0 age=none
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:35.040] New local node record seq=2 id=5e40f984908317cd ip=186.233.184.56 udp=5050 tcp=5050
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:42.788] New LLR summary last_epoch=114604 last_block=37753891 new_evs=24581 new_ers=5272 new_bvs=233257 new_brs=780 age=1y1mo5d
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:50.827] New LLR summary last_epoch=115574 last_block=38118749 new_evs=4907 new_ers=971 new_bvs=1098760 new_brs=3768 age=1y1mo2d
|
||||
```
|
||||
|
||||
Consecutive lines of "New LLR summary" shows that your node is sync'ing.
|
||||
|
||||
## Use the opera admin console
|
||||
|
||||
```
|
||||
$ docker exec -it $(docker ps -q --filter "name=go-opera") /bin/sh
|
||||
```
|
||||
|
||||
then:
|
||||
|
||||
```
|
||||
$ ./opera attach
|
||||
```
|
||||
|
||||
and check the node info:
|
||||
|
||||
```
|
||||
> admin.nodeInfo
|
||||
```
|
||||
|
||||
Run `exit` twice to return to your terminal.
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack mainnet-go-opera deploy down
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
version: "1.1"
|
||||
name: mainnet-opera
|
||||
description: "Fantom mainnet node"
|
||||
repos:
|
||||
- github.com/Fantom-foundation/go-opera@release/1.1.2-rc.5
|
||||
containers:
|
||||
- cerc/go-opera
|
||||
pods:
|
||||
- mainnet-go-opera
|
||||
@@ -0,0 +1,2 @@
|
||||
# Laconic Mainnet Deployment (experimental)
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
# Copyright © 2022, 2023 Vulcanize
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||
|
||||
from stack_orchestrator.util import get_yaml
|
||||
from stack_orchestrator.deploy.deploy_types import DeployCommandContext, LaconicStackSetupCommand, DeploymentContext
|
||||
from stack_orchestrator.deploy.stack_state import State
|
||||
from stack_orchestrator.deploy.deploy_util import VolumeMapping, run_container_command
|
||||
from stack_orchestrator.command_types import CommandOptions
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from shutil import copyfile, copytree
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import tomli
|
||||
import re
|
||||
|
||||
default_spec_file_content = ""
|
||||
|
||||
|
||||
class SetupPhase(Enum):
|
||||
INITIALIZE = 1
|
||||
JOIN = 2
|
||||
CREATE = 3
|
||||
ILLEGAL = 3
|
||||
|
||||
|
||||
def _client_toml_path(network_dir: Path):
|
||||
return network_dir.joinpath("config", "client.toml")
|
||||
|
||||
|
||||
def _config_toml_path(network_dir: Path):
|
||||
return network_dir.joinpath("config", "config.toml")
|
||||
|
||||
|
||||
def _get_chain_id_from_config(network_dir: Path):
|
||||
chain_id = None
|
||||
with open(_client_toml_path(network_dir), "rb") as f:
|
||||
toml_dict = tomli.load(f)
|
||||
chain_id = toml_dict["chain-id"]
|
||||
return chain_id
|
||||
|
||||
|
||||
def _get_node_moniker_from_config(network_dir: Path):
|
||||
moniker = None
|
||||
with open(_client_toml_path(network_dir), "rb") as f:
|
||||
toml_dict = tomli.load(f)
|
||||
moniker = toml_dict["moniker"]
|
||||
return moniker
|
||||
|
||||
|
||||
def _get_node_key_from_gentx(options: CommandOptions, gentx_file_name: str):
|
||||
gentx_file_path = Path(gentx_file_name)
|
||||
if gentx_file_path.exists():
|
||||
with open(Path(gentx_file_name), "rb") as f:
|
||||
parsed_json = json.load(f)
|
||||
return parsed_json['body']['messages'][0]['delegator_address']
|
||||
else:
|
||||
print(f"Error: gentx file: {gentx_file_name} does not exist")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def _comma_delimited_to_list(list_str: str):
|
||||
return list_str.split(",") if list_str else []
|
||||
|
||||
|
||||
def _get_node_keys_from_gentx_files(options: CommandOptions, gentx_file_list: str):
|
||||
node_keys = []
|
||||
gentx_files = _comma_delimited_to_list(gentx_file_list)
|
||||
for gentx_file in gentx_files:
|
||||
node_key = _get_node_key_from_gentx(options, gentx_file)
|
||||
if node_key:
|
||||
node_keys.append(node_key)
|
||||
return node_keys
|
||||
|
||||
|
||||
def _copy_gentx_files(options: CommandOptions, network_dir: Path, gentx_file_list: str):
|
||||
gentx_files = _comma_delimited_to_list(gentx_file_list)
|
||||
for gentx_file in gentx_files:
|
||||
gentx_file_path = Path(gentx_file)
|
||||
copyfile(gentx_file_path, os.path.join(network_dir, "config", "gentx", os.path.basename(gentx_file_path)))
|
||||
|
||||
|
||||
def _remove_persistent_peers(options: CommandOptions, network_dir: Path):
|
||||
config_file_path = _config_toml_path(network_dir)
|
||||
if not config_file_path.exists():
|
||||
print("Error: config.toml not found")
|
||||
sys.exit(1)
|
||||
with open(config_file_path, "r") as input_file:
|
||||
config_file_content = input_file.read()
|
||||
persistent_peers_pattern = '^persistent_peers = "(.+?)"'
|
||||
replace_with = "persistent_peers = \"\""
|
||||
config_file_content = re.sub(persistent_peers_pattern, replace_with, config_file_content, flags=re.MULTILINE)
|
||||
with open(config_file_path, "w") as output_file:
|
||||
output_file.write(config_file_content)
|
||||
|
||||
|
||||
def _insert_persistent_peers(options: CommandOptions, config_dir: Path, new_persistent_peers: str):
|
||||
config_file_path = config_dir.joinpath("config.toml")
|
||||
if not config_file_path.exists():
|
||||
print("Error: config.toml not found")
|
||||
sys.exit(1)
|
||||
with open(config_file_path, "r") as input_file:
|
||||
config_file_content = input_file.read()
|
||||
persistent_peers_pattern = '^persistent_peers = ""'
|
||||
replace_with = f"persistent_peers = \"{new_persistent_peers}\""
|
||||
config_file_content = re.sub(persistent_peers_pattern, replace_with, config_file_content, flags=re.MULTILINE)
|
||||
with open(config_file_path, "w") as output_file:
|
||||
output_file.write(config_file_content)
|
||||
|
||||
|
||||
def _phase_from_params(parameters):
|
||||
phase = SetupPhase.ILLEGAL
|
||||
if parameters.initialize_network:
|
||||
if parameters.join_network or parameters.create_network:
|
||||
print("Can't supply --join-network or --create-network with --initialize-network")
|
||||
sys.exit(1)
|
||||
if not parameters.chain_id:
|
||||
print("--chain-id is required")
|
||||
sys.exit(1)
|
||||
# node_moniker must be supplied
|
||||
if not parameters.node_moniker:
|
||||
print("Error: --node-moniker is required")
|
||||
sys.exit(1)
|
||||
phase = SetupPhase.INITIALIZE
|
||||
elif parameters.join_network:
|
||||
if parameters.initialize_network or parameters.create_network:
|
||||
print("Can't supply --initialize-network or --create-network with --join-network")
|
||||
sys.exit(1)
|
||||
phase = SetupPhase.JOIN
|
||||
elif parameters.create_network:
|
||||
if parameters.initialize_network or parameters.join_network:
|
||||
print("Can't supply --initialize-network or --join-network with --create-network")
|
||||
sys.exit(1)
|
||||
phase = SetupPhase.CREATE
|
||||
return phase
|
||||
|
||||
|
||||
def setup(command_context: DeployCommandContext, parameters: LaconicStackSetupCommand, extra_args):
|
||||
|
||||
options = command_context.cluster_context.options
|
||||
|
||||
currency = "stake" # Does this need to be a parameter?
|
||||
|
||||
if options.debug:
|
||||
print(f"parameters: {parameters}")
|
||||
|
||||
phase = _phase_from_params(parameters)
|
||||
|
||||
network_dir = Path(parameters.network_dir).absolute()
|
||||
laconicd_home_path_in_container = "/laconicd-home"
|
||||
mounts = [
|
||||
VolumeMapping(network_dir, laconicd_home_path_in_container)
|
||||
]
|
||||
|
||||
if phase == SetupPhase.INITIALIZE:
|
||||
|
||||
# We want to create the directory so if it exists that's an error
|
||||
if os.path.exists(network_dir):
|
||||
print(f"Error: network directory {network_dir} already exists")
|
||||
sys.exit(1)
|
||||
|
||||
os.mkdir(network_dir)
|
||||
|
||||
output, status = run_container_command(
|
||||
command_context,
|
||||
"laconicd", f"laconicd init {parameters.node_moniker} --home {laconicd_home_path_in_container}\
|
||||
--chain-id {parameters.chain_id}", mounts)
|
||||
if options.debug:
|
||||
print(f"Command output: {output}")
|
||||
|
||||
elif phase == SetupPhase.JOIN:
|
||||
if not os.path.exists(network_dir):
|
||||
print(f"Error: network directory {network_dir} doesn't exist")
|
||||
sys.exit(1)
|
||||
# Get the chain_id from the config file created in the INITIALIZE phase
|
||||
chain_id = _get_chain_id_from_config(network_dir)
|
||||
|
||||
output1, status1 = run_container_command(
|
||||
command_context, "laconicd", f"laconicd keys add {parameters.key_name} --home {laconicd_home_path_in_container}\
|
||||
--keyring-backend test", mounts)
|
||||
if options.debug:
|
||||
print(f"Command output: {output1}")
|
||||
output2, status2 = run_container_command(
|
||||
command_context,
|
||||
"laconicd",
|
||||
f"laconicd add-genesis-account {parameters.key_name} 12900000000000000000000{currency}\
|
||||
--home {laconicd_home_path_in_container} --keyring-backend test",
|
||||
mounts)
|
||||
if options.debug:
|
||||
print(f"Command output: {output2}")
|
||||
output3, status3 = run_container_command(
|
||||
command_context,
|
||||
"laconicd",
|
||||
f"laconicd gentx {parameters.key_name} 90000000000{currency} --home {laconicd_home_path_in_container}\
|
||||
--chain-id {chain_id} --keyring-backend test",
|
||||
mounts)
|
||||
if options.debug:
|
||||
print(f"Command output: {output3}")
|
||||
output4, status4 = run_container_command(
|
||||
command_context,
|
||||
"laconicd",
|
||||
f"laconicd keys show {parameters.key_name} -a --home {laconicd_home_path_in_container} --keyring-backend test",
|
||||
mounts)
|
||||
print(f"Node validator address: {output4}")
|
||||
|
||||
elif phase == SetupPhase.CREATE:
|
||||
if not os.path.exists(network_dir):
|
||||
print(f"Error: network directory {network_dir} doesn't exist")
|
||||
sys.exit(1)
|
||||
|
||||
# In the CREATE phase, we are either a "coordinator" node, generating the genesis.json file ourselves
|
||||
# OR we are a "not-coordinator" node, consuming a genesis file we got from the coordinator node.
|
||||
if parameters.genesis_file:
|
||||
# We got the genesis file from elsewhere
|
||||
# Copy it into our network dir
|
||||
genesis_file_path = Path(parameters.genesis_file)
|
||||
if not os.path.exists(genesis_file_path):
|
||||
print(f"Error: supplied genesis file: {parameters.genesis_file} does not exist.")
|
||||
sys.exit(1)
|
||||
copyfile(genesis_file_path, os.path.join(network_dir, "config", os.path.basename(genesis_file_path)))
|
||||
else:
|
||||
# We're generating the genesis file
|
||||
if not parameters.gentx_file_list:
|
||||
print("Error: --gentx-files must be supplied")
|
||||
sys.exit(1)
|
||||
# First look in the supplied gentx files for the other nodes' keys
|
||||
other_node_keys = _get_node_keys_from_gentx_files(options, parameters.gentx_file_list)
|
||||
# Add those keys to our genesis, with balances we determine here (why?)
|
||||
for other_node_key in other_node_keys:
|
||||
outputk, statusk = run_container_command(
|
||||
command_context, "laconicd", f"laconicd add-genesis-account {other_node_key} 12900000000000000000000{currency}\
|
||||
--home {laconicd_home_path_in_container} --keyring-backend test", mounts)
|
||||
if options.debug:
|
||||
print(f"Command output: {outputk}")
|
||||
# Copy the gentx json files into our network dir
|
||||
_copy_gentx_files(options, network_dir, parameters.gentx_file_list)
|
||||
# Now we can run collect-gentxs
|
||||
output1, status1 = run_container_command(
|
||||
command_context, "laconicd", f"laconicd collect-gentxs --home {laconicd_home_path_in_container}", mounts)
|
||||
if options.debug:
|
||||
print(f"Command output: {output1}")
|
||||
print(f"Generated genesis file, please copy to other nodes as required: \
|
||||
{os.path.join(network_dir, 'config', 'genesis.json')}")
|
||||
# Last thing, collect-gentxs puts a likely bogus set of persistent_peers in config.toml so we remove that now
|
||||
_remove_persistent_peers(options, network_dir)
|
||||
# In both cases we validate the genesis file now
|
||||
output2, status1 = run_container_command(
|
||||
command_context, "laconicd", f"laconicd validate-genesis --home {laconicd_home_path_in_container}", mounts)
|
||||
print(f"validate-genesis result: {output2}")
|
||||
|
||||
else:
|
||||
print("Illegal parameters supplied")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def create(context: DeploymentContext, extra_args):
|
||||
network_dir = extra_args[0]
|
||||
if network_dir is None:
|
||||
print("Error: --network-dir must be supplied")
|
||||
sys.exit(1)
|
||||
network_dir_path = Path(network_dir)
|
||||
if not (network_dir_path.exists() and network_dir_path.is_dir()):
|
||||
print(f"Error: supplied network directory does not exist: {network_dir}")
|
||||
sys.exit(1)
|
||||
config_dir_path = network_dir_path.joinpath("config")
|
||||
if not (config_dir_path.exists() and config_dir_path.is_dir()):
|
||||
print(f"Error: supplied network directory does not contain a config directory: {config_dir_path}")
|
||||
sys.exit(1)
|
||||
data_dir_path = network_dir_path.joinpath("data")
|
||||
if not (data_dir_path.exists() and data_dir_path.is_dir()):
|
||||
print(f"Error: supplied network directory does not contain a data directory: {data_dir_path}")
|
||||
sys.exit(1)
|
||||
# Copy the network directory contents into our deployment
|
||||
# TODO: change this to work with non local paths
|
||||
deployment_config_dir = context.deployment_dir.joinpath("data", "laconicd-config")
|
||||
copytree(config_dir_path, deployment_config_dir, dirs_exist_ok=True)
|
||||
# If supplied, add the initial persistent peers to the config file
|
||||
if extra_args[1]:
|
||||
initial_persistent_peers = extra_args[1]
|
||||
_insert_persistent_peers(context.command_context.cluster_context.options, deployment_config_dir, initial_persistent_peers)
|
||||
# Copy the data directory contents into our deployment
|
||||
# TODO: change this to work with non local paths
|
||||
deployment_data_dir = context.deployment_dir.joinpath("data", "laconicd-data")
|
||||
copytree(data_dir_path, deployment_data_dir, dirs_exist_ok=True)
|
||||
|
||||
|
||||
def init(command_context: DeployCommandContext):
|
||||
yaml = get_yaml()
|
||||
return yaml.load(default_spec_file_content)
|
||||
|
||||
|
||||
def get_state(command_context: DeployCommandContext):
|
||||
print("Here we get state")
|
||||
return State.CONFIGURED
|
||||
|
||||
|
||||
def change_state(command_context: DeployCommandContext):
|
||||
pass
|
||||
@@ -0,0 +1,29 @@
|
||||
version: "1.0"
|
||||
name: mainnet-laconic
|
||||
description: "Mainnet laconic node"
|
||||
repos:
|
||||
- cerc-io/laconicd
|
||||
- lirewine/debug
|
||||
- lirewine/crypto
|
||||
- lirewine/gem
|
||||
- lirewine/sdk
|
||||
- cerc-io/laconic-sdk
|
||||
- cerc-io/laconic-registry-cli
|
||||
- cerc-io/laconic-console
|
||||
npms:
|
||||
- laconic-sdk
|
||||
- laconic-registry-cli
|
||||
- debug
|
||||
- crypto
|
||||
- sdk
|
||||
- gem
|
||||
- laconic-console
|
||||
containers:
|
||||
- cerc/laconicd
|
||||
- cerc/laconic-registry-cli
|
||||
- cerc/webapp-base
|
||||
- cerc/laconic-console-host
|
||||
pods:
|
||||
- mainnet-laconicd
|
||||
- fixturenet-laconic-console
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
# Dump environment variables for debugging
|
||||
echo "Environment variables:"
|
||||
env
|
||||
# Test laconic stack
|
||||
echo "Running laconic stack test"
|
||||
# Bit of a hack, test the most recent package
|
||||
TEST_TARGET_SO=$( ls -t1 ./package/laconic-so* | head -1 )
|
||||
# Set a non-default repo dir
|
||||
export CERC_REPO_BASE_DIR=~/stack-orchestrator-test/repo-base-dir
|
||||
echo "Testing this package: $TEST_TARGET_SO"
|
||||
echo "Test version command"
|
||||
reported_version_string=$( $TEST_TARGET_SO version )
|
||||
echo "Version reported is: ${reported_version_string}"
|
||||
echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
|
||||
rm -rf $CERC_REPO_BASE_DIR
|
||||
mkdir -p $CERC_REPO_BASE_DIR
|
||||
# Test bringing the test container up and down
|
||||
# with and without volume removal
|
||||
$TEST_TARGET_SO --stack test setup-repositories
|
||||
$TEST_TARGET_SO --stack test build-containers
|
||||
$TEST_TARGET_SO --stack test deploy up
|
||||
$TEST_TARGET_SO --stack test deploy down
|
||||
# The next time we bring the container up the volume will be old (from the previous run above)
|
||||
$TEST_TARGET_SO --stack test deploy up
|
||||
log_output_1=$( $TEST_TARGET_SO --stack test deploy logs )
|
||||
if [[ "$log_output_1" == *"Filesystem is old"* ]]; then
|
||||
echo "Retain volumes test: passed"
|
||||
else
|
||||
echo "Retain volumes test: FAILED"
|
||||
exit 1
|
||||
fi
|
||||
$TEST_TARGET_SO --stack test deploy down --delete-volumes
|
||||
# Now when we bring the container up the volume will be new again
|
||||
$TEST_TARGET_SO --stack test deploy up
|
||||
log_output_2=$( $TEST_TARGET_SO --stack test deploy logs )
|
||||
if [[ "$log_output_2" == *"Filesystem is fresh"* ]]; then
|
||||
echo "Delete volumes test: passed"
|
||||
else
|
||||
echo "Delete volumes test: FAILED"
|
||||
exit 1
|
||||
fi
|
||||
$TEST_TARGET_SO --stack test deploy down --delete-volumes
|
||||
echo "Test passed"
|
||||
@@ -0,0 +1,110 @@
|
||||
# MobyMask v2 watcher
|
||||
|
||||
Instructions to setup and deploy an end-to-end MobyMask v2 stack ([L1](../fixturenet-eth/) + [L2](../fixturenet-optimism/) chains + watcher + web-app(s)) using [laconic-stack-orchestrator](/README.md#install)
|
||||
|
||||
We support running just the watcher part of stack, given an external L2 Optimism endpoint.
|
||||
Follow [mobymask-only](./mobymask-only.md) for the same.
|
||||
|
||||
We also support running just the web-app(s), given external watcher GQL (for mobymask-app) and relay node endpoints. Follow [web-apps.md](./web-apps.md) for the same.
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 setup-repositories
|
||||
```
|
||||
|
||||
NOTE: If repositories already exist and are checked out to different versions, `setup-repositories` command will throw an error.
|
||||
For getting around this, the repositories mentioned below can be removed and then run the command.
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 build-containers
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
* Deploy the containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 up
|
||||
```
|
||||
|
||||
NOTE: The `fixturenet-optimism-contracts` service takes a while to run to completion and it may restart a few times after running into errors.
|
||||
|
||||
* To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 ps
|
||||
|
||||
# With status
|
||||
docker ps -a
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Find the watcher container's id and export it for later use:
|
||||
|
||||
```bash
|
||||
export CONTAINER_ID=$(docker ps -q --filter "name=peer-tests")
|
||||
```
|
||||
|
||||
Run the peer tests:
|
||||
|
||||
```bash
|
||||
docker exec $CONTAINER_ID yarn test
|
||||
```
|
||||
|
||||
## Web Apps
|
||||
|
||||
Check that the web-app containers are healthy:
|
||||
|
||||
```bash
|
||||
docker ps | grep -E 'mobymask-app|peer-test-app'
|
||||
```
|
||||
|
||||
### mobymask-app
|
||||
|
||||
* The mobymask-app should be running at http://localhost:3002
|
||||
* The lxdao-mobymask-app should be running at http://localhost:3004
|
||||
|
||||
### peer-test-app
|
||||
|
||||
* The peer-test-app should be running at http://localhost:3003
|
||||
|
||||
## Details
|
||||
|
||||
* The relay node for p2p network is running at http://localhost:9090
|
||||
|
||||
* The [peer package](https://github.com/cerc-io/watcher-ts/tree/main/packages/peer) (published in [gitea](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Fpeer)) can be used in client code for connecting to the network
|
||||
|
||||
* The [react-peer package](https://github.com/cerc-io/react-peer/tree/main/packages/react-peer) (published in [gitea](https://git.vdb.to/cerc-io/-/packages/npm/@cerc-io%2Freact-peer)) which uses the peer package can be used in react app for connecting to the network
|
||||
|
||||
## Demo
|
||||
|
||||
Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 down 30
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=mobymask_v2"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
|
||||
```
|
||||
@@ -0,0 +1,123 @@
|
||||
# Demo
|
||||
|
||||
* Get the root invite link URL for mobymask-app:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
```
|
||||
|
||||
The invite link is seen at the end of the logs. Example log:
|
||||
|
||||
```bash
|
||||
http://127.0.0.1:3004/#/members?invitation=%7B%22v%22%3A1%2C%22signedDelegations%22%3A%5B%7B%22signature%22%3A%220x7559bd412f02677d60820e38243acf61547f79339395a34f7d4e1630e645aeb30535fc219f79b6fbd3af0ce3bd05132ad46d2b274a9fbc4c36bc71edd09850891b%22%2C%22delegation%22%3A%7B%22delegate%22%3A%220xc0838c92B2b71756E0eAD5B3C1e1F186baeEAAac%22%2C%22authority%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%2C%22caveats%22%3A%5B%7B%22enforcer%22%3A%220x558024C7d593B840E1BfD83E9B287a5CDad4db15%22%2C%22terms%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%7D%5D%7D%7D%5D%2C%22key%22%3A%220x98da9805821f1802196443e578fd32af567bababa0a249c07c82df01ecaa7d8d%22%7D
|
||||
```
|
||||
|
||||
* Open the invite link in a browser to use the mobymask-app.
|
||||
|
||||
NOTE: Before opening the invite link, clear the browser cache (local storage) for http://127.0.0.1:3004 to remove old invitations
|
||||
|
||||
* In the debug panel, check if it is connected to the p2p network (it should be connected to at least one other peer for pubsub to work).
|
||||
|
||||
* Create an invite link in the app by clicking on `Create new invite link` button in the `My invitees` section.
|
||||
|
||||
* Switch to the `MESSAGES` tab in debug panel for viewing incoming messages later.
|
||||
|
||||
* Open the invite link in a new browser with different profile (to simulate remote browser)
|
||||
* Check that it is connected to a peer in the network.
|
||||
|
||||
* In the `Pending reports` section, enter multiple phisher records and click on the `Submit batch to p2p network` button. This broadcasts signed invocations to the connected peers.
|
||||
|
||||
* In the `MESSAGES` tab of other browsers, a message can be seen with the signed invocations.
|
||||
|
||||
* In a terminal, check logs from the watcher peer container:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||
```
|
||||
|
||||
* It should have received the message, sent transaction to L2 chain and received a transaction receipt for an `invoke` message with block details.
|
||||
|
||||
Example log:
|
||||
|
||||
```bash
|
||||
2023-03-23T10:25:19.771Z vulcanize:peer-listener [10:25:19] Received a message on mobymask P2P network from peer: 12D3KooWAVNswtcrX12iDYukEoxdQwD34kJyRWcQTfZ4unGg2xjd
|
||||
2023-03-23T10:25:24.143Z laconic:libp2p-utils Transaction receipt for invoke message {
|
||||
to: '0x558024C7d593B840E1BfD83E9B287a5CDad4db15',
|
||||
blockNumber: 1996,
|
||||
blockHash: '0xebef19c21269654804b2ef2d4bb5cb6c88743b37ed77e82222dc5671debf3afb',
|
||||
transactionHash: '0xf8c5a093a93f793012196073a7d0cb3ed6fbd2846126c066cb31c72100960cb1',
|
||||
effectiveGasPrice: '1500000007',
|
||||
gasUsed: '250000'
|
||||
}
|
||||
```
|
||||
|
||||
* Check the phisher in watcher GQL: http://localhost:3001/graphql
|
||||
* Use the blockHash from transaction receipt details or query for latest block:
|
||||
|
||||
```gql
|
||||
query {
|
||||
latestBlock {
|
||||
hash
|
||||
number
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* Get the deployed contract address:
|
||||
|
||||
```bash
|
||||
docker exec -it $(docker ps -aq --filter name="lxdao-mobymask-app") cat /config/config.yml
|
||||
```
|
||||
|
||||
The value of `address` field is the deployed contract address
|
||||
|
||||
* Check for phisher value
|
||||
|
||||
```gql
|
||||
query {
|
||||
isPhisher(
|
||||
blockHash: "TX_OR_LATEST_BLOCK_HASH",
|
||||
contractAddress: "CONTRACT_ADDRESS",
|
||||
# If reported phisher name was "test" then key0 value is "TWT:test"
|
||||
key0: "TWT:PHISHER_NAME"
|
||||
) {
|
||||
value
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
It should return `true` for reported phisher names.
|
||||
|
||||
* Watcher internally is using L2 chain `eth_getStorageAt` method.
|
||||
|
||||
* Check the phisher name in mobymask app in `Check Phisher Status` section.
|
||||
* Watcher GQL API is used for checking phisher.
|
||||
|
||||
* Manage invitations in the `Outstanding invitations (p2p network)` tab in `My Invitations` section.
|
||||
* Revoke the created invitation by clicking on the `Revoke` button.
|
||||
|
||||
* Revocation messages can be seen in the debug panel `MESSAGES` tab of other browsers.
|
||||
|
||||
* Also, check the watcher peer logs. It should receive a message and log the transaction receipt for a `revoke` message.
|
||||
|
||||
* Try reporting a phisher from the revoked invitee's browser.
|
||||
|
||||
* The invocation message for reporting phisher would be broadcasted to all peers.
|
||||
|
||||
* Check the watcher peer logs. A transaction failed error should be logged.
|
||||
|
||||
* Check the reported phisher in [watcher GQL](https://localhost:3001/graphql)
|
||||
|
||||
```gql
|
||||
query {
|
||||
isPhisher(
|
||||
blockHash: "LATEST_BLOCK_HASH",
|
||||
contractAddress: "CONTRACT_ADDRESS",
|
||||
key0: "TWT:PHISHER_NAME"
|
||||
) {
|
||||
value
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
It should return `false` as the invitation/delegation used for reporting phishers has been revoked.
|
||||
@@ -0,0 +1,129 @@
|
||||
# MobyMask v2 watcher
|
||||
|
||||
Instructions to setup and deploy MobyMask v2 watcher independently
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: L2 Optimism Geth and Node RPC endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 setup-repositories --include github.com/cerc-io/MobyMask,github.com/cerc-io/watcher-ts,github.com/cerc-io/mobymask-v2-watcher-ts
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-ts,cerc/watcher-mobymask-v2,cerc/mobymask
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v2/)):
|
||||
|
||||
```bash
|
||||
# External L2 endpoints
|
||||
CERC_L2_GETH_RPC=
|
||||
|
||||
# Endpoints waited on before contract deployment
|
||||
CERC_L2_GETH_HOST=
|
||||
CERC_L2_GETH_PORT=
|
||||
|
||||
CERC_L2_NODE_HOST=
|
||||
CERC_L2_NODE_PORT=
|
||||
|
||||
# URL (fixturenet-eth-bootnode-lighthouse) to get CSV with credentials for accounts on L1 to perform txs on L2
|
||||
CERC_L1_ACCOUNTS_CSV_URL=
|
||||
|
||||
# OR
|
||||
# Specify the required account credentials
|
||||
CERC_PRIVATE_KEY_DEPLOYER=
|
||||
CERC_PRIVATE_KEY_PEER=
|
||||
|
||||
# Base URI for mobymask-app
|
||||
# (used for generating a root invite link after deploying the contract)
|
||||
CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3004/#"
|
||||
|
||||
# (Optional) Domain to be used in the relay node's announce address
|
||||
CERC_RELAY_ANNOUNCE_DOMAIN=
|
||||
|
||||
# (Optional) Set of relay peers to connect to from the relay node
|
||||
CERC_RELAY_PEERS=[]
|
||||
|
||||
# (Optional) Set of multiaddrs to be avoided while dialling
|
||||
CERC_DENY_MULTIADDRS=[]
|
||||
|
||||
# (Optional) Type of pubsub to be used
|
||||
CERC_PUBSUB=""
|
||||
|
||||
# Set to false for disabling watcher peer to send txs to L2
|
||||
CERC_ENABLE_PEER_L2_TXS=true
|
||||
|
||||
# (Optional) Set already deployed MobyMask contract address to avoid deploying contract in the stack
|
||||
CERC_DEPLOYED_CONTRACT=
|
||||
```
|
||||
|
||||
* NOTE: If Optimism is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 --env-file <PATH_TO_ENV_FILE> up
|
||||
```
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 ps
|
||||
|
||||
# With status
|
||||
docker ps -a
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
The watcher endpoint is exposed on host port `3001` and the relay node endpoint is exposed on host port `9090`
|
||||
|
||||
Check the logs of the deployment container to get the deployed contract's address and generated root invite link:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
See [Tests](./README.md#tests)
|
||||
|
||||
## Web Apps
|
||||
|
||||
For deploying the web-app(s) separately after deploying the watcher, follow [web-apps.md](./web-apps.md)
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=mobymask_v2"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
|
||||
|
||||
# WARNING: To avoid changing peer ids for the watcher, `peers_ids` volume can be persisted
|
||||
# To delete all volumes except for `peers_ids`
|
||||
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2" | grep -v "peers_ids$")
|
||||
```
|
||||
@@ -0,0 +1,36 @@
|
||||
version: "1.0"
|
||||
name: mobymask-v2
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- github.com/ethereum-optimism/optimism@v1.0.4
|
||||
- github.com/ethereum-optimism/op-geth@v1.101105.2
|
||||
- github.com/cerc-io/watcher-ts@v0.2.56
|
||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.1.3
|
||||
- github.com/cerc-io/MobyMask@v0.1.3
|
||||
- github.com/cerc-io/mobymask-ui
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
- cerc/lighthouse-cli
|
||||
- cerc/fixturenet-eth-genesis
|
||||
- cerc/fixturenet-eth-geth
|
||||
- cerc/fixturenet-eth-lighthouse
|
||||
- cerc/foundry
|
||||
- cerc/optimism-contracts
|
||||
- cerc/optimism-l2geth
|
||||
- cerc/optimism-op-batcher
|
||||
- cerc/optimism-op-proposer
|
||||
- cerc/optimism-op-node
|
||||
- cerc/watcher-ts
|
||||
- cerc/watcher-mobymask-v2
|
||||
- cerc/react-peer
|
||||
- cerc/mobymask-ui
|
||||
- cerc/mobymask
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- fixturenet-optimism
|
||||
- watcher-mobymask-v2
|
||||
- mobymask-app
|
||||
- peer-test-app
|
||||
@@ -0,0 +1,303 @@
|
||||
# MobyMask Watcher P2P Network
|
||||
|
||||
Instructions to setup and deploy a watcher that connects to the existing watcher p2p network
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* Laconic Stack Orchestrator ([installation](/README.md#install))
|
||||
* A publicly reachable domain name with SSL setup
|
||||
|
||||
This demo has been tested on a `Ubuntu 22.04 LTS` machine with `8GB` of RAM
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 setup-repositories --include github.com/cerc-io/MobyMask,github.com/cerc-io/watcher-ts,github.com/cerc-io/mobymask-v2-watcher-ts
|
||||
|
||||
# This will clone the required repositories at ~/cerc
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned in the next step and re-run the command
|
||||
|
||||
# Expected output:
|
||||
|
||||
# Dev Root is: /home/xyz/cerc
|
||||
# Checking: /home/xyz/cerc/watcher-ts: Needs to be fetched
|
||||
# 100%|#############################################################################################################################################| 9.96k/9.96k [00:05<00:00, 1.70kB/s]
|
||||
# Checking: /home/xyz/cerc/mobymask-v2-watcher-ts: Needs to be fetched
|
||||
# 100%|################################################################################################################################################| 19.0/19.0 [00:01<00:00, 13.6B/s]
|
||||
# Checking: /home/xyz/cerc/MobyMask: Needs to be fetched
|
||||
# 100%|##############################################################################################################################################| 1.41k/1.41k [00:18<00:00, 76.4B/s]
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 build-containers --include cerc/watcher-ts,cerc/watcher-mobymask-v2,cerc/mobymask
|
||||
```
|
||||
|
||||
Check that the required images are created in the local image registry:
|
||||
|
||||
```bash
|
||||
docker image ls
|
||||
|
||||
# Expected output:
|
||||
|
||||
# REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
# cerc/watcher-mobymask-v2 local c4dba5dc8d48 24 seconds ago 1.02GB
|
||||
# cerc/watcher-ts local 9ef61478c243 9 minutes ago 1.84GB
|
||||
# cerc/mobymask local 9db3f1a69966 2 weeks ago 3.82GB
|
||||
# .
|
||||
# .
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create an env file `mobymask-watcher.env`:
|
||||
|
||||
```bash
|
||||
touch mobymask-watcher.env
|
||||
```
|
||||
|
||||
Add the following contents to `mobymask-watcher.env`:
|
||||
|
||||
```bash
|
||||
# Domain to be used in the relay node's announce address
|
||||
CERC_RELAY_ANNOUNCE_DOMAIN="mobymask.example.com"
|
||||
|
||||
|
||||
# DO NOT CHANGE THESE VALUES
|
||||
CERC_L2_GETH_RPC="https://mobymask-l2.dev.vdb.to"
|
||||
CERC_DEPLOYED_CONTRACT="0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9"
|
||||
CERC_ENABLE_PEER_L2_TXS=false
|
||||
CERC_RELAY_PEERS=["/dns4/relay1.dev.vdb.to/tcp/443/wss/p2p/12D3KooWAx83SM9GWVPc9v9fNzLzftRX6EaAFMjhYiFxRYqctcW1", "/dns4/relay2.dev.vdb.to/tcp/443/wss/p2p/12D3KooWBycy6vHVEfUwwYRbPLBdb5gx9gtFSEMpErYPUjUkDNkm", "/dns4/relay3.dev.vdb.to/tcp/443/wss/p2p/12D3KooWARcUJsiGCgiygiRVVK94U8BNSy8DFBbzAF3B6orrabwn"]
|
||||
```
|
||||
|
||||
Replace `CERC_RELAY_ANNOUNCE_DOMAIN` with your public domain name
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 --env-file mobymask-watcher.env up
|
||||
|
||||
# Expected output (ignore the "The X variable is not set. Defaulting to a blank string." warnings):
|
||||
|
||||
# [+] Running 9/9
|
||||
# ✔ Network mobymask_v2_default Created 0.1s
|
||||
# ✔ Volume "mobymask_v2_peers_ids" Created 0.0s
|
||||
# ✔ Volume "mobymask_v2_mobymask_watcher_db_data" Created 0.0s
|
||||
# ✔ Volume "mobymask_v2_mobymask_deployment" Created 0.0s
|
||||
# ✔ Container mobymask_v2-mobymask-watcher-db-1 Healthy 22.2s
|
||||
# ✔ Container mobymask_v2-mobymask-1 Exited 2.2s
|
||||
# ✔ Container mobymask_v2-peer-ids-gen-1 Exited 23.9s
|
||||
# ✔ Container mobymask_v2-mobymask-watcher-server-1 Healthy 43.6s
|
||||
# ✔ Container mobymask_v2-peer-tests-1 Started 44.5s
|
||||
```
|
||||
|
||||
This will run the `mobymask-v2-watcher` including:
|
||||
* A relay node which is in a federated setup with relay nodes set in the env file
|
||||
* A peer node which connects to the watcher relay node as an entrypoint to the MobyMask watcher p2p network. This peer listens for messages from other peers on the network and logs them out to the console
|
||||
|
||||
The watcher GraphQL endpoint is exposed on host port `3001` and the relay node endpoint is exposed on host port `9090`
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 ps
|
||||
|
||||
# Expected output:
|
||||
|
||||
# Running containers:
|
||||
# id: 25cc3a1cbda27fcd9c2ad4c772bd753ccef1e178f901a70e6ff4191d4a8684e9, name: mobymask_v2-mobymask-watcher-db-1, ports: 127.0.0.1:15432->5432/tcp
|
||||
# id: c9806f78680d68292ffe942222af2003aa3ed5d5c69d7121b573f5028444391d, name: mobymask_v2-mobymask-watcher-server-1, ports: 127.0.0.1:3001->3001/tcp, 127.0.0.1:9001->9001/tcp, 127.0.0.1:9090->9090/tcp
|
||||
# id: 6b30a1d313a88fb86f8a3b37a1b1a3bc053f238664e4b2d196c3ec74e04faf13, name: mobymask_v2-peer-tests-1, ports:
|
||||
|
||||
|
||||
# With status
|
||||
docker ps
|
||||
|
||||
# Expected output:
|
||||
|
||||
# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
# 6b30a1d313a8 cerc/watcher-ts:local "docker-entrypoint.s…" 5 minutes ago Up 4 minutes mobymask_v2-peer-tests-1
|
||||
# c9806f78680d cerc/watcher-mobymask-v2:local "sh start-server.sh" 5 minutes ago Up 5 minutes (healthy) 127.0.0.1:3001->3001/tcp, 127.0.0.1:9001->9001/tcp, 127.0.0.1:9090->9090/tcp mobymask_v2-mobymask-watcher-server-1
|
||||
# 25cc3a1cbda2 postgres:14-alpine "docker-entrypoint.s…" 5 minutes ago Up 5 minutes (healthy) 127.0.0.1:15432->5432/tcp mobymask_v2-mobymask-watcher-db-1
|
||||
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
Check watcher container logs to get multiaddr advertised by the watcher's relay node and note it down for further usage:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 logs mobymask-watcher-server | grep -A 2 "Relay node started"
|
||||
|
||||
# The multiaddr will be of form /dns4/<CERC_RELAY_ANNOUNCE_DOMAIN>/tcp/443/wss/p2p/<RELAY_PEER_ID>
|
||||
# Expected output:
|
||||
|
||||
# mobymask_v2-mobymask-watcher-server-1 | 2023-04-20T04:22:57.069Z laconic:relay Relay node started with id 12D3KooWKef84LAcBNb9wZNs6jC5kQFXjddo47hK6AGHD2dSvGai (characteristic-black-pamella)
|
||||
# mobymask_v2-mobymask-watcher-server-1 | 2023-04-20T04:22:57.069Z laconic:relay Listening on:
|
||||
# mobymask_v2-mobymask-watcher-server-1 | 2023-04-20T04:22:57.070Z laconic:relay /dns4/mobymask.example.com/tcp/443/wss/p2p/12D3KooWKef84LAcBNb9wZNs6jC5kQFXjddo47hK6AGHD2dSvGai
|
||||
```
|
||||
|
||||
## Web App
|
||||
|
||||
To be able to connect to the relay node from remote peers, it needs to be publicly reachable.
|
||||
Configure your website with SSL and the `https` traffic reverse proxied as:
|
||||
* `/graphql` to port `3001` (watcher GQL endpoint)
|
||||
* `/` to port `9090` (relay node)
|
||||
|
||||
For example, a Nginx configuration for domain `mobymask.example.com` would look something like:
|
||||
|
||||
```bash
|
||||
server {
|
||||
server_name mobymask.example.com;
|
||||
|
||||
location /graphql {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
proxy_read_timeout 90;
|
||||
}
|
||||
|
||||
# https://nginx.org/en/docs/http/websocket.html
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:9090;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# set a large timeout to avoid websocket disconnects
|
||||
proxy_read_timeout 86400;
|
||||
}
|
||||
|
||||
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
||||
listen 443 ssl; # managed by Certbot
|
||||
ssl_certificate /etc/letsencrypt/live/mobymask.example.com/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/mobymask.example.com/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
}
|
||||
|
||||
server {
|
||||
if ($host = mobymask.example.com) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name mobymask.example.com;
|
||||
return 404; # managed by Certbot
|
||||
}
|
||||
```
|
||||
|
||||
To test the web-app, either visit https://mobymask-lxdao-app.dev.vdb.to/ or follow [web-app.md](./web-app.md) to deploy the app locally that hits your watcher's GQL endpoint
|
||||
|
||||
Connect a browser peer to the watcher's relay node:
|
||||
* Click on debug panel on bottom right of the homepage
|
||||
* Select `<custom>` in `Primary Relay` dropdown on the right and enter the watcher relay node's multiaddr
|
||||
* Click on `UPDATE` to refresh the page and connect to the watcher's relay node; you should see the relay node's multiaddr in `Self Node Info` on the debug panel
|
||||
* Switch to the `GRAPH (PEERS)` tab to see peers connected to this browser node and the `GRAPH (NETWORK)` tab to see the whole MobyMask p2p network
|
||||
|
||||
Perform transactions:
|
||||
* An invitation is required to be able to perform transactions; ask an existing user of the app for an invite
|
||||
* In a browser, close the app if it's already open and then open the invite link
|
||||
* From the debug panel, confirm that the browser peer is connected to at least one other peer
|
||||
* Check the status for a phisher to be reported in the `Check Phisher Status` section on homepage
|
||||
* Select `Report Phisher` option in the `Pending reports` section, enter multiple phisher records and click on the `Submit batch to p2p network` button; this broadcasts signed invocations to peers on the network, including the watcher peer
|
||||
* Check the watcher container logs to see the message received:
|
||||
```bash
|
||||
docker logs $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||
|
||||
# Expected output:
|
||||
|
||||
# .
|
||||
# .
|
||||
# 2023-04-20T04:42:01.072Z vulcanize:libp2p-utils [4:42:1] Received a message on mobymask P2P network from peer: 12D3KooWDKCke8hrjm4evwc9HzUzPZXeVTEQqmfLCkdNaXQ7efAZ
|
||||
# 2023-04-20T04:42:01.072Z vulcanize:libp2p-utils Signed invocations:
|
||||
# 2023-04-20T04:42:01.073Z vulcanize:libp2p-utils [
|
||||
# {
|
||||
# "signature": "0x18dc2f4092473cbcc4636eb922f6abf17675368363675779e67d2c14bb0a135f6029da12671a3367463d41720938c84bb3ceed727721c3bbc50d8739859412801c",
|
||||
# "invocations": {
|
||||
# "batch": [
|
||||
# {
|
||||
# "transaction": {
|
||||
# "to": "0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9",
|
||||
# "data": "0x6b6dc9de00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000c5457543a70686973686572310000000000000000000000000000000000000000",
|
||||
# "gasLimit": 500000
|
||||
# },
|
||||
# "authority": [
|
||||
# {
|
||||
# "signature": "0x0f91c765faaf851550ddd4345d1bc11eebbf29fde0306a8051f9d3c679c6d6856f66753cad8fcff25203a3e0528b3d7673371343f66a39424f6281c474eada431c",
|
||||
# "delegation": {
|
||||
# "delegate": "0x1B85a1485582C3389F62EB9F2C88f0C89bb1C1F4",
|
||||
# "authority": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
# "caveats": [
|
||||
# {
|
||||
# "enforcer": "0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9",
|
||||
# "terms": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# ],
|
||||
# "replayProtection": {
|
||||
# "nonce": 1,
|
||||
# "queue": 64298938
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# ]
|
||||
# 2023-04-20T04:42:01.087Z vulcanize:libp2p-utils method: claimIfPhisher, value: TWT:phisher1
|
||||
# 2023-04-20T04:42:01.087Z vulcanize:libp2p-utils ------------------------------------------
|
||||
# .
|
||||
# .
|
||||
```
|
||||
* Now, check the status for reported phishers again and confirm that they have been registered
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 down
|
||||
|
||||
# Expected output:
|
||||
|
||||
# [+] Running 6/6
|
||||
# ✔ Container mobymask_v2-peer-tests-1 Removed 10.5s
|
||||
# ✔ Container mobymask_v2-mobymask-watcher-server-1 Removed 10.8s
|
||||
# ✔ Container mobymask_v2-peer-ids-gen-1 Removed 0.0s
|
||||
# ✔ Container mobymask_v2-mobymask-1 Removed 0.0s
|
||||
# ✔ Container mobymask_v2-mobymask-watcher-db-1 Removed 0.6s
|
||||
# ✔ Network mobymask_v2_default Removed 0.5s
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=mobymask_v2"
|
||||
|
||||
# Expected output:
|
||||
|
||||
# mobymask_v2_mobymask_deployment
|
||||
# mobymask_v2_mobymask_watcher_db_data
|
||||
# mobymask_v2_peers_ids
|
||||
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
* If you don't see any peer connections being formed in the debug panel on https://mobymask-lxdao-app.dev.vdb.to/, try clearing out the website's local storage and refreshing the page
|
||||
@@ -0,0 +1,162 @@
|
||||
# MobyMask Watcher P2P Network - Web App
|
||||
|
||||
Instructions to setup and deploy the MobyMask app locally, pointed to a watcher on the p2p network
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* Laconic Stack Orchestrator ([installation](/README.md#install))
|
||||
* Watcher GQL endpoint
|
||||
|
||||
## Setup
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 build-containers --include cerc/react-peer,cerc/mobymask-ui
|
||||
```
|
||||
|
||||
Check that the required images are created in the local image registry:
|
||||
|
||||
```bash
|
||||
docker image ls
|
||||
|
||||
# Expected output:
|
||||
|
||||
# REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
# cerc/react-peer local d66b144dbb53 4 days ago 868MB
|
||||
# cerc/mobymask-ui local e456bf9937ec 4 days ago 1.67GB
|
||||
# .
|
||||
# .
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create an env file `mobymask-app.env`:
|
||||
|
||||
```bash
|
||||
touch mobymask-app.env
|
||||
```
|
||||
|
||||
Add the following contents to `mobymask-app.env`:
|
||||
|
||||
```bash
|
||||
# Watcher endpoint used by the app for GQL queries
|
||||
CERC_APP_WATCHER_URL="http://127.0.0.1:3001"
|
||||
|
||||
|
||||
# DO NOT CHANGE THESE VALUES
|
||||
CERC_DEPLOYED_CONTRACT="0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9"
|
||||
CERC_RELAY_NODES=["/dns4/relay1.dev.vdb.to/tcp/443/wss/p2p/12D3KooWAx83SM9GWVPc9v9fNzLzftRX6EaAFMjhYiFxRYqctcW1","/dns4/relay2.dev.vdb.to/tcp/443/wss/p2p/12D3KooWBycy6vHVEfUwwYRbPLBdb5gx9gtFSEMpErYPUjUkDNkm","/dns4/relay3.dev.vdb.to/tcp/443/wss/p2p/12D3KooWARcUJsiGCgiygiRVVK94U8BNSy8DFBbzAF3B6orrabwn"]
|
||||
```
|
||||
|
||||
Replace `CERC_APP_WATCHER_URL` with the watcher's endpoint (eg. `https://mobymask.example.com`)
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mm_v2 --include mobymask-app --env-file mobymask-app.env up lxdao-mobymask-app
|
||||
|
||||
# Expected output (ignore the "The X variable is not set. Defaulting to a blank string." warnings):
|
||||
|
||||
# [+] Running 4/4
|
||||
# ✔ Network mm_v2_default Created 0.1s
|
||||
# ✔ Volume "mm_v2_peers_ids" Created 0.0s
|
||||
# ✔ Volume "mm_v2_mobymask_deployment" Created 0.0s
|
||||
# ✔ Container mm_v2-lxdao-mobymask-app-1 Started 1.1s
|
||||
```
|
||||
|
||||
This will run the `lxdao-mobymask-app` (at `http://localhost:3004`) pointed to `CERC_APP_WATCHER_URL` for GQL queries
|
||||
|
||||
To monitor the running container:
|
||||
|
||||
```bash
|
||||
# With status
|
||||
docker ps
|
||||
|
||||
# Expected output:
|
||||
|
||||
# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
# f1369dbae1c9 cerc/mobymask-ui:local "docker-entrypoint.s…" 2 minutes ago Up 2 minutes (healthy) 127.0.0.1:3004->80/tcp mm_v2-lxdao-mobymask-app-1
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f mm_v2-lxdao-mobymask-app-1
|
||||
|
||||
# Expected output:
|
||||
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
# Available on:
|
||||
# http://127.0.0.1:80
|
||||
# http://192.168.0.2:80
|
||||
# Hit CTRL-C to stop the server
|
||||
```
|
||||
|
||||
Note: For opening an invite link on this deployed app, replace the URL part before `/#` with `http://localhost:3004`
|
||||
For example: `http://localhost:3004/#/members?invitation=XYZ`
|
||||
|
||||
In order to host the app using a public domain, configure your website with SSL and `https` traffic reverse proxied to port `3004`.
|
||||
|
||||
For example, a Nginx configuration for domain `my-mobymask-app.example.com` would look something like:
|
||||
|
||||
```bash
|
||||
server {
|
||||
server_name my-mobymask-app.example.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3004;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
listen [::]:443 ssl;
|
||||
listen 443 ssl;
|
||||
ssl_certificate /etc/letsencrypt/live/my-mobymask-app.example.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/my-mobymask-app.example.com/privkey.pem;
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
}
|
||||
|
||||
server {
|
||||
if ($host = my-mobymask-app.example.com) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
server_name my-mobymask-app.example.com;
|
||||
listen 80;
|
||||
return 404; # managed by Certbot
|
||||
}
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mm_v2 --include mobymask-app down
|
||||
|
||||
# Expected output:
|
||||
|
||||
# [+] Running 2/2
|
||||
# ✔ Container mm_v2-lxdao-mobymask-app-1 Removed 10.6s
|
||||
# ✔ Network mm_v2_default Removed 0.5s
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=mm_v2"
|
||||
|
||||
# Expected output:
|
||||
|
||||
# mm_v2_mobymask_deployment
|
||||
# mm_v2_peers_ids
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=mm_v2")
|
||||
```
|
||||
@@ -0,0 +1,109 @@
|
||||
# Web Apps
|
||||
|
||||
Instructions to setup and deploy MobyMask and Peer Test web apps
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: Watcher with GQL and relay node endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 setup-repositories --include github.com/cerc-io/mobymask-ui
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 build-containers --include cerc/react-peer,cerc/mobymask-ui
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v2/mobymask-params.env)):
|
||||
|
||||
```bash
|
||||
# Set of relay nodes to be used by the web-app
|
||||
# (use double quotes " for strings, avoid space after commas)
|
||||
# Eg. CERC_RELAY_NODES=["/dns4/example.com/tcp/443/wss/p2p/12D3KooWGHmDDCc93XUWL16FMcTPCGu2zFaMkf67k8HZ4gdQbRDr"]
|
||||
CERC_RELAY_NODES=[]
|
||||
|
||||
# Set of multiaddrs to be avoided while dialling
|
||||
CERC_DENY_MULTIADDRS=[]
|
||||
|
||||
# Also add if running MobyMask app:
|
||||
|
||||
# Watcher endpoint used by the app for GQL queries
|
||||
CERC_APP_WATCHER_URL="http://127.0.0.1:3001"
|
||||
|
||||
# Set deployed MobyMask contract address to be used in MobyMask app's config
|
||||
CERC_DEPLOYED_CONTRACT=
|
||||
|
||||
# L2 Chain ID used by mobymask web-app for L2 txs
|
||||
CERC_CHAIN_ID=42069
|
||||
|
||||
# (Optional) Type of pubsub to be used ("floodsub" | "gossipsub")
|
||||
CERC_PUBSUB=""
|
||||
```
|
||||
|
||||
* NOTE: If watcher is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
For running mobymask-app
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include mobymask-app --env-file <PATH_TO_ENV_FILE> up
|
||||
|
||||
# Runs mobymask-app on host port 3002 and lxdao-mobymask-app on host port 3004
|
||||
```
|
||||
|
||||
For running peer-test-app
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include peer-test-app --env-file <PATH_TO_ENV_FILE> up
|
||||
|
||||
# Runs on host port 3003
|
||||
```
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include [mobymask-app | peer-test-app] ps
|
||||
|
||||
# With status
|
||||
docker ps -a
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
For mobymask-app
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include mobymask-app down
|
||||
```
|
||||
|
||||
For peer-test-app
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include peer-test-app down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=mobymask_v2"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
# MobyMask v3
|
||||
|
||||
Instructions to setup and deploy MobyMask v3 stack (watcher + web-app) using [laconic-stack-orchestrator](/README.md#install)
|
||||
|
||||
* Follow [watcher.md](./watcher.md) for deploying the watcher
|
||||
* Follow [web-app.md](./web-app.md) for deploying the app
|
||||
@@ -0,0 +1,19 @@
|
||||
version: "1.0"
|
||||
description: "MobyMask v3 stack"
|
||||
name: mobymask-v3
|
||||
repos:
|
||||
- github.com/cerc-io/ts-nitro@v0.1.13
|
||||
- github.com/cerc-io/watcher-ts@v0.2.63
|
||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.2
|
||||
- github.com/cerc-io/MobyMask@v0.1.3
|
||||
- github.com/cerc-io/mobymask-ui@v0.2.1
|
||||
containers:
|
||||
- cerc/nitro-contracts
|
||||
- cerc/watcher-ts
|
||||
- cerc/watcher-mobymask-v3
|
||||
- cerc/mobymask
|
||||
- cerc/mobymask-ui
|
||||
pods:
|
||||
- nitro-contracts
|
||||
- watcher-mobymask-v3
|
||||
- mobymask-app-v3
|
||||
@@ -0,0 +1,136 @@
|
||||
# MobyMask v3 Watcher
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: L2 Optimism Geth RPC endpoint
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 setup-repositories --pull --exclude github.com/cerc-io/mobymask-ui
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 build-containers --exclude cerc/mobymask-ui
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v3/mobymask-params.env)):
|
||||
|
||||
```bash
|
||||
# External ETH RPC endpoint for contract(s) deployment
|
||||
CERC_ETH_RPC_ENDPOINT=
|
||||
|
||||
# External ETH RPC endpoint used for queries in the watcher
|
||||
CERC_ETH_RPC_QUERY_ENDPOINT=
|
||||
|
||||
# External ETH RPC endpoint used for mutations in the watcher
|
||||
CERC_ETH_RPC_MUTATION_ENDPOINT=
|
||||
|
||||
# External ETH endpoint used by watcher's Nitro node
|
||||
CERC_NITRO_CHAIN_URL=
|
||||
|
||||
# Specify the an account PK for contract deployment
|
||||
CERC_PRIVATE_KEY_DEPLOYER=
|
||||
|
||||
# Base URI for mobymask-app
|
||||
# (used for generating a root invite link after deploying the contract)
|
||||
CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3004/#"
|
||||
|
||||
# (Optional) Domain to be used in the relay node's announce address
|
||||
CERC_RELAY_ANNOUNCE_DOMAIN=
|
||||
|
||||
# (Optional) Set of relay peers to connect to from the relay node
|
||||
CERC_RELAY_PEERS=[]
|
||||
|
||||
# (Optional) Set of multiaddrs to be avoided while dialling
|
||||
CERC_DENY_MULTIADDRS=[]
|
||||
|
||||
# (Optional) Type of pubsub to be used
|
||||
CERC_PUBSUB=""
|
||||
|
||||
# Set to false for disabling watcher peer to send txs to L2
|
||||
CERC_ENABLE_PEER_L2_TXS=true
|
||||
|
||||
# (Optional) Set already deployed MobyMask contract address to avoid deploying contract in the stack
|
||||
CERC_DEPLOYED_CONTRACT=
|
||||
|
||||
# (Optional) Set already deployed Nitro addresses to avoid deploying them in the stack
|
||||
CERC_NA_ADDRESS=
|
||||
CERC_VPA_ADDRESS=
|
||||
CERC_CA_ADDRESS=
|
||||
|
||||
# Specify private key of a funded account for sending txs to L2
|
||||
CERC_PRIVATE_KEY_PEER=
|
||||
|
||||
# Specify private key for the Nitro account
|
||||
CERC_WATCHER_NITRO_PK=
|
||||
|
||||
# (Optional) Set a pre-existing peer id to be used (enables consensus)
|
||||
# Uses a generated peer id if not set (disables consensus)
|
||||
CERC_PEER_ID=
|
||||
|
||||
# Disable payments to upstream ETH server
|
||||
CERC_ENABLE_UPSTREAM_PAYMENTS=false
|
||||
```
|
||||
|
||||
* NOTE: If Optimism is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --exclude mobymask-app-v3 --env-file <PATH_TO_ENV_FILE> up
|
||||
```
|
||||
|
||||
* To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --exclude mobymask-app-v3 ps
|
||||
|
||||
# With status
|
||||
docker ps -a
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
* The watcher endpoint is exposed on host port `3001` and the relay node endpoint is exposed on host port `9090`
|
||||
|
||||
* Check the logs of the MobyMask contract deployment container to get the deployed contract's address and generated root invite link:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
```
|
||||
|
||||
* Check logs of the Nitro contracts container to get the deployed Nitro contracts' addresses:
|
||||
|
||||
```bash
|
||||
docker exec -it $(docker ps -q --filter name="nitro-contracts") bash -c "cat /app/deployment/nitro-addresses.json"
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --exclude mobymask-app-v3 down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=mobymask_v3"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=mobymask_v3")
|
||||
|
||||
# WARNING: To avoid changing peer ids for the watcher, `peers_ids` volume can be persisted
|
||||
# To delete all volumes except for `peers_ids`
|
||||
docker volume rm $(docker volume ls -q --filter "name=mobymask_v3" | grep -v "peers_ids$")
|
||||
```
|
||||
@@ -0,0 +1,89 @@
|
||||
# MobyMask v3 App
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: Watcher with GQL and relay node endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 setup-repositories --pull --include github.com/cerc-io/mobymask-ui
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 build-containers --include cerc/mobymask-ui
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v3/mobymask-params.env)):
|
||||
|
||||
```bash
|
||||
# Set of relay nodes to be used by the web-app
|
||||
# (use double quotes " for strings, avoid space after commas)
|
||||
# Eg. CERC_RELAY_NODES=["/dns4/example.com/tcp/443/wss/p2p/12D3KooWGHmDDCc93XUWL16FMcTPCGu2zFaMkf67k8HZ4gdQbRDr"]
|
||||
CERC_RELAY_NODES=[]
|
||||
|
||||
# Set of multiaddrs to be avoided while dialling
|
||||
CERC_DENY_MULTIADDRS=[]
|
||||
|
||||
# Also add if running MobyMask app:
|
||||
|
||||
# Watcher endpoint used by the app for GQL queries
|
||||
CERC_APP_WATCHER_URL="http://127.0.0.1:3001"
|
||||
|
||||
# Set deployed MobyMask contract address to be used in MobyMask app's config
|
||||
CERC_DEPLOYED_CONTRACT=
|
||||
|
||||
# L2 Chain ID used by mobymask web-app for L2 txs
|
||||
CERC_CHAIN_ID=42069
|
||||
|
||||
# (Optional) Type of pubsub to be used ("floodsub" | "gossipsub")
|
||||
CERC_PUBSUB=""
|
||||
|
||||
# (Optional) Set of direct peers to be used when pubsub is set to gossipsub
|
||||
CERC_GOSSIPSUB_DIRECT_PEERS=[]
|
||||
|
||||
# Set Nitro addresses
|
||||
CERC_NA_ADDRESS=
|
||||
CERC_VPA_ADDRESS=
|
||||
CERC_CA_ADDRESS=
|
||||
|
||||
# Nitro account address to make the query and mutation payments to
|
||||
CERC_PAYMENT_NITRO_ADDRESS=
|
||||
|
||||
# (Optional) Endpoint for Mobymask snap installation
|
||||
CERC_SNAP_URL=
|
||||
```
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include mobymask-app-v3 --env-file <PATH_TO_ENV_FILE> up
|
||||
|
||||
# Runs the MobyMask v3 app on host port 3004
|
||||
```
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include mobymask-app-v3 ps
|
||||
|
||||
# With status
|
||||
docker ps -a
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v3 deploy --cluster mobymask_v3 --include mobymask-app-v3 down
|
||||
```
|
||||
@@ -0,0 +1,85 @@
|
||||
# MobyMask
|
||||
|
||||
The MobyMask watcher is a Laconic Network component that provides efficient access to MobyMask contract data from Ethereum, along with evidence allowing users to verify the correctness of that data. The watcher source code is available in [this repository](https://github.com/cerc-io/mobymask-watcher-ts) and a developer-oriented Docker Compose setup for the watcher can be found [here](https://github.com/cerc-io/mobymask-watcher). The watcher can be deployed automatically using the Laconic Stack Orchestrator tool as detailed below:
|
||||
|
||||
## Deploy the MobyMask Watcher
|
||||
|
||||
The instructions below show how to deploy a MobyMask watcher using laconic-stack-orchestrator (the installation of which is covered [here](https://github.com/cerc-io/stack-orchestrator#install)).
|
||||
|
||||
This deployment expects that ipld-eth-server's endpoints are available on the local machine at http://ipld-eth-server.example.com:8083/graphql and http://ipld-eth-server.example.com:8082. More advanced configurations are supported by modifying the watcher's [config file](../../config/watcher-mobymask/mobymask-watcher.toml).
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack mobymask setup-repositories
|
||||
```
|
||||
|
||||
## Build the watcher container
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack mobymask build-containers
|
||||
```
|
||||
|
||||
This should create a container with tag `cerc/watcher-mobymask` in the local image registry.
|
||||
|
||||
## Create a deployment
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack mobymask deploy init --output mobymask-spec.yml
|
||||
$ laconic-so deploy create --spec-file mobymask-spec.yml --deployment-dir mobymask-deployment
|
||||
```
|
||||
|
||||
External `ipld-eth-server` endpoint can be set in watcher config file in the deployment directory:
|
||||
```
|
||||
mobymask-deployment/config/watcher-mobymask/mobymask-watcher.toml
|
||||
```
|
||||
|
||||
## Start the stack
|
||||
|
||||
First the watcher database has to be initialized. Start only the mobymask-watcher-db service:
|
||||
|
||||
```bash
|
||||
$ laconic-so deployment --dir mobymask-deployment start mobymask-watcher-db
|
||||
```
|
||||
|
||||
Next find the container's id using `docker ps` then run the following command to initialize the database:
|
||||
```bash
|
||||
$ docker exec -i <mobymask-watcher-db-container> psql -U vdbm mobymask-watcher < mobymask-deployment/config/watcher-mobymask/mobymask-watcher-db.sql
|
||||
```
|
||||
|
||||
Finally start the remaining containers:
|
||||
|
||||
```bash
|
||||
$ laconic-so deployment --dir mobymask-deployment start
|
||||
```
|
||||
|
||||
Correct operation should be verified by following the instructions [here](https://github.com/cerc-io/mobymask-watcher/tree/main/mainnet-watcher-only#run), checking GraphQL queries return valid results in the watcher's [playground](http://127.0.0.1:3001/graphql).
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background:
|
||||
|
||||
```bash
|
||||
$ laconic-so deployment --dir mobymask-deployment stop
|
||||
```
|
||||
|
||||
## Data volumes
|
||||
|
||||
Container data volumes are bind-mounted to specified paths in the host filesystem.
|
||||
The default setup (generated by `laconic-so deploy init`) places the volumes in the `./data` subdirectory of the deployment directory:
|
||||
```
|
||||
$ cat mobymask-spec.yml
|
||||
stack: mobymask
|
||||
ports:
|
||||
mobymask-watcher-db:
|
||||
- 0.0.0.0:15432:5432
|
||||
mobymask-watcher-job-runner:
|
||||
- 0.0.0.0:9000:9000
|
||||
mobymask-watcher-server:
|
||||
- 0.0.0.0:3001:3001
|
||||
- 0.0.0.0:9001:9001
|
||||
volumes:
|
||||
mobymask_watcher_db_data: ./data/mobymask_watcher_db_data
|
||||
```
|
||||
|
||||
The directory can be changed before `laconic-so deploy create`
|
||||
@@ -0,0 +1,8 @@
|
||||
version: "1.0"
|
||||
name: mobymask-watcher
|
||||
repos:
|
||||
- github.com/cerc-io/mobymask-watcher-ts@v0.1.0
|
||||
containers:
|
||||
- cerc/watcher-mobymask
|
||||
pods:
|
||||
- watcher-mobymask
|
||||
@@ -0,0 +1,5 @@
|
||||
# Package Registry Stack
|
||||
|
||||
The Package Registry Stack supports a build environment that requires a package registry (initially for NPM packages only).
|
||||
|
||||
Setup instructions can be found [here](../build-support/README.md).
|
||||
@@ -0,0 +1,20 @@
|
||||
version: "1.1"
|
||||
name: package-registry
|
||||
description: "Local Package Registry"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/hosting
|
||||
- gitea.com/gitea/act_runner
|
||||
containers:
|
||||
- cerc/act-runner
|
||||
- cerc/act-runner-task-executor
|
||||
pods:
|
||||
- name: gitea
|
||||
repository: cerc-io/hosting
|
||||
path: gitea
|
||||
pre_start_command: "run-this-first.sh"
|
||||
post_start_command: "initialize-gitea.sh"
|
||||
- name: act-runner
|
||||
repository: cerc-io/hosting
|
||||
path: act-runner
|
||||
pre_start_command: "pre_start.sh"
|
||||
post_start_command: "post_start.sh"
|
||||
@@ -0,0 +1,65 @@
|
||||
# Reth
|
||||
Deploy a Reth API node alongside Lighthouse.
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```
|
||||
$ laconic-so --stack reth setup-repositories
|
||||
```
|
||||
|
||||
## Build the Reth stack containers
|
||||
|
||||
```
|
||||
$ laconic-so --stack reth build-containers
|
||||
```
|
||||
|
||||
## Deploy the stack
|
||||
|
||||
```
|
||||
$ laconic-so --stack reth deploy up
|
||||
```
|
||||
|
||||
## Check logs
|
||||
|
||||
```
|
||||
$ laconic-so --stack reth deploy logs
|
||||
```
|
||||
|
||||
Verify that your node is syncing. You should see entries similar to this from the Lighthouse container:
|
||||
|
||||
```
|
||||
laconic-200e8f8ff7891515d777cd0f719078e3-lighthouse-1 | Jun 23 20:59:01.226 INFO New block received root: 0x9cd4a2dd9333cf802c2963c2f029deb0f94e511d2481fa0724ae8752e4c49b15, slot: 6727493
|
||||
```
|
||||
and entries similar to this from the Reth container:
|
||||
```
|
||||
laconic-200e8f8ff7891515d777cd0f719078e3-reth-1 | 2023-06-23T20:59:11.557389Z INFO reth::node::events: Stage committed progress pipeline_stages=1/13 stage=Headers block=0 checkpoint=4.9% eta=1h 3m 57s
|
||||
```
|
||||
|
||||
## Test the API
|
||||
|
||||
Reth's http api is accessible on port `8545` and the websocket api is accessible on port `8546`.
|
||||
```
|
||||
$ curl --request POST \
|
||||
--url http://localhost:8545/ \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "eth_blockNumber",
|
||||
"params": [],
|
||||
"id": 0
|
||||
}'
|
||||
|
||||
# Response
|
||||
{"jsonrpc":"2.0","result":"0x0","id":0}
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack reth deploy down
|
||||
```
|
||||
To also delete the docker data volumes:
|
||||
```bash
|
||||
$ laconic-so --stack reth deploy down --delete-volumes
|
||||
@@ -0,0 +1,10 @@
|
||||
version: "1.1"
|
||||
name: reth
|
||||
description: "Reth node"
|
||||
repos:
|
||||
- github.com/paradigmxyz/reth
|
||||
containers:
|
||||
- cerc/reth
|
||||
- cerc/lighthouse
|
||||
pods:
|
||||
- reth
|
||||
@@ -0,0 +1,170 @@
|
||||
# SushiSwap Subgraph
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack sushiswap-subgraph setup-repositories --pull
|
||||
```
|
||||
|
||||
Checkout to a non-default branch in the cloned repos if required:
|
||||
|
||||
```bash
|
||||
# Default repo base dir
|
||||
cd ~/cerc
|
||||
|
||||
# Example
|
||||
cd graph-node
|
||||
git checkout <your-branch> && git pull
|
||||
|
||||
# Remove the corresponding docker image if it already exists
|
||||
docker image rm cerc/graph-node:local
|
||||
# Remove any dangling images
|
||||
docker image prune
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack sushiswap-subgraph build-containers
|
||||
```
|
||||
|
||||
## Create a deployment
|
||||
|
||||
Initialize deployment and create "spec" file:
|
||||
|
||||
```bash
|
||||
laconic-so --stack sushiswap-subgraph deploy init --output sushiswap-subgraph-spec.yml
|
||||
```
|
||||
|
||||
We need to assign a fixed port `8000` for graph-node subgraph GQL endpoint. The values can be
|
||||
customized by editing the "spec" file generated by `laconic-so deploy init`.
|
||||
```
|
||||
$ cat sushiswap-subgraph-spec.yml
|
||||
stack: sushiswap-subgraph
|
||||
ports:
|
||||
graph-node:
|
||||
- '8000:8000'
|
||||
- '8001'
|
||||
- '8020'
|
||||
- '8030'
|
||||
...
|
||||
```
|
||||
|
||||
Create deployment:
|
||||
|
||||
```bash
|
||||
laconic-so deploy create --spec-file sushiswap-subgraph-spec.yml --deployment-dir sushiswap-subgraph-deployment
|
||||
```
|
||||
|
||||
## Start the stack
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir sushiswap-subgraph-deployment start
|
||||
|
||||
# Note: Remove any existing volumes for the cluster for a fresh start
|
||||
```
|
||||
|
||||
After all services have started:
|
||||
|
||||
* Follow `graph-node` logs:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir sushiswap-subgraph-deployment logs -f graph-node
|
||||
```
|
||||
|
||||
* Check that the subgraphs have been deployed:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir sushiswap-subgraph-deployment logs -f sushiswap-subgraph-v3
|
||||
|
||||
# Expected output:
|
||||
# .
|
||||
# .
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | - Deploying to Graph node http://graph-node:8020/
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Deployed to http://graph-node:8000/subgraphs/name/sushiswap/blocks/graphql
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Subgraph endpoints:
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Queries (HTTP): http://graph-node:8000/subgraphs/name/sushiswap/blocks
|
||||
# .
|
||||
# .
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | - Deploying to Graph node http://graph-node:8020/
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Deployed to http://graph-node:8000/subgraphs/name/sushiswap/v3-filecoin/graphql
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Subgraph endpoints:
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Queries (HTTP): http://graph-node:8000/subgraphs/name/sushiswap/v3-filecoin
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 |
|
||||
# sushigraph-sushiswap-subgraph-v3-1 | Done
|
||||
```
|
||||
|
||||
After `graph-node` has fetched the latest blocks from upstream, use the subgraph (GQL) endpoints for querying:
|
||||
|
||||
```bash
|
||||
# Blocks subgraph endpoint:
|
||||
http://127.0.0.1:8000/subgraphs/name/sushiswap/blocks/graphql
|
||||
|
||||
# v3 subgraph endpoint:
|
||||
http://127.0.0.1:8000/subgraphs/name/sushiswap/v3-filecoin/graphql
|
||||
```
|
||||
|
||||
## Set environment variables
|
||||
|
||||
* The graph-node environment variable `ETHEREUM_REORG_THRESHOLD` can be set in the deployment compose file
|
||||
```bash
|
||||
$ cat sushiswap-subgraph-deployment/compose/docker-compose-graph-node.yml
|
||||
services:
|
||||
graph-node:
|
||||
image: cerc/graph-node:local
|
||||
...
|
||||
environment:
|
||||
...
|
||||
GRAPH_LOG: debug
|
||||
ETHEREUM_REORG_THRESHOLD: 16
|
||||
```
|
||||
Change `ETHEREUM_REORG_THRESHOLD` to desired value
|
||||
|
||||
* To restart graph-node with updated values, we need to restart only graph-node compose services
|
||||
* Comment `sushiswap-subgraph-v3` pod in stack.yml so that subgraphs are not deployed again
|
||||
```bash
|
||||
$ cat sushiswap-subgraph-deployment/stack.yml
|
||||
version: "1.0"
|
||||
name: sushiswap-subgraph
|
||||
...
|
||||
pods:
|
||||
- graph-node
|
||||
# - sushiswap-subgraph-v3
|
||||
```
|
||||
* Stop the stack first
|
||||
```bash
|
||||
laconic-so deployment --dir sushiswap-subgraph-deployment stop
|
||||
```
|
||||
* Start the stack again (will not start `sushiswap-subgraph-v3` pod)
|
||||
```
|
||||
laconic-so deployment --dir sushiswap-subgraph-deployment start
|
||||
```
|
||||
* To check if environment variable has been updated in graph-node container
|
||||
```bash
|
||||
$ laconic-so deployment --dir sushiswap-subgraph-deployment exec graph-node bash
|
||||
root@dc4d3abe1615:/# echo $ETHEREUM_REORG_THRESHOLD
|
||||
16
|
||||
```
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir sushiswap-subgraph-deployment stop
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir sushiswap-subgraph-deployment stop --delete-volumes
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
version: "1.0"
|
||||
name: sushiswap-subgraph
|
||||
description: "SushiSwap Subgraph stack"
|
||||
repos:
|
||||
# graph-node repo
|
||||
- github.com/graphprotocol/graph-node
|
||||
# sushiswap subgraph repo
|
||||
- github.com/sushiswap/subgraphs
|
||||
containers:
|
||||
# graph-node image
|
||||
- cerc/graph-node
|
||||
# sushiswap subgraphs image
|
||||
- cerc/sushiswap-subgraphs
|
||||
pods:
|
||||
- graph-node
|
||||
- sushiswap-subgraph-v3
|
||||
@@ -0,0 +1,47 @@
|
||||
# SushiSwap
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack sushiswap setup-repositories --git-ssh
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack sushiswap build-containers
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack sushiswap deploy --cluster sushiswap up
|
||||
```
|
||||
|
||||
Note: When running for the first time (or after clean up), the services will take some time to start as Lotus nodes in the fixturenet download the proof params
|
||||
|
||||
## Tests
|
||||
|
||||
Follow [smoke-tests.md](./smoke-tests.md) to run smoke tests
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all the services running in background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack sushiswap deploy --cluster sushiswap down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=sushiswap"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=sushiswap")
|
||||
```
|
||||
@@ -0,0 +1,71 @@
|
||||
# SushiSwap Watcher Smoke Tests
|
||||
|
||||
## sushi-watcher
|
||||
|
||||
Deploy required contracts and set the addresses to variables:
|
||||
|
||||
```bash
|
||||
# Deploy UniswapV3Factory
|
||||
docker exec -it sushiswap-sushiswap-v3-core-1 pnpm hardhat --network docker deploy --tags UniswapV3Factory
|
||||
|
||||
# Set the returned address to a variable
|
||||
export FACTORY_ADDRESS=<FACTORY_ADDRESS>
|
||||
|
||||
# Deploy TestUniswapV3Callee
|
||||
docker exec -it sushiswap-sushiswap-v3-core-1 pnpm hardhat --network docker deploy --tags TestUniswapV3Callee
|
||||
|
||||
# Set the returned address to a variable
|
||||
export UNISWAP_CALLEE_ADDRESS=<UNISWAP_CALLEE_ADDRESS>
|
||||
|
||||
# Deploy NFPM contract
|
||||
docker exec -it sushiswap-sushiswap-v3-periphery-1 bash -c "export FACTORY_ADDRESS=$FACTORY_ADDRESS && yarn hardhat --network docker deploy --tags NonfungiblePositionManager"
|
||||
|
||||
# Set the returned address to a variable
|
||||
export POSITION_MANAGER_ADDRESS=<POSITION_MANAGER_ADDRESS>
|
||||
|
||||
# Deploy two test tokens
|
||||
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
|
||||
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
|
||||
|
||||
# Set the returned addresses to variables
|
||||
export TOKEN0_ADDRESS=<TOKEN0_ADDRESS>
|
||||
export TOKEN1_ADDRESS=<TOKEN1_ADDRESS>
|
||||
```
|
||||
|
||||
Watch the contracts:
|
||||
|
||||
```bash
|
||||
# Watch factory contract
|
||||
docker exec -it sushiswap-sushi-watcher-server-1 bash -c "yarn watch:contract --address $FACTORY_ADDRESS --kind factory --startingBlock 100 --checkpoint false"
|
||||
docker exec -it sushiswap-sushi-info-watcher-server-1 bash -c "yarn watch:contract --address $FACTORY_ADDRESS --kind factory --startingBlock 100 --checkpoint false"
|
||||
|
||||
# Watch NFPM contract
|
||||
docker exec -it sushiswap-sushi-watcher-server-1 bash -c "yarn watch:contract --address $POSITION_MANAGER_ADDRESS --kind nfpm --startingBlock 100 --checkpoint false"
|
||||
docker exec -it sushiswap-sushi-info-watcher-server-1 bash -c "yarn watch:contract --address $POSITION_MANAGER_ADDRESS --kind nfpm --startingBlock 100 --checkpoint false"
|
||||
```
|
||||
|
||||
Run the smoke test:
|
||||
|
||||
```bash
|
||||
docker exec -it sushiswap-sushi-watcher-server-1 bash -c "export TOKEN0_ADDRESS=$TOKEN0_ADDRESS && export TOKEN1_ADDRESS=$TOKEN1_ADDRESS && export UNISWAP_CALLEE_ADDRESS=$UNISWAP_CALLEE_ADDRESS && yarn smoke-test"
|
||||
```
|
||||
|
||||
## sushi-info-watcher
|
||||
|
||||
Deploy required contracts and set the addresses to variables:
|
||||
|
||||
```bash
|
||||
# Deploy two test tokens
|
||||
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
|
||||
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
|
||||
|
||||
# Set the returned addresses to variables
|
||||
export TOKEN0_ADDRESS=<TOKEN0_ADDRESS>
|
||||
export TOKEN1_ADDRESS=<TOKEN1_ADDRESS>
|
||||
```
|
||||
|
||||
Run the smoke test:
|
||||
|
||||
```bash
|
||||
docker exec -it sushiswap-sushi-info-watcher-server-1 bash -c "export TOKEN0_ADDRESS=$TOKEN0_ADDRESS && export TOKEN1_ADDRESS=$TOKEN1_ADDRESS && export UNISWAP_CALLEE_ADDRESS=$UNISWAP_CALLEE_ADDRESS && yarn smoke-test"
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
version: "1.0"
|
||||
name: sushiswap
|
||||
description: "End-to-end SushiSwap watcher stack"
|
||||
repos:
|
||||
## fixturenet-lotus repo
|
||||
- github.com/filecoin-project/lotus
|
||||
## sushiswap repos
|
||||
- github.com/cerc-io/sushiswap-v3-core@watcher-ts
|
||||
- github.com/cerc-io/sushiswap-v3-periphery@watcher-ts
|
||||
- github.com/vulcanize/uniswap-watcher-ts@sushiswap
|
||||
- github.com/vulcanize/uniswap-v3-info
|
||||
containers:
|
||||
## fixturenet-lotus image
|
||||
- cerc/lotus
|
||||
## sushiswap images
|
||||
- cerc/sushiswap-v3-core
|
||||
- cerc/sushiswap-v3-periphery
|
||||
- cerc/watcher-sushiswap
|
||||
- cerc/uniswap-v3-info
|
||||
pods:
|
||||
- fixturenet-lotus
|
||||
- watcher-sushiswap
|
||||
@@ -0,0 +1,3 @@
|
||||
# Test Stack
|
||||
|
||||
A stack for test/demo purposes.
|
||||
@@ -0,0 +1,57 @@
|
||||
# Copyright © 2022, 2023 Vulcanize
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||
|
||||
from stack_orchestrator.util import get_yaml
|
||||
from stack_orchestrator.deploy.deploy_types import DeployCommandContext
|
||||
from stack_orchestrator.deploy.stack_state import State
|
||||
from stack_orchestrator.deploy.deploy_util import VolumeMapping, run_container_command
|
||||
from pathlib import Path
|
||||
|
||||
default_spec_file_content = """config:
|
||||
test-variable-1: test-value-1
|
||||
"""
|
||||
|
||||
|
||||
# Output a known string to a know file in the bind mounted directory ./container-output-dir
|
||||
# for test purposes -- test checks that the file was written.
|
||||
def setup(command_context: DeployCommandContext, parameters, extra_args):
|
||||
host_directory = "./container-output-dir"
|
||||
host_directory_absolute = Path(extra_args[0]).absolute().joinpath(host_directory)
|
||||
host_directory_absolute.mkdir(parents=True, exist_ok=True)
|
||||
mounts = [
|
||||
VolumeMapping(host_directory_absolute, "/data")
|
||||
]
|
||||
output, status = run_container_command(command_context, "test", "echo output-data > /data/output-file && echo success", mounts)
|
||||
|
||||
|
||||
def init(command_context: DeployCommandContext):
|
||||
yaml = get_yaml()
|
||||
return yaml.load(default_spec_file_content)
|
||||
|
||||
|
||||
def create(command_context: DeployCommandContext, extra_args):
|
||||
data = "create-command-output-data"
|
||||
output_file_path = command_context.deployment_dir.joinpath("create-file")
|
||||
with open(output_file_path, 'w+') as output_file:
|
||||
output_file.write(data)
|
||||
|
||||
|
||||
def get_state(command_context: DeployCommandContext):
|
||||
print("Here we get state")
|
||||
return State.CONFIGURED
|
||||
|
||||
|
||||
def change_state(command_context: DeployCommandContext):
|
||||
pass
|
||||
@@ -0,0 +1,10 @@
|
||||
version: "1.0"
|
||||
name: test
|
||||
description: "A test stack"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/laconicd
|
||||
- git.vdb.to/cerc-io/test-project@test-branch
|
||||
containers:
|
||||
- cerc/test-container
|
||||
pods:
|
||||
- test
|
||||
@@ -0,0 +1,83 @@
|
||||
# Uniswap v3
|
||||
|
||||
Instructions to deploy Uniswap v3 watcher stack (watcher + uniswap-v3-info frontend app) using [laconic-stack-orchestrator](../../README.md#setup)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* Access to [uniswap-watcher-ts](https://github.com/vulcanize/uniswap-watcher-ts).
|
||||
|
||||
* This deployment expects core services to be running; specifically, it requires `ipld-eth-server` RPC and GQL endpoints. Update the `upstream.ethServer` endpoints in the [watcher config files](../../config/watcher-uniswap-v3) accordingly:
|
||||
|
||||
```toml
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server.example.com:8083/graphql"
|
||||
rpcProviderEndpoint = "http://ipld-eth-server.example.com:8082"
|
||||
```
|
||||
|
||||
* `uni-watcher` and `uni-info-watcher` database dumps (optional).
|
||||
|
||||
## Setup
|
||||
|
||||
* Clone / pull required repositories:
|
||||
|
||||
```bash
|
||||
$ laconic-so setup-repositories --include vulcanize/uniswap-watcher-ts,vulcanize/uniswap-v3-info --git-ssh --pull
|
||||
```
|
||||
|
||||
* Build watcher and info app container images:
|
||||
|
||||
```bash
|
||||
$ laconic-so build-containers --include cerc/watcher-uniswap-v3,cerc/uniswap-v3-info
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
## Deploy
|
||||
|
||||
* (Optional) Initialize the watcher database with existing database dumps if available:
|
||||
|
||||
* Start the watcher database to be initialized:
|
||||
|
||||
```bash
|
||||
$ laconic-so deploy-system --include watcher-uniswap-v3 up uniswap-watcher-db
|
||||
```
|
||||
|
||||
* Find the watcher database container's id using `docker ps` and export it for further usage:
|
||||
|
||||
```bash
|
||||
$ export CONTAINER_ID=<CONTAINER_ID>
|
||||
```
|
||||
|
||||
* Load watcher database dumps:
|
||||
|
||||
```bash
|
||||
# uni-watcher database
|
||||
$ docker exec -i $CONTAINER_ID psql -U vdbm uni-watcher < UNI_WATCHER_DB_DUMP_FILE_PATH.sql
|
||||
|
||||
# uni-info-watcher database
|
||||
$ docker exec -i $CONTAINER_ID psql -U vdbm uni-info-watcher < UNI_INFO_WATCHER_DB_DUMP_FILE_PATH.sql
|
||||
```
|
||||
|
||||
* Start all the watcher and info app services:
|
||||
|
||||
```bash
|
||||
$ laconic-so deploy-system --include watcher-uniswap-v3 up
|
||||
```
|
||||
|
||||
* Check that all the services are up and healthy:
|
||||
|
||||
```bash
|
||||
$ docker ps
|
||||
```
|
||||
|
||||
* The `uni-info-watcher` GraphQL Playground can be accessed at `http://localhost:3004/graphql`
|
||||
* The frontend app can be accessed at `http://localhost:3006`
|
||||
|
||||
## Clean up
|
||||
|
||||
* To stop all the services running in background:
|
||||
|
||||
```bash
|
||||
$ laconic-so deploy-system --include watcher-uniswap-v3 down
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
version: "1.0"
|
||||
name: uniswap-v3
|
||||
repos:
|
||||
- github.com/vulcanize/uniswap-watcher-ts
|
||||
- github.com/vulcanize/uniswap-v3-info
|
||||
containers:
|
||||
- cerc/watcher-uniswap-v3
|
||||
- cerc/uniswap-v3-info
|
||||
pods:
|
||||
- watcher-uniswap-v3
|
||||
Reference in New Issue
Block a user