diff --git a/.env b/.env
new file mode 100644
index 00000000..dd9870f7
--- /dev/null
+++ b/.env
@@ -0,0 +1,8 @@
+# TFHE_RS_VERSION=0.2.1
+# TFHE_RS_PATH=../tfhe-rs
+# ZBC_DEVELOPMENT_PATH=../zbc-development
+# ZBC_SOLIDITY_PATH=../zbc-solidity
+# ZBC_FHE_TOOL_PATH=../zbc-fhe-tool
+#LOCAL_BUILD=false
+LOCAL_BUILD=true
+GOPRIVATE=github.com/zama-ai/*
diff --git a/.github/workflows/ci_e2e_test.yml b/.github/workflows/ci_e2e_test.yml
index 8b05e8f9..02305680 100644
--- a/.github/workflows/ci_e2e_test.yml
+++ b/.github/workflows/ci_e2e_test.yml
@@ -7,3 +7,140 @@ on:
description: 'Oracle Db service image tag (default: latest)'
type: string
required: false
+
+jobs:
+ docker:
+ runs-on: ubuntu-latest
+ env:
+ ORACLE_DB_SERVICE_TAG: ${{ inputs.oracle_db_service_tag }}
+ steps:
+ - name: Echo user parameters
+ run: |
+ echo "oracle_db_service_tag: ${{ inputs.oracle_db_service_tag }}"
+
+ - name: Install Node.js and npm
+ run: |
+ sudo apt update
+ sudo apt install nodejs
+ sudo apt install npm
+
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ path: evmos
+
+ - name: Get version for all needed repositories
+ working-directory: ./evmos
+ run: |
+ echo "ZBC_DEVELOPMENT_VERSION=$(./scripts/get_version_from_makefile.sh ZBC_DEVELOPMENT_VERSION)" >> $GITHUB_ENV
+ echo "TFHE_RS_VERSION=$(./scripts/get_version_from_makefile.sh TFHE_RS_VERSION)" >> $GITHUB_ENV
+ echo "ZBC_FHE_TOOL_VERSION=$(./scripts/get_version_from_makefile.sh ZBC_FHE_TOOL_VERSION)" >> $GITHUB_ENV
+ echo "ZBC_SOLIDITY_VERSION=$(./scripts/get_version_from_makefile.sh ZBC_SOLIDITY_VERSION)" >> $GITHUB_ENV
+ echo "ETHERMINT_VERSION=$(./scripts/get_module_version.sh go.mod zama.ai/ethermint)" >> $GITHUB_ENV
+ echo "GO_ETHEREUM_VERSION=$(./scripts/get_module_version.sh go.mod zama.ai/go-ethereum)" >> $GITHUB_ENV
+
+ - name: Echo versions parsed from Makefile and go.mod
+ run: |
+ echo "ZBC_DEVELOPMENT_VERSION: $ZBC_DEVELOPMENT_VERSION"
+ echo "TFHE_RS_VERSION: $TFHE_RS_VERSION"
+ echo "ZBC_FHE_TOOL_VERSION: $ZBC_FHE_TOOL_VERSION"
+ echo "ZBC_SOLIDITY_VERSION: $ZBC_SOLIDITY_VERSION"
+ echo "ETHERMINT_VERSION: $ETHERMINT_VERSION"
+ echo "GO_ETHEREUM_VERSION: $GO_ETHEREUM_VERSION"
+
+ - name: Checkout zbc-dev
+ uses: actions/checkout@v3
+ with:
+ repository: zama-ai/zbc-development
+ token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
+ path: ./evmos/work_dir/zbc-development
+ ref: ${{ env.ZBC_DEVELOPMENT_VERSION }}
+
+ - name: Checkout zbc-solidity
+ uses: actions/checkout@v3
+ with:
+ repository: zama-ai/zbc-solidity
+ token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
+ path: ./evmos/work_dir/zbc-solidity
+ ref: ${{ env.ZBC_SOLIDITY_VERSION }}
+
+ - name: Checkout tfhe-rs
+ uses: actions/checkout@v3
+ with:
+ repository: zama-ai/tfhe-rs
+ token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
+ path: ./evmos/work_dir/tfhe-rs
+ ref: ${{ env.TFHE_RS_VERSION }}
+
+ - name: Checkout zbc-fhe-tool
+ uses: actions/checkout@v3
+ with:
+ repository: zama-ai/zbc-fhe-tool
+ token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
+ path: ./evmos/work_dir/zbc-fhe-tool
+ ref: ${{ env.ZBC_FHE_TOOL_VERSION }}
+
+ - name: Checkout go-ethereum
+ uses: actions/checkout@v3
+ with:
+ repository: zama-ai/go-ethereum
+ token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
+ path: ./evmos/work_dir/go-ethereum
+ ref: ${{ env.GO_ETHEREUM_VERSION }}
+
+ - name: Checkout ethermint
+ uses: actions/checkout@v3
+ with:
+ repository: zama-ai/ethermint
+ token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
+ path: ./evmos/work_dir/ethermint
+ ref: ${{ env.ETHERMINT_VERSION }}
+
+ - name: List files in the repository
+ run: |
+ ls ${{ github.workspace }}
+
+ - name: List files in work_dir
+ working-directory: evmos/work_dir
+ run: |
+ ls
+
+ - name: Prepare files for node setup
+ working-directory: evmos/work_dir/zbc-development
+ run: |
+ mkdir -p node/evmos
+ cp ../../private.ed25519 node/evmos
+ cp ../../public.ed25519 node/evmos
+ touch vm.log
+ ls node/evmos
+
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Build local docker
+ working-directory: ./evmos
+ run: |
+ make build-docker
+
+ - name: Check docker images
+ working-directory: ./evmos
+ run: |
+ docker images
+
+ - name: Install @openzeppelin/contracts
+ working-directory: evmos/work_dir/zbc-solidity
+ run: |
+ npm install @openzeppelin/contracts
+
+ - name: Run e2e test
+ working-directory: ./evmos
+ run: |
+ ls ${{ github.workspace }}
+ ls work_dir
+ ls work_dir/zbc-fhe-tool
+ ls work_dir/zbc-fhe-tool/.git
+ make e2e-test
diff --git a/.github/workflows/deploy_full_node_aws.yml b/.github/workflows/deploy_full_node_aws.yml
index e7779818..b515c26a 100644
--- a/.github/workflows/deploy_full_node_aws.yml
+++ b/.github/workflows/deploy_full_node_aws.yml
@@ -23,6 +23,11 @@ on:
default: 'latest'
type: string
required: false
+ validator_ip_address:
+ description: 'The ip of the validator to be synced on (default: 13.37.31.214)'
+ default: '13.37.31.214'
+ type: string
+ required: false
clean:
description: 'Clean docker related components (default: true, false only for first deployment)'
default: true
@@ -144,7 +149,7 @@ jobs:
AWS_S3_BUCKET: zbc-testnet
run: |
aws s3 ls s3://${AWS_S3_BUCKET}/
- ./download_genesis.sh
+ ./download_genesis.sh ${{ inputs.validator_ip_address }}
- name: Prepare test (called demo)
working-directory: ./zbc-development
diff --git a/.github/workflows/deploy_validator_aws.yml b/.github/workflows/deploy_validator_aws.yml
index dfd6ff79..5b764f0c 100644
--- a/.github/workflows/deploy_validator_aws.yml
+++ b/.github/workflows/deploy_validator_aws.yml
@@ -3,21 +3,6 @@ name: Deploy validator on Aws
on:
workflow_dispatch:
inputs:
- ref_for_zbc_development:
- description: 'Branch, tag or commit SHA1 to zbc-development'
- required: true
- default: "main"
- type: string
- ref_to_evmos:
- description: 'Branch, tag or commit SHA1 to checkout evmos'
- required: true
- default: "v9.1.0-zama"
- type: string
- ref_to_zbc_solidity:
- description: 'Branch, tag or commit SHA1 to checkout zbc-solidity'
- required: true
- default: "feature/CI-testing"
- type: string
evmos_node_tag:
description: 'Evmos node image tag (default: latest)'
default: 'latest'
@@ -33,6 +18,11 @@ on:
default: true
type: boolean
required: false
+ run_test:
+ description: 'Run e2e test after deployment (default: true)'
+ default: true
+ type: boolean
+ required: false
jobs:
@@ -42,12 +32,12 @@ jobs:
if: ${{ inputs.clean }}
steps:
- name: Stop docker compose
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
- docker compose -f docker-compose.validator.yml down
+ docker compose -f docker-compose/docker-compose.validator.yml down
- name: Clean all docker related image, cache, container ...
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
docker system prune -af
@@ -62,9 +52,6 @@ jobs:
steps:
- name: Echo user parameters
run: |
- echo "ref_for_zbc_development: ${{ inputs.ref_for_zbc_development }}"
- echo "ref_to_evmos: ${{ inputs.ref_to_evmos }}"
- echo "ref_to_zbc_solidity: ${{ inputs.ref_to_zbc_solidity }}"
echo "evmos_node_tag: ${{ inputs.evmos_node_tag }}"
echo "oracle_db_service_tag: ${{ inputs.oracle_db_service_tag }}"
echo "clean: ${{ inputs.clean }}"
@@ -75,24 +62,25 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
- path: evmos
- ref: ${{ inputs.ref_to_evmos }}
-
- - name: Checkout zbc-dev
- uses: actions/checkout@v3
- with:
- repository: zama-ai/zbc-development
- token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- path: zbc-development
- ref: ${{ inputs.ref_for_zbc_development }}
+ path: evmos
+
+
+ - name: Get version for all needed repositories
+ working-directory: ./evmos
+ run: |
+ echo "ZBC_SOLIDITY_VERSION=$(./scripts/get_version_from_makefile.sh ZBC_SOLIDITY_VERSION)" >> $GITHUB_ENV
+
+ - name: Echo versions parsed from Makefile and go.mod
+ run: |
+ echo "ZBC_SOLIDITY_VERSION: $ZBC_SOLIDITY_VERSION"
- name: Checkout zbc-solidity
uses: actions/checkout@v3
with:
repository: zama-ai/zbc-solidity
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- path: zbc-solidity
- ref: ${{ inputs.ref_to_zbc_solidity }}
+ path: ./evmos/work_dir/zbc-solidity
+ ref: ${{ env.ZBC_SOLIDITY_VERSION }}
- name: List files in the repository
run: |
@@ -106,15 +94,15 @@ jobs:
aws-region: eu-west-3
- name: Download keys from S3
- working-directory: ./zbc-development
+ working-directory: ./evmos
env:
AWS_S3_BUCKET: zbc-testnet
run: |
- aws s3 ls s3://${AWS_S3_BUCKET}/users-fhe-keys/
- ./prepare_volumes_validator_ci.sh
+ aws s3 ls s3://${AWS_S3_BUCKET}
+ ./scripts/prepare_volumes_validator_ci.sh
- name: Prepare files for node setup
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
mkdir -p node/evmos
cp ../evmos/private.ed25519 node/evmos
@@ -123,7 +111,7 @@ jobs:
ls node/evmos
- name: List files in volumes
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
ls volumes
@@ -135,26 +123,26 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare evmos node aka run setup.sh
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
- docker compose -f docker-compose.validator.yml run validator bash /config/setup.sh
+ docker compose -f docker-compose/docker-compose.validator.yml run validator bash /config/setup.sh
- name: Check running node owner and change it
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
ls -all .
- sudo chown -R $USER:$USER running_node/
+ sudo chown -R $USER: running_node/
- - name: Prepare test (called demo)
- working-directory: ./zbc-development
+ - name: Prepare keys
+ working-directory: ./evmos
run: |
- ./prepare_demo_testnet_ci.sh
+ ./scripts/prepare_validator_ci.sh
- name: Start whole testnet
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
- docker compose -f docker-compose.validator.yml -f docker-compose.validator.override.yml up --detach
+ docker compose -f docker-compose/docker-compose.validator.yml -f docker-compose/docker-compose.validator.override.yml up --detach
- name: Check running docker
run: |
@@ -165,19 +153,30 @@ jobs:
sleep 5s
- name: List files in zbc-solidity
- working-directory: ./zbc-solidity
+ working-directory: evmos/work_dir/zbc-solidity
run: |
ls
- name: Upload genesis and node_id to S3 bucket to allow other nodes to sync
- working-directory: ./zbc-development
+ working-directory: ./evmos
env:
AWS_S3_BUCKET: zbc-testnet
run: |
aws s3 ls s3://${AWS_S3_BUCKET}/
- ./upload_genesis.sh
+ ./scripts/upload_genesis.sh
+
+ - name: Prepare/download fhe keys
+ working-directory: evmos/work_dir/zbc-solidity
+ run: |
+ ./ci/scripts/prepare_fhe_keys_ci.sh
+
+ - name: Install @openzeppelin/contracts
+ working-directory: evmos/work_dir/zbc-solidity
+ run: |
+ npm install @openzeppelin/contracts
- name: Run e2e test from zbc-solidty
- working-directory: ./zbc-solidity
+ if: ${{ inputs.run_test }}
+ working-directory: evmos/work_dir/zbc-solidity
run: |
- ./run_ci_test.sh mykey1
\ No newline at end of file
+ ./ci/scripts/run_ERC20_ci_test.sh mykey1 ../../
\ No newline at end of file
diff --git a/.github/workflows/publish_docker_evmos_node.yml b/.github/workflows/publish_docker_evmos_node.yml
index 04b0e943..eeac77b2 100644
--- a/.github/workflows/publish_docker_evmos_node.yml
+++ b/.github/workflows/publish_docker_evmos_node.yml
@@ -3,31 +3,6 @@ name: Publish Evmos node
on:
workflow_dispatch:
inputs:
- ref_to_get_dockerfile:
- description: 'Branch, tag or commit SHA1 to checkout Evmos (only to get right Dockerfile)'
- required: true
- default: "feature/CI"
- type: string
- ref_to_build_tfhe_rs_c_api:
- description: 'Branch, tag or commit SHA1 to checkout tfhe-rs'
- required: true
- default: "blockchain-demo-deterministic-fft"
- type: string
- ref_to_build_evmos:
- description: 'Branch, tag or commit SHA1 to checkout Evmos'
- required: true
- default: "feature/CI"
- type: string
- ref_to_build_go_ethereum:
- description: 'Branch, tag or commit SHA1 to checkout go-ethereum'
- required: true
- default: "petar/extensive-log"
- type: string
- ref_to_build_ethermint:
- description: 'Branch, tag or commit SHA1 to checkout Ethermint'
- required: true
- default: "v0.19.3-zama"
- type: string
zbc_build_image_tag:
description: 'Tag for zbc build docker image (defaul:latest)'
required: true
@@ -46,56 +21,57 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- - name: Echo user parameters
- run: |
- echo "ref_to_get_dockerfile: ${{ inputs.ref_to_get_dockerfile }}"
- echo "ref_to_build_tfhe_rs_c_api: ${{ inputs.ref_to_build_tfhe_rs_c_api }}"
- echo "ref_to_build_evmos: ${{ inputs.ref_to_build_evmos }}"
- echo "ref_to_build_go_ethereum: ${{ inputs.ref_to_build_go_ethereum }}"
- echo "ref_to_build_ethermint: ${{ inputs.ref_to_build_ethermint }}"
- echo "zbc_build_image_tag: ${{ inputs.zbc_build_image_tag }}"
- echo "evmos_node_tag: ${{ inputs.evmos_node_tag }}"
-
- - name: Check OS
- run: |
- lscpu
- uname -r
- lsb_release -a
-
- name: Checkout
uses: actions/checkout@v3
with:
- path: evmosDockerfile
- ref: ${{ inputs.ref_to_get_dockerfile }}
+ path: evmos
- - name: Check out tfhe-rs
- uses: actions/checkout@v3
- with:
- repository: zama-ai/tfhe-rs
- ref: ${{ inputs.ref_to_build_tfhe_rs_c_api }}
- path: tfhe-rs
+ - name: Get version for all needed repositories
+ working-directory: ./evmos
+ run: |
+ echo "ZBC_DEVELOPMENT_VERSION=$(./scripts/get_version_from_makefile.sh ZBC_DEVELOPMENT_VERSION)" >> $GITHUB_ENV
+ echo "TFHE_RS_VERSION=$(./scripts/get_version_from_makefile.sh TFHE_RS_VERSION)" >> $GITHUB_ENV
+ echo "ZBC_FHE_TOOL_VERSION=$(./scripts/get_version_from_makefile.sh ZBC_FHE_TOOL_VERSION)" >> $GITHUB_ENV
+ echo "ZBC_SOLIDITY_VERSION=$(./scripts/get_version_from_makefile.sh ZBC_SOLIDITY_VERSION)" >> $GITHUB_ENV
+ echo "ETHERMINT_VERSION=$(./scripts/get_module_version.sh go.mod zama.ai/ethermint)" >> $GITHUB_ENV
+ echo "GO_ETHEREUM_VERSION=$(./scripts/get_module_version.sh go.mod zama.ai/go-ethereum)" >> $GITHUB_ENV
+
+ - name: Echo versions parsed from Makefile and go.mod
+ run: |
+ echo "TFHE_RS_VERSION: $TFHE_RS_VERSION"
+ echo "ETHERMINT_VERSION: $ETHERMINT_VERSION"
+ echo "GO_ETHEREUM_VERSION: $GO_ETHEREUM_VERSION"
- - name: Checkout
+ - name: Checkout tfhe-rs
uses: actions/checkout@v3
with:
- path: evmos
- ref: ${{ inputs.ref_to_build_evmos }}
+ repository: zama-ai/tfhe-rs
+ token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
+ path: ./evmos/work_dir/tfhe-rs
+ ref: ${{ env.TFHE_RS_VERSION }}
- - name: PrepareGoEthereum
+ - name: Checkout go-ethereum
uses: actions/checkout@v3
with:
repository: zama-ai/go-ethereum
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- path: go-ethereum
- ref: ${{ inputs.ref_to_build_go_ethereum }}
+ path: ./evmos/work_dir/go-ethereum
+ ref: ${{ env.GO_ETHEREUM_VERSION }}
- - name: PrepareEthermint
+ - name: Checkout ethermint
uses: actions/checkout@v3
with:
repository: zama-ai/ethermint
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- path: ethermint
- ref: ${{ inputs.ref_to_build_ethermint }}
+ path: ./evmos/work_dir/ethermint
+ ref: ${{ env.ETHERMINT_VERSION }}
+
+
+ - name: Check OS
+ run: |
+ lscpu
+ uname -r
+ lsb_release -a
- name: List files in the repository
run: |
@@ -112,14 +88,10 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- - name: Build and push Docker image
- uses: docker/build-push-action@v2
- with:
- build-args: |
- ZBC_BUILD_IMAGE_TAG=${{ inputs.zbc_build_image_tag }}
- context: .
- file: evmosDockerfile/docker/Dockerfile.evmos-node.testnet
- push: true
- tags: ${{ env.DOCKER_IMAGE }}:${{ inputs.evmos_node_tag }},${{ env.DOCKER_IMAGE }}:latest
- labels: evmos_node
-
+ - name: Build local docker
+ working-directory: ./evmos
+ run: |
+ make build-docker
+ docker tag evmos-node:latest ${{ env.DOCKER_IMAGE }}:${{ inputs.evmos_node_tag }}
+ docker tag evmos-node:latest ${{ env.DOCKER_IMAGE }}:latest
+ docker push ${{ env.DOCKER_IMAGE }} --all-tags
diff --git a/.github/workflows/run_e2e_test.yml b/.github/workflows/run_e2e_test.yml
index c5a09449..0a890b3e 100644
--- a/.github/workflows/run_e2e_test.yml
+++ b/.github/workflows/run_e2e_test.yml
@@ -11,6 +11,11 @@ on:
description: 'Oracle Db service image tag (default: latest)'
type: string
required: false
+ ref_to_zbc_solidity:
+ description: 'Branch, tag or commit SHA1 to checkout zbc-solidity'
+ required: true
+ default: "feature/test-m1"
+ type: string
jobs:
docker:
@@ -18,33 +23,38 @@ jobs:
env:
EVMOS_NODE_TAG: ${{ inputs.evmos_node_tag }}
ORACLE_DB_SERVICE_TAG: ${{ inputs.oracle_db_service_tag }}
+ LOCAL_BUILD: "false"
steps:
- name: Echo user parameters
run: |
echo "evmos_node_tag: ${{ inputs.evmos_node_tag }}"
echo "oracle_db_service_tag: ${{ inputs.oracle_db_service_tag }}"
+ echo "ref_to_zbc_solidity: ${{ inputs.ref_to_zbc_solidity }}"
+
+ - name: Install npm
+ run: |
+ sudo apt update
+ sudo apt install npm
- name: Checkout
uses: actions/checkout@v3
with:
path: evmos
- ref: feature/CI
-
- - name: Checkout zbc-dev
- uses: actions/checkout@v3
- with:
- repository: zama-ai/zbc-development
- token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- path: zbc-development
- ref: testnet-from-CI-images
+
+ - name: Update .env to trigger build from registry
+ working-directory: ./evmos
+ run: |
+ sed -i 's/LOCAL_BUILD=true/LOCAL_BUILD=false/g' .env
+ grep LOCAL_BUILD .env
+
- name: Checkout zbc-solidity
uses: actions/checkout@v3
with:
repository: zama-ai/zbc-solidity
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
- path: zbc-solidity
- ref: feature/CI-testing
+ path: ./evmos/work_dir/zbc-solidity
+ ref: ${{ inputs.ref_to_zbc_solidity }}
- name: List files in the repository
run: |
@@ -58,15 +68,15 @@ jobs:
aws-region: eu-west-3
- name: Download keys from S3
- working-directory: ./zbc-development
+ working-directory: ./evmos
env:
AWS_S3_BUCKET: zbc-testnet
run: |
- aws s3 ls s3://${AWS_S3_BUCKET}/users-fhe-keys/
- ./prepare_volumes_ci.sh
+ aws s3 ls s3://${AWS_S3_BUCKET}
+ ./scripts/prepare_volumes_validator_ci.sh
- name: Prepare files for node setup
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
mkdir -p node/evmos
cp ../evmos/private.ed25519 node/evmos
@@ -75,7 +85,7 @@ jobs:
ls node/evmos
- name: List files in volumes
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
ls volumes
@@ -87,26 +97,26 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare evmos node aka run setup.sh
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
- docker compose -f docker-compose.validator.yml run validator bash /config/setup.sh
+ docker compose -f docker-compose/docker-compose.validator.yml run validator bash /config/setup.sh
- name: Check running node owner and change it
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
ls -all .
- sudo chown -R runner:docker running_node/
+ sudo chown -R $USER: running_node/
- - name: Prepare test (called demo)
- working-directory: ./zbc-development
+ - name: Prepare keys
+ working-directory: ./evmos
run: |
- ./prepare_demo_testnet_ci.sh
+ ./scripts/prepare_validator_ci.sh
- name: Start whole testnet
- working-directory: ./zbc-development
+ working-directory: ./evmos
run: |
- docker compose -f docker-compose.validator.yml -f docker-compose.validator.override.yml up --detach
+ docker compose -f docker-compose/docker-compose.validator.yml -f docker-compose/docker-compose.validator.override.yml up --detach
- name: Check running docker
run: |
@@ -114,24 +124,24 @@ jobs:
- name: Sleep for 3 seconds to ensure validtor is running
run: |
- sleep 10s
-
- - name: Set dummy mode
- working-directory: ./zbc-development
- run: |
- docker compose -f docker-compose.validator.yml exec validator curl http://zkpok:23042/configure/mode/dummy
+ sleep 5s
- name: List files in zbc-solidity
- working-directory: ./zbc-solidity
+ working-directory: evmos/work_dir/zbc-solidity
run: |
ls
- - name: Run e2e test from zbc-solidty
- working-directory: ./zbc-solidity
+ - name: Prepare/download fhe keys
+ working-directory: evmos/work_dir/zbc-solidity
+ run: |
+ ./ci/scripts/prepare_fhe_keys_ci.sh
+
+ - name: Install @openzeppelin/contracts
+ working-directory: evmos/work_dir/zbc-solidity
run: |
- ./run_ci_test.sh mykey1
+ npm install @openzeppelin/contracts
- - name: Stop whole testnet
- working-directory: ./zbc-development
+ - name: Run e2e test from zbc-solidty
+ working-directory: evmos/work_dir/zbc-solidity
run: |
- docker compose -f docker-compose.validator.yml -f docker-compose.validator.override.yml down
+ ./ci/scripts/run_ERC20_ci_test.sh mykey1 ../../
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 5d403c59..722ac281 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@ secret.yml
artifacts/*
tmp-swagger-gen
github.com/
+go.mod.updated
# vue/
# Local docker volume mappings
diff --git a/Development.md b/Development.md
new file mode 100644
index 00000000..ebd15836
--- /dev/null
+++ b/Development.md
@@ -0,0 +1,144 @@
+# How to build evmosd binary on your own machine
+
+## Dependencies:
+
+Evmosd binary is compiled based on three other repositories.
+
+### Tfhe-rs
+
+All the tfhe operations are implemented in this repository. As go-ethereum is written in go we are
+calling FHE operations through cgo. So we need to compile a c_api library using this repository.
+
+
+
+ Custom repository
+
+To use an existing repository please update the environment file **.env** with the path to it or export it:
+```bash
+export TFHE_RS_PATH=../tfhe-rs
+```
+
+
+ Add it for me!
+
+
+If you want to install it automatically, you can override the default tfhe-rs version by setting TFHE_RS_VERSION env variable and running:
+```
+export TFHE_RS_VERSION=0.2.4
+make install-tfhe-rs
+```
+
+
+
+## Build
+
+Once we are sure TFHE_RS_PATH is correct let's build it
+
+### Local build
+
+```bash
+make build-local
+```
+
+## Using docker
+
+Here are the steps executed automatically:
+- Build a base image (or retrieve it from ghcr.io) called __zama-zbc-build__.
+
+
+- Check tfhe-rs is available in TFHE_RS_PATH (default is work_dir/tfhe-rs)
+- In any case the custom version or the cloned (TFHE_RS_VERSION) one is copied into work_dir/tfhe-rs
+- Clone go-ethereum and ethermint to work_dir (version are parsed from go.mod to avoid handling ssh keys inside docker because those repositories are private)
+- Update go.mod to make it use local repositories (related to the just above change)
+- Build a docker called __evmosnodelocal__.
+
+```bash
+make build-local-docker
+```
+
+If everything work correctly you should have:
+
+```bash
+ls work_dir/
+ethermint go-ethereum tfhe-rs
+```
+
+And the following images:
+
+```bash
+docker images
+REPOSITORY TAG IMAGE ID CREATED SIZE
+evmosnodelocal latest 04a5b55c8d9c 10 minutes ago 2.22GB
+zama-zbc-build latest c280fb388ab5 12 minutes ago 1.99GB
+golang bullseye 342faadef914 5 days ago 777MB
+```
+
+### Check wich version/tag/commit has been used
+
+```bash
+make print-info
+GO_ETHEREUM_TAG: v1.0.1-test ---extracted from go.mod
+ETHERMINT_TAG: v1.0.0-test ---extracted from go.mod
+...
+
+```
+
+
+
+
+ Troubleshoot ghcr.io
+
+Here is a tutorial on [how to manage ghcr.io access](https://github.com/zama-ai/zbc-fhe-tool#using-the-published-image-easiest-way).
+
+ If you get trouble to pull image from ghcri.io, one can build it locally with
+ ```bash
+ docker build . -t zama-zbc-build -f docker/Dockerfile.zbc.build
+ ```
+
+
+
+ Troubleshoot go modules
+
+Because evmos depends on private [go-ethereum](https://github.com/zama-ai/go-ethereum) and [ethermint](https://github.com/zama-ai/ethermint) repositories, one need to pay attention to two points to allow go modules manager to work correctly.
+
+1. Check that GOPRIVATE is set to __github.com/zama-ai/*__ (normally this env variable is set by default in Makefile)
+2. Check you have the following lines in your gitconfig files:
+
+```bash
+[url "ssh://git@github.com/"]
+ insteadOf = https://github.com/
+```
+
+
+
+
+## Run e2e test
+
+To be able to run the e2e, first build the evmos local node image explained in the first part.
+
+```bash
+make build-local-docker
+```
+
+Then
+
+```bash
+make e2e-test-local
+```
+Every repositories are cloned into **work_dir**.
+
+This test will:
+- check you have all the needed repositories
+ - zbc-fhe-tool
+ - zbc-solidity
+ - zbc-development
+- init evmos node by calling /config/setup.sh file
+- generate fhe keys using zbc-fhe-tool based on $(ZBC_DEVELOPMENT_PATH)/prepare_volumes_from_fhe_tool.sh script
+- copy them at the right folder using $(ZBC_DEVELOPMENT_PATH)/prepare_demo_local.sh script
+- start validator and oracle db using docker-compose/docker-compose.local.yml file
+- run the e2e test
+ - copy pks to encrypt user input using $(ZBC_SOLIDITY_PATH)/prepare_fhe_keys_from_fhe_tool script
+ - start the test using $(ZBC_SOLIDITY_PATH)/run_local_test_from_evmos.sh
+ - Get the private key of main account
+ - Give it to the python test script $(ZBC_SOLIDITY_PATH)/demo_test_high_level_fhe_tool
+
diff --git a/Dockerfile b/Dockerfile
index 371ba631..19f4ffb3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,23 +1,20 @@
-FROM golang:stretch AS build-env
+FROM golang:1.20.4-bullseye AS build-env
WORKDIR /go/src/github.com/evmos/evmos
-RUN apt-get update -y
-RUN apt-get install git -y
-
COPY . .
RUN make build
-FROM golang:stretch
+FROM golang:1.20.4-bullseye
-RUN apt-get update -y
-RUN apt-get install ca-certificates jq -y
+RUN apt-get update \
+ && apt-get install ca-certificates jq=1.6-2.1 -y --no-install-recommends
WORKDIR /root
COPY --from=build-env /go/src/github.com/evmos/evmos/build/evmosd /usr/bin/evmosd
-EXPOSE 26656 26657 1317 9090
+EXPOSE 26656 26657 1317 9090 8545 8546
-CMD ["evmosd"]
+CMD ["evmosd"]
\ No newline at end of file
diff --git a/Makefile b/Makefile
index cbcc41fe..7dfeb026 100755
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
#!/usr/bin/make -f
+include .env
+
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
DIFF_TAG=$(shell git rev-list --tags="v*" --max-count=1 --not $(shell git rev-list --tags="v*" "HEAD..origin"))
@@ -7,6 +9,7 @@ DEFAULT_TAG=$(shell git rev-list --tags="v*" --max-count=1)
VERSION ?= $(shell echo $(shell git describe --tags $(or $(DIFF_TAG), $(DEFAULT_TAG))) | sed 's/^v//')
TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
COMMIT := $(shell git log -1 --format='%H')
+HOST_ARCH := $(shell uname -m)
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin
EVMOS_BINARY = evmosd
@@ -15,12 +18,41 @@ BUILDDIR ?= $(CURDIR)/build
SIMAPP = ./app
HTTPS_GIT := https://github.com/evmos/evmos.git
DOCKER := $(shell which docker)
+SUDO := $(shell which sudo)
+ifneq ($(shell grep docker /proc/1/cgroup -qa),)
+ SUDO :=
+endif
+
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
NAMESPACE := tharsishq
PROJECT := evmos
DOCKER_IMAGE := $(NAMESPACE)/$(PROJECT)
COMMIT_HASH := $(shell git rev-parse --short=7 HEAD)
DOCKER_TAG := $(COMMIT_HASH)
+WORKDIR ?= $(CURDIR)/work_dir
+# Needed as long as go-ethereum and ethermint are private repositories
+GOPRIVATE = github.com/zama-ai/*
+
+TFHE_RS_PATH ?= $(WORKDIR)/tfhe-rs
+TFHE_RS_EXISTS := $(shell test -d $(TFHE_RS_PATH)/.git && echo "true" || echo "false")
+TFHE_RS_VERSION ?= 1d817c45d5234bcf33638406191b656998b30c2a
+
+
+ZBC_FHE_TOOL_PATH ?= $(WORKDIR)/zbc-fhe-tool
+ZBC_FHE_TOOL_PATH_EXISTS := $(shell test -d $(ZBC_FHE_TOOL_PATH)/.git && echo "true" || echo "false")
+ZBC_FHE_TOOL_VERSION ?= v0.1.0
+
+ZBC_ORACLE_DB_PATH ?= $(WORKDIR)/zbc-oracle-db
+ZBC_ORACLE_DB_PATH_EXISTS := $(shell test -d $(ZBC_ORACLE_DB_PATH)/.git && echo "true" || echo "false")
+ZBC_ORACLE_DB_VERSION ?= main
+
+ZBC_SOLIDITY_PATH ?= $(WORKDIR)/zbc-solidity
+ZBC_SOLIDITY_PATH_EXISTS := $(shell test -d $(ZBC_SOLIDITY_PATH)/.git && echo "true" || echo "false")
+ZBC_SOLIDITY_VERSION ?= v0.1.0
+
+ETHERMINT_VERSION := $(shell ./scripts/get_module_version.sh go.mod zama.ai/ethermint)
+GO_ETHEREUM_VERSION := $(shell ./scripts/get_module_version.sh go.mod zama.ai/go-ethereum)
+UPDATE_GO_MOD = go.mod.updated
export GO111MODULE = on
@@ -115,56 +147,333 @@ endif
BUILD_TARGETS := build install
-build: BUILD_ARGS=-o $(BUILDDIR)/
+print-info:
+ @echo 'GO_ETHEREUM_TAG: $(GO_ETHEREUM_VERSION) ---extracted from go.mod'
+ @echo 'ETHERMINT_TAG: $(ETHERMINT_VERSION) ---extracted from go.mod'
+ @bash scripts/get_repository_info.sh evmos ${CURDIR}
+ @bash scripts/get_repository_info.sh tfhe-rs $(TFHE_RS_PATH)
+ @bash scripts/get_repository_info.sh zbc-fhe-tool $(ZBC_FHE_TOOL_PATH)
+ @bash scripts/get_repository_info.sh zbc-solidity $(ZBC_SOLIDITY_PATH)
+
+build_c_api_tfhe:
+ $(info build tfhe-rs C API)
+ mkdir -p $(WORKDIR)/
+ $(info tfhe-rs path $(TFHE_RS_PATH))
+ $(info sudo_bin $(SUDO_BIN))
+ cd $(TFHE_RS_PATH) && RUSTFLAGS="" make build_c_api_experimental_deterministic_fft
+ ls $(TFHE_RS_PATH)/target/release
+# In tfhe.go the library path is specified as following : #cgo LDFLAGS: -L/usr/lib/tfhe -ltfhe
+ $(SUDO) cp $(TFHE_RS_PATH)/target/release/tfhe.h /usr/include/
+ $(SUDO) cp $(TFHE_RS_PATH)/target/release/libtfhe.* /usr/lib/
+
+build:
+ BUILD_ARGS=-o $(BUILDDIR)
+ $(info build)
+
build-linux:
+ $(info build-linux)
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build
-$(BUILD_TARGETS): go.sum $(BUILDDIR)/
- go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./...
+build-local: check-tfhe-rs go.sum build_c_api_tfhe $(BUILDDIR)/
+ $(info build-local)
+ go build $(BUILD_FLAGS) -o build $(BUILD_ARGS) ./...
+ @echo 'evmosd binary is ready in build folder'
+
+
+# $(BUILD_TARGETS): go.sum $(BUILDDIR)/
+$(BUILD_TARGETS): go.sum build_c_api_tfhe $(BUILDDIR)/
+ $(info BUILD_TARGETS)
+ go $@ $(BUILD_FLAGS) -o build $(BUILD_ARGS) ./...
+
+check-tfhe-rs: $(WORKDIR)/
+ $(info check-tfhe-rs)
+ifeq ($(TFHE_RS_EXISTS), true)
+ @echo "Tfhe-rs exists in $(TFHE_RS_PATH)"
+ @if [ ! -d $(WORKDIR)/tfhe-rs ]; then \
+ echo 'tfhe-rs is not available in $(WORKDIR)'; \
+ echo "TFHE_RS_PATH is set to a custom value"; \
+ echo 'Copy local version located in $(TFHE_RS_PATH) into $(WORKDIR)'; \
+ cp -r $(TFHE_RS_PATH) $(WORKDIR)/; \
+ else \
+ echo 'tfhe-rs is already available in $(WORKDIR)'; \
+ fi
+else
+ @echo "Tfhe-rs does not exist"
+ echo "We clone it for you!"
+ echo "If you want your own version please update TFHE_RS_PATH pointing to your tfhe-rs folder!"
+ $(MAKE) clone_tfhe_rs
+endif
+
+check-zbc-solidity: $(WORKDIR)/
+ $(info check-zbc-solidity)
+ifeq ($(ZBC_SOLIDITY_PATH_EXISTS), true)
+ @echo "zbc-solidity exists in $(ZBC_SOLIDITY_PATH)"
+ @if [ ! -d $(WORKDIR)/zbc-solidity ]; then \
+ echo 'zbc-solidity is not available in $(WORKDIR)'; \
+ echo "ZBC_SOLIDITY_PATH is set to a custom value"; \
+ else \
+ echo 'zbc-solidity is already available in $(WORKDIR)'; \
+ fi
+else
+ @echo "zbc-solidity does not exist"
+ echo "We clone it for you!"
+ echo "If you want your own version please update ZBC_SOLIDITY_PATH pointing to your zbc-solidity folder!"
+ $(MAKE) clone_zbc_solidty
+endif
+
+check-zbc-oracle-db: $(WORKDIR)/
+ $(info check-zbc-oracle-db)
+ifeq ($(ZBC_ORACLE_DB_PATH_EXISTS), true)
+ @echo "zbc-oracle-db exists in $(ZBC_ORACLE_DB_PATH)"
+ @if [ ! -d $(WORKDIR)/zbc-oracle-db ]; then \
+ echo 'zbc-oracle-db is not available in $(WORKDIR)'; \
+ echo "ZBC_ORACLE_DB_PATH is set to a custom value"; \
+ else \
+ echo 'zbc-oracle-db is already available in $(WORKDIR)'; \
+ fi
+else
+ @echo "zbc-oracle-db does not exist"
+ echo "We clone it for you!"
+ echo "If you want your own version please update ZBC_ORACLE_DB_PATH pointing to your zbc-oracle-db folder!"
+ $(MAKE) clone_zbc_oracle_db
+endif
+
+
+check-zbc-fhe-tool: $(WORKDIR)/
+ $(info check-zbc-fhe-tool)
+ @echo "ZBC_FHE_TOOL_PATH_EXISTS $(ZBC_FHE_TOOL_PATH_EXISTS)"
+ifeq ($(ZBC_FHE_TOOL_PATH_EXISTS), true)
+ @echo "zbc-fhe-tool exists in $(ZBC_FHE_TOOL_PATH)"
+ @if [ ! -d $(WORKDIR)/zbc-fhe-tool ]; then \
+ echo 'zbc-fhe-tool is not available in $(WORKDIR)'; \
+ echo "ZBC_FHE_TOOL_PATH is set to a custom value"; \
+ else \
+ echo 'zbc-fhe-tool is already available in $(WORKDIR)'; \
+ fi
+else
+ @echo "zbc-fhe-tool does not exist in $(ZBC_FHE_TOOL_PATH)"
+ echo "We clone it for you!"
+ echo "If you want your own version please update ZBC_FHE_TOOL_PATH pointing to your zbc-fhe-tool folder!"
+ $(MAKE) clone_zbc_fhe_tool
+endif
+ echo 'Call build zbc fhe'
+ $(MAKE) build_zbc_fhe_tool
+
+
+
+install-tfhe-rs: clone_tfhe_rs
+
+build_zbc_fhe_tool:
+ifeq ($(HOST_ARCH), x86_64)
+ @echo 'Arch is x86'
+ @ARCH_TO_BUIL_ZBC_FHE_TOOL=$$(cd $(ZBC_FHE_TOOL_PATH) && ./scripts/get_arch.sh) && cd $(ZBC_FHE_TOOL_PATH) && cargo build --release --features tfhe/$${ARCH_TO_BUIL_ZBC_FHE_TOOL}
+else
+ @echo 'Arch is not x86'
+ @ARCH_TO_BUIL_ZBC_FHE_TOOL=$$(cd $(ZBC_FHE_TOOL_PATH) && ./scripts/get_arch.sh) && cd $(ZBC_FHE_TOOL_PATH) && cargo +nightly build --release --features tfhe/$${ARCH_TO_BUIL_ZBC_FHE_TOOL}
+endif
+
+clone_zbc_fhe_tool: $(WORKDIR)/
+ $(info Cloning zbc-fhe-tool version $(ZBC_FHE_TOOL_VERSION))
+ cd $(WORKDIR) && git clone git@github.com:zama-ai/zbc-fhe-tool.git
+ cd $(WORKDIR)/zbc-fhe-tool && git checkout $(ZBC_FHE_TOOL_VERSION)
+
+clone_zbc_solidty: $(WORKDIR)/
+ $(info Cloning zbc-solidity version $(ZBC_SOLIDITY_VERSION))
+ cd $(WORKDIR) && git clone git@github.com:zama-ai/zbc-solidity.git
+ cd $(WORKDIR)/zbc-solidity && git checkout $(ZBC_SOLIDITY_VERSION)
+
+clone_tfhe_rs: $(WORKDIR)/
+ $(info Cloning tfhe-rs version $(TFHE_RS_VERSION))
+ cd $(WORKDIR) && git clone git@github.com:zama-ai/tfhe-rs.git
+ cd $(WORKDIR)/tfhe-rs && git checkout $(TFHE_RS_VERSION)
+
+clone_zbc_oracle_db: $(WORKDIR)/
+ $(info Cloning zbc-oracle-db version $(ZBC_ORACLE_DB_VERSION))
+ cd $(WORKDIR) && git clone git@github.com:zama-ai/zbc-oracle-db.git
+ cd $(WORKDIR)/zbc-oracle-db && git checkout $(ZBC_ORACLE_DB_VERSION)
+
+clone_go_ethereum: $(WORKDIR)/
+ $(info Cloning Go-ethereum version $(GO_ETHEREUM_VERSION))
+ @if [ -d "$(WORKDIR)/go-ethereum" ] && [ "$(ls -A $(WORKDIR)/go-ethereum)" ]; then \
+ echo "$(WORKDIR)/go-ethereum already exists and is not empty. Skipping git clone."; \
+ else \
+ cd $(WORKDIR) && git clone git@github.com:zama-ai/go-ethereum.git; \
+ cd $(WORKDIR)/go-ethereum && git checkout $(GO_ETHEREUM_VERSION); \
+ fi
+
+
+clone_ethermint: $(WORKDIR)/
+ $(info Cloning Ethermint version $(ETHERMINT_VERSION))
+ @if [ -d "$(WORKDIR)/ethermint" ] && [ "$(ls -A $(WORKDIR)/ethermint)" ]; then \
+ echo "$(WORKDIR)/ethermint already exists and is not empty. Skipping git clone."; \
+ else \
+ cd $(WORKDIR) && git clone git@github.com:zama-ai/ethermint.git; \
+ cd $(WORKDIR)/ethermint && git checkout $(ETHERMINT_VERSION); \
+ fi
+
+$(WORKDIR)/:
+ $(info WORKDIR)
+ mkdir -p $(WORKDIR)
+
+check-all-test-repo: check-zbc-fhe-tool check-zbc-solidity
+
+update-go-mod:
+ @cp go.mod $(UPDATE_GO_MOD)
+ @bash scripts/replace_go_mod.sh $(UPDATE_GO_MOD) go-ethereum
+ @bash scripts/replace_go_mod.sh $(UPDATE_GO_MOD) ethermint
+
$(BUILDDIR)/:
- mkdir -p $(BUILDDIR)/
+ $(info BUILDDIR)
+ mkdir -p $(BUILDDIR)
-build-reproducible: go.sum
- $(DOCKER) rm latest-build || true
- $(DOCKER) run --volume=$(CURDIR):/sources:ro \
- --env TARGET_PLATFORMS='linux/amd64' \
- --env APP=evmosd \
- --env VERSION=$(VERSION) \
- --env COMMIT=$(COMMIT) \
- --env CGO_ENABLED=1 \
- --env LEDGER_ENABLED=$(LEDGER_ENABLED) \
- --name latest-build tendermintdev/rbuilder:latest
- $(DOCKER) cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
+build-base-image:
+ @echo 'Build base image with go and rust tools'
+ @docker build . -f docker/Dockerfile.zbc.build -t zama-zbc-build:latest
+
+
+build-local-docker:
+ifeq ($(GITHUB_ACTIONS),true)
+ $(info Running in a GitHub Actions workflow)
+else
+ $(info Not running in a GitHub Actions workflow)
+ @$(MAKE) build-base-image
+ @$(MAKE) clone_go_ethereum
+ @$(MAKE) clone_ethermint
+endif
+ $(MAKE) update-go-mod
+ $(MAKE) check-tfhe-rs
+ @docker compose -f docker-compose/docker-compose.local.yml build evmosnodelocal
build-docker:
- # TODO replace with kaniko
- $(DOCKER) build -t ${DOCKER_IMAGE}:${DOCKER_TAG} .
- $(DOCKER) tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
- # docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:${COMMIT_HASH}
- # update old container
- $(DOCKER) rm evmos || true
- # create a new container from the latest image
- $(DOCKER) create --name evmos -t -i ${DOCKER_IMAGE}:latest evmos
- # move the binaries to the ./build directory
- mkdir -p ./build/
- $(DOCKER) cp evmos:/usr/bin/evmosd ./build/
-
-push-docker: build-docker
- $(DOCKER) push ${DOCKER_IMAGE}:${DOCKER_TAG}
- $(DOCKER) push ${DOCKER_IMAGE}:latest
-
-$(MOCKS_DIR):
- mkdir -p $(MOCKS_DIR)
-
-distclean: clean tools-clean
-
-clean:
+ifeq ($(LOCAL_BUILD),true)
+ $(info LOCAL_BUILD is set, build from sources)
+ @$(MAKE) build-local-docker
+else
+ $(info LOCAL_BUILD is not set, use docker registry for docker images)
+ @$(MAKE) build-from-registry
+endif
+
+
+
+build-from-registry:
+ echo 'Nothing to do'
+
+
+generate_fhe_keys:
+ @echo 'generate_fhe_keys'
+ # Generate fhe global keys and copy into volumes
+ @bash ./scripts/prepare_volumes_from_fhe_tool.sh $(ZBC_FHE_TOOL_PATH)/target/release
+
+
+run_evmos:
+ifeq ($(LOCAL_BUILD),true)
+ $(info LOCAL_BUILD is set, run locally built docker images)
+ @docker compose -f docker-compose/docker-compose.local.yml -f docker-compose/docker-compose.local.override.yml up --detach
+else
+ $(info LOCAL_BUILD is not set, run docker images from docker registry)
+ @docker compose -f docker-compose/docker-compose.validator.yml -f docker-compose/docker-compose.validator.override.yml up --detach
+endif
+ @echo 'sleep a little to let the docker start up'
+ sleep 10
+
+stop_evmos:
+ifeq ($(LOCAL_BUILD),true)
+ $(info LOCAL_BUILD is set, run locally built docker images)
+ @docker compose -f docker-compose/docker-compose.local.yml down
+else
+ $(info LOCAL_BUILD is not set, run docker images from docker registry)
+ @docker compose -f docker-compose/docker-compose.validator.yml down
+endif
+
+run_e2e_test:
+ @cd $(ZBC_SOLIDITY_PATH) && ci/scripts/prepare_fhe_keys_for_e2e_test.sh $(CURDIR)/volumes/network-public-fhe-keys
+ @cd $(ZBC_SOLIDITY_PATH) && npm install @openzeppelin/contracts
+ifeq ($(LOCAL_BUILD),true)
+ $(info LOCAL_BUILD is set)
+ @cd $(ZBC_SOLIDITY_PATH) && ci/scripts/run_ERC20_e2e_test.sh mykey1 $(CURDIR)
+else
+ $(info LOCAL_BUILD is not set)
+ @cd $(ZBC_SOLIDITY_PATH) && ci/scripts/run_ERC20_ci_test.sh mykey1 $(CURDIR)
+endif
+ @sleep 5
+
+
+
+change_running_node_owner:
+ifeq ($(GITHUB_ACTIONS),true)
+ $(info Running e2e-test-local in a GitHub Actions workflow)
+ sudo chown -R runner:docker running_node/
+else
+ $(info Not running e2e-test-local in a GitHub Actions workflow)
+ @$(SUDO) chown -R $(USER): running_node/
+endif
+
+
+e2e-test-local:
+ $(MAKE) init-evmos-node-local
+ $(MAKE) run_evmos
+ $(MAKE) run_e2e_test
+ $(MAKE) stop_evmos
+
+
+e2e-test-from-registry:
+ $(MAKE) init-evmos-node-from-registry
+ $(MAKE) run_evmos
+ $(MAKE) run_e2e_test
+ $(MAKE) stop_evmos
+
+
+e2e-test:
+ @$(MAKE) check-all-test-repo
+ifeq ($(LOCAL_BUILD),true)
+ $(info LOCAL_BUILD is set, run e2e test from locally built docker images)
+ @$(MAKE) e2e-test-local
+else
+ $(info LOCAL_BUILD is not set, use docker registry for docker images)
+ @$(MAKE) e2e-test-from-registry
+endif
+
+init-evmos-node-local:
+ @docker compose -f docker-compose/docker-compose.local.yml run evmosnodelocal bash /config/setup.sh
+ $(MAKE) change_running_node_owner
+ $(MAKE) generate_fhe_keys
+ @bash ./scripts/prepare_demo_local.sh
+
+init-evmos-node-from-registry:
+ mkdir -p node/evmos
+ cp private.ed25519 node/evmos
+ cp public.ed25519 node/evmos
+ @docker compose -f docker-compose/docker-compose.validator.yml run validator bash /config/setup.sh
+ $(MAKE) change_running_node_owner
+ $(MAKE) generate_fhe_keys
+ bash ./scripts/prepare_validator_ci.sh
+
+init-evmos-node:
+ @$(MAKE) check-all-test-repo
+ifeq ($(LOCAL_BUILD),true)
+ $(info LOCAL_BUILD is set, run e2e test from locally built docker images)
+ @$(MAKE) init-evmos-node-local
+else
+ $(info LOCAL_BUILD is not set, use docker registry for docker images)
+ @$(MAKE) init-evmos-node-from-registry
+endif
+
+clean-node-storage:
+ @echo 'clean node storage'
+ sudo rm -rf running_node
+
+clean: clean-node-storage
+ $(MAKE) stop_evmos
rm -rf \
$(BUILDDIR)/ \
artifacts/ \
- tmp-swagger-gen/
+ tmp-swagger-gen/ \
+ $(WORKDIR)/ \
+ build
+ rm -f $(UPDATE_GO_MOD)
+
all: build
@@ -270,146 +579,6 @@ go.sum: go.mod
go mod verify
go mod tidy
-###############################################################################
-### Documentation ###
-###############################################################################
-
-update-swagger-docs: statik
- $(BINDIR)/statik -src=client/docs/swagger-ui -dest=client/docs -f -m
- @if [ -n "$(git status --porcelain)" ]; then \
- echo "\033[91mSwagger docs are out of sync!!!\033[0m";\
- exit 1;\
- else \
- echo "\033[92mSwagger docs are in sync\033[0m";\
- fi
-.PHONY: update-swagger-docs
-
-godocs:
- @echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/evmos/evmos/types"
- godoc -http=:6060
-
-# Start docs site at localhost:8080
-docs-serve:
- @cd docs && \
- yarn && \
- yarn run serve
-
-# Build the site into docs/.vuepress/dist
-build-docs:
- @$(MAKE) docs-tools-stamp && \
- cd docs && \
- yarn && \
- yarn run build
-
-# This builds a docs site for each branch/tag in `./docs/versions`
-# and copies each site to a version prefixed path. The last entry inside
-# the `versions` file will be the default root index.html.
-build-docs-versioned:
- @$(MAKE) docs-tools-stamp && \
- cd docs && \
- while read -r branch path_prefix; do \
- (git checkout $${branch} && npm install && VUEPRESS_BASE="/$${path_prefix}/" npm run build) ; \
- mkdir -p ~/output/$${path_prefix} ; \
- cp -r .vuepress/dist/* ~/output/$${path_prefix}/ ; \
- cp ~/output/$${path_prefix}/index.html ~/output ; \
- done < versions ;
-
-.PHONY: docs-serve build-docs build-docs-versioned
-
-###############################################################################
-### Tests & Simulation ###
-###############################################################################
-
-test: test-unit
-test-all: test-unit test-race
-PACKAGES_UNIT=$(shell go list ./...)
-TEST_PACKAGES=./...
-TEST_TARGETS := test-unit test-unit-cover test-race
-
-# Test runs-specific rules. To add a new test target, just add
-# a new rule, customise ARGS or TEST_PACKAGES ad libitum, and
-# append the new rule to the TEST_TARGETS list.
-test-unit: ARGS=-timeout=10m -race
-test-unit: TEST_PACKAGES=$(PACKAGES_UNIT)
-
-test-race: ARGS=-race
-test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION)
-$(TEST_TARGETS): run-tests
-
-test-unit-cover: ARGS=-timeout=10m -race -coverprofile=coverage.txt -covermode=atomic
-test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)
-
-run-tests:
-ifneq (,$(shell which tparse 2>/dev/null))
- go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse
-else
- go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
-endif
-
-test-import:
- @go test ./tests/importer -v --vet=off --run=TestImportBlocks --datadir tmp \
- --blockchain blockchain
- rm -rf tests/importer/tmp
-
-test-rpc:
- ./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"
-
-test-rpc-pending:
- ./scripts/integration-test-all.sh -t "pending" -q 1 -z 1 -s 2 -m "pending" -r "true"
-
-.PHONY: run-tests test test-all test-import test-rpc $(TEST_TARGETS)
-
-test-sim-nondeterminism:
- @echo "Running non-determinism test..."
- @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
- -NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h
-
-test-sim-custom-genesis-fast:
- @echo "Running custom genesis simulation..."
- @echo "By default, ${HOME}/.$(EVMOS_DIR)/config/genesis.json will be used."
- @go test -mod=readonly $(SIMAPP) -run TestFullAppSimulation -Genesis=${HOME}/.$(EVMOS_DIR)/config/genesis.json \
- -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h
-
-test-sim-import-export: runsim
- @echo "Running application import/export simulation. This may take several minutes..."
- @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport
-
-test-sim-after-import: runsim
- @echo "Running application simulation-after-import. This may take several minutes..."
- @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppSimulationAfterImport
-
-test-sim-custom-genesis-multi-seed: runsim
- @echo "Running multi-seed custom genesis simulation..."
- @echo "By default, ${HOME}/.$(EVMOS_DIR)/config/genesis.json will be used."
- @$(BINDIR)/runsim -Genesis=${HOME}/.$(EVMOS_DIR)/config/genesis.json -SimAppPkg=$(SIMAPP) -ExitOnFail 400 5 TestFullAppSimulation
-
-test-sim-multi-seed-long: runsim
- @echo "Running long multi-seed application simulation. This may take awhile!"
- @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestFullAppSimulation
-
-test-sim-multi-seed-short: runsim
- @echo "Running short multi-seed application simulation. This may take awhile!"
- @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation
-
-test-sim-benchmark-invariants:
- @echo "Running simulation invariant benchmarks..."
- @go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \
- -Enabled=true -NumBlocks=1000 -BlockSize=200 \
- -Period=1 -Commit=true -Seed=57 -v -timeout 24h
-
-.PHONY: \
-test-sim-nondeterminism \
-test-sim-custom-genesis-fast \
-test-sim-import-export \
-test-sim-after-import \
-test-sim-custom-genesis-multi-seed \
-test-sim-multi-seed-short \
-test-sim-multi-seed-long \
-test-sim-benchmark-invariants
-
-benchmark:
- @go test -mod=readonly -bench=. $(PACKAGES_NOSIMULATION)
-.PHONY: benchmark
###############################################################################
### Linting ###
@@ -508,175 +677,3 @@ proto-update-deps:
.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps
-###############################################################################
-### Localnet ###
-###############################################################################
-
-# Build image for a local testnet
-localnet-build:
- @$(MAKE) -C networks/local
-
-# Start a 4-node testnet locally
-localnet-start: localnet-stop localnet-build
- @if ! [ -f build/node0/$(EVMOS_BINARY)/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/evmos:Z evmos/node "./evmosd testnet init-files --v 4 -o /evmos --keyring-backend=test --starting-ip-address 192.167.10.2"; fi
- docker-compose up -d
-
-# Stop testnet
-localnet-stop:
- docker-compose down
-
-# Clean testnet
-localnet-clean:
- docker-compose down
- sudo rm -rf build/*
-
- # Reset testnet
-localnet-unsafe-reset:
- docker-compose down
-ifeq ($(OS),Windows_NT)
- @docker run --rm -v $(CURDIR)\build\node0\evmosd:/evmos\Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
- @docker run --rm -v $(CURDIR)\build\node1\evmosd:/evmos\Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
- @docker run --rm -v $(CURDIR)\build\node2\evmosd:/evmos\Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
- @docker run --rm -v $(CURDIR)\build\node3\evmosd:/evmos\Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
-else
- @docker run --rm -v $(CURDIR)/build/node0/evmosd:/evmos:Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
- @docker run --rm -v $(CURDIR)/build/node1/evmosd:/evmos:Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
- @docker run --rm -v $(CURDIR)/build/node2/evmosd:/evmos:Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
- @docker run --rm -v $(CURDIR)/build/node3/evmosd:/evmos:Z evmos/node "./evmosd tendermint unsafe-reset-all --home=/evmos"
-endif
-
-# Clean testnet
-localnet-show-logstream:
- docker-compose logs --tail=1000 -f
-
-.PHONY: localnet-build localnet-start localnet-stop
-
-###############################################################################
-### Releasing ###
-###############################################################################
-
-PACKAGE_NAME:=github.com/evmos/evmos
-GOLANG_CROSS_VERSION = v1.18
-GOPATH ?= '$(HOME)/go'
-release-dry-run:
- docker run \
- --rm \
- --privileged \
- -e CGO_ENABLED=1 \
- -v /var/run/docker.sock:/var/run/docker.sock \
- -v `pwd`:/go/src/$(PACKAGE_NAME) \
- -v ${GOPATH}/pkg:/go/pkg \
- -w /go/src/$(PACKAGE_NAME) \
- ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
- --rm-dist --skip-validate --skip-publish --snapshot
-
-release:
- @if [ ! -f ".release-env" ]; then \
- echo "\033[91m.release-env is required for release\033[0m";\
- exit 1;\
- fi
- docker run \
- --rm \
- --privileged \
- -e CGO_ENABLED=1 \
- --env-file .release-env \
- -v /var/run/docker.sock:/var/run/docker.sock \
- -v `pwd`:/go/src/$(PACKAGE_NAME) \
- -w /go/src/$(PACKAGE_NAME) \
- ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
- release --rm-dist --skip-validate
-
-.PHONY: release-dry-run release
-
-###############################################################################
-### Releasing ###
-###############################################################################
-
-PACKAGE_NAME:=github.com/evmos/evmos
-GOLANG_CROSS_VERSION = v1.18
-GOPATH ?= '$(HOME)/go'
-release-dry-run:
- docker run \
- --rm \
- --privileged \
- -e CGO_ENABLED=1 \
- -v /var/run/docker.sock:/var/run/docker.sock \
- -v `pwd`:/go/src/$(PACKAGE_NAME) \
- -v ${GOPATH}/pkg:/go/pkg \
- -w /go/src/$(PACKAGE_NAME) \
- ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
- --rm-dist --skip-validate --skip-publish --snapshot
-
-release:
- @if [ ! -f ".release-env" ]; then \
- echo "\033[91m.release-env is required for release\033[0m";\
- exit 1;\
- fi
- docker run \
- --rm \
- --privileged \
- -e CGO_ENABLED=1 \
- --env-file .release-env \
- -v /var/run/docker.sock:/var/run/docker.sock \
- -v `pwd`:/go/src/$(PACKAGE_NAME) \
- -w /go/src/$(PACKAGE_NAME) \
- ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
- release --rm-dist --skip-validate
-
-.PHONY: release-dry-run release
-
-###############################################################################
-### Compile Solidity Contracts ###
-###############################################################################
-
-CONTRACTS_DIR := contracts
-COMPILED_DIR := contracts/compiled_contracts
-TMP := tmp
-TMP_CONTRACTS := $(TMP).contracts
-TMP_COMPILED := $(TMP)/compiled.json
-TMP_JSON := $(TMP)/tmp.json
-
-# Compile and format solidity contracts for the erc20 module. Also install
-# openzeppeling as the contracts are build on top of openzeppelin templates.
-contracts-compile: contracts-clean openzeppelin create-contracts-json
-
-# Install openzeppelin solidity contracts
-openzeppelin:
- @echo "Importing openzeppelin contracts..."
- @cd $(CONTRACTS_DIR)
- @npm install
- @cd ../../../../
- @mv node_modules $(TMP)
- @mv package-lock.json $(TMP)
- @mv $(TMP)/@openzeppelin $(CONTRACTS_DIR)
-
-# Clean tmp files
-contracts-clean:
- @rm -rf tmp
- @rm -rf node_modules
- @rm -rf $(COMPILED_DIR)
- @rm -rf $(CONTRACTS_DIR)/@openzeppelin
-
-# Compile, filter out and format contracts into the following format.
-# {
-# "abi": "[{\"inpu # JSON string
-# "bin": "60806040
-# "contractName": # filename without .sol
-# }
-create-contracts-json:
- @for c in $(shell ls $(CONTRACTS_DIR) | grep '\.sol' | sed 's/.sol//g'); do \
- command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed."; exit 1; } ;\
- command -v solc > /dev/null 2>&1 || { echo >&2 "solc not installed."; exit 1; } ;\
- mkdir -p $(COMPILED_DIR) ;\
- mkdir -p $(TMP) ;\
- echo "\nCompiling solidity contract $${c}..." ;\
- solc --combined-json abi,bin $(CONTRACTS_DIR)/$${c}.sol > $(TMP_COMPILED) ;\
- echo "Formatting JSON..." ;\
- get_contract=$$(jq '.contracts["$(CONTRACTS_DIR)/'$$c'.sol:'$$c'"]' $(TMP_COMPILED)) ;\
- add_contract_name=$$(echo $$get_contract | jq '. + { "contractName": "'$$c'" }') ;\
- echo $$add_contract_name | jq > $(TMP_JSON) ;\
- abi_string=$$(echo $$add_contract_name | jq -cr '.abi') ;\
- echo $$add_contract_name | jq --arg newval "$$abi_string" '.abi = $$newval' > $(TMP_JSON) ;\
- mv $(TMP_JSON) $(COMPILED_DIR)/$${c}.json ;\
- done
- @rm -rf tmp
diff --git a/README.md b/README.md
index 779f40ff..159eb8ca 100644
--- a/README.md
+++ b/README.md
@@ -44,69 +44,213 @@ interoperable with Ethereum. It's built using the [Cosmos SDK](https://github.co
**Note**: Requires [Go 1.18+](https://golang.org/dl/)
-## Instructions for Zama block chain
-1. [MANDATORY] In order to use our custom EVM, please use the branch [__1.10.19-zama__](https://github.com/zama-ai/go-ethereum/tree/1.10.19-zama) in Zama go-ethereum repository.
-2. [CHECK] Please check that go.mod in this repository root folder points to the custom go-ethereum repository (end of the file).
-3. [MANDATORY] For pre-compiled contracts, we need to add to go_ethereum the C API dynamic library. The [install_tfhe_rs_script](https://github.com/zama-ai/go-ethereum/blob/1.10.19-zama/install_thfe_rs_api.sh) scripts allows to install it directly to the right place. To be more precise, the libray files are built and copied into __core/vm/lib__ folder and the tfhe C header file is placed in __core/vm__ folder.
-4. [HELP_IF_ERROR] If the library is not found when the node is run consider updating some env variable as __LD_LIBRARY_PATH__ with the path of go-ethereum/core/vm/lib.
-4. [HELP_IF_ERROR_IN_DEBUG] If the library is not found in the DEBUG mode, please consider to add the env variable as for the point 4 for the launch.json file. Here is an example launch.json file.
+# Local build
+
+To build evmosd binary directly in your system.
+
+```bash
+export GOPRIVATE=github.com/zama-ai/*
+make build-local
+```
+
+The binary is built in build folder.
+
+Dependencies:
+
+| Name | Type | Variable name | where it is defined | Current version/value |
+| ----------- | ---------- | --------------- | ------------------- | --------------------- |
+| go-ethereum | repository | - | directly in go.mod | v0.1.0 |
+| ethermint | repository | - | directly in go.mod | v0.1.0 |
+| tfhe-rs | repository | TFHE_RS_VERSION | Makefile/.env | v0.1.0 |
+
+
+
+
+
+# Local build through docker and e2e test
+
+## From sources
+
+If the developer wants to build everything locally from sources, and run the e2e test this build is the more adapted.
+
+Dependencies:
+
+| Name | Type | Variable name | where it is defined | Current version/value |
+| ----------- | ---------- | --------------- | ------------------- | --------------------- |
+| evmos | repository | LOCAL_BUILD | .env | true |
+| go-ethereum | repository | - | directly in go.mod | v0.1.0 |
+| ethermint | repository | - | directly in go.mod | v0.1.0 |
+| tfhe-rs | repository | TFHE_RS_VERSION | Makefile/.env | v0.1.0 |
+
+
+
+
+```bash
+make build-docker
+```
+
+
+
+ Here are the steps executed automatically
+
+
+
+- Build a base image (or retrieve it from ghcr.io) called __zama-zbc-build__.
+- Check tfhe-rs is available in TFHE_RS_PATH (default is work_dir/tfhe-rs)
+- In any case the custom version or the cloned (TFHE_RS_VERSION) one is copied into work_dir/tfhe-rs
+- Clone go-ethereum and ethermint to work_dir (version are parsed from go.mod to avoid handling ssh keys inside docker because those repositories are private)
+- Update go.mod to make it use local repositories (related to the just above changes)
+- Build a container called __evmosnodelocal__.
+
+
+
+
+To only init and run the node:
+
+```bash
+make init-evmos-node
+make run_evmos
+# make stop_evmos
+```
+
+Docker ps output:
+
+```
+CONTAINER ID IMAGE NAMES
+0bc6ae374153 evmosnodelocal evmosnodelocal0
+422f83a0ea73 docker-compose_oracledb zbcoracledb
+
+```
+
+
+To execute the e2e test, here are the dependencies:
+
+| Name | Type | Variable name | where it is defined | Current version/value |
+| ------------- | ---------- | --------------------- | ------------------- | --------------------- |
+| evmos | repository | LOCAL_BUILD | .env | true |
+| zbc-solidity | repository | ZBC_SOLIDITY_VERSION | Makefile/.env | v0.1.0 |
+| zbc-fhe-tool | repository | ZBC_FHE_TOOL_VERSION | Makefile/.env | v0.1.0 |
+| zbc-oracle-db | repository | ZBC_ORACLE_DB_VERSION | Makefile/.env | main |
+
+
+
+
```bash
-{
- "configurations": [
- {
- "name": "evmosd",
- "type": "go",
- "request": "launch",
- "mode": "exec",
- "program": "/home/ldemir/go/bin/evmosd",
- "env": {
- "LD_LIBRARY_PATH": "/home/ldemir/Documents/dev/blockchain/go-ethereum/core/vm/lib/"
- },
- "args": [
- "start",
- "--pruning=nothing",
- "--log_level=info",
- "--minimum-gas-prices=0.0001aevmos",
- "--json-rpc.api=eth,txpool,personal,net,debug,web3"
- ]
- }
- ]
-}
+# without the previous init
+make e2e-test
+# or if evmos is already initialized.
+make run_evmos
+make run_e2e_test
+make stop_evmos
```
-Now you can continue to Installation session.
+
+
+ Here are the steps executed automatically
+
+
+
+- check you have all the needed repositories
+ - zbc-fhe-tool
+ - zbc-solidity
+ - zbc-oracledb
+- init evmos node by calling /config/setup.sh file
+- generate fhe keys using zbc-fhe-tool based on scripts/prepare_volumes_from_fhe_tool.sh script
+- copy them at the right folder using scripts/prepare_demo_local.sh script
+- start evmosnodelocal0 and oracledb (local build) using docker-compose/docker-compose.local.yml file
+- run the e2e test
+ - copy pks to encrypt user input using $(ZBC_SOLIDITY_PATH)/prepare_fhe_keys_for_e2e_test script
+ - start the test using $(ZBC_SOLIDITY_PATH)/run_ERC20_e2e_test.sh
+ - Get the private key of main account
+ - Give it to the python test script $(ZBC_SOLIDITY_PATH)/ci/tests/ERC20.py
+
+
+
+
+## From github package registry
+
+The fast way to run the e2e test locally using ready to use docker images
+
+Dependencies:
+
+| Name | Type | Variable name | where it is defined | Current version/value |
+| -------------------------- | ----------------- | ------------- | ---------------------------- | --------------------- |
+| evmos | repository | LOCAL_BUILD | .env | false |
+| ghcr.io/zama-ai/evmos-node | docker image name | hard-coded | docker-compose.validator.yml | v0.1.0 |
+
+
-## Installation
+Init evmos and run it:
-For prerequisites and detailed build instructions please read the [Installation](https://evmos.dev/validators/quickstart/installation.html) instructions. Once the dependencies are installed, run:
+```bash
+make init-evmos-node
+make run_evmos
+# make stop_evmos
+```
+
+Docker ps output:
+```
+CONTAINER ID IMAGE NAMES
+02b40fb0bdf7 ghcr.io/zama-ai/evmos-node:v0.1.0 evmosnode0
+ac2073c0d6fc ghcr.io/zama-ai/oracle-db-service:latest zbcoracledb
+```
+
+To execute the e2e test, here are the dependencies:
```bash
-make install
+# if evmos is already initialized.
+make run_evmos
+make run_e2e_test
+make stop_evmos
```
+| Name | Type | Variable name | where it is defined | Current version/value |
+| :------------------------: | :---------------: | :-------------------: | :--------------------------: | :-------------------: |
+| evmos | evmos | LOCAL_BUILD | .env | false |
+| ghcr.io/zama-ai/evmos-node | docker image name | hard-coded | docker-compose.validator.yml | v0.1.0 |
+| oracle-db-service | docker image name | hard-coded | docker-compose.validator.yml | latest |
+| zbc-solidity | repository | ZBC_SOLIDITY_VERSION | Makefile/.env | v0.1.0 |
+| zbc-fhe-tool | repository | ZBC_FHE_TOOL_VERSION | Makefile/.env | v0.1.0 |
+| zbc-oracle-db | repository | ZBC_ORACLE_DB_VERSION | Makefile/.env | main |
+
+
+
-Or check out the latest [release](https://github.com/evmos/evmos/releases).
+Note:
+- for the zbc-oracle-db docker image it could not work on arm64 because the arm64 version is not yet pushed in ghcr.io
-## Quick Start
+
+
+ Troubleshoot ghcr.io
-To learn how the Evmos works from a high-level perspective, go to the [Introduction](https://evmos.dev/about/intro/overview.html) section from the documentation. You can also check the instructions to [Run a Node](https://evmos.dev/validators/quickstart/run_node.html).
+Here is a tutorial on [how to manage ghcr.io access](https://github.com/zama-ai/zbc-fhe-tool#using-the-published-image-easiest-way).
-## Community
+ If you get trouble to pull image from ghcri.io, one can build it locally with
+ ```bash
+ docker build . -t zama-zbc-build -f docker/Dockerfile.zbc.build
+ ```
+
+
+
+ Troubleshoot go modules for local-build
+
+Because evmos depends on private [go-ethereum](https://github.com/zama-ai/go-ethereum) and [ethermint](https://github.com/zama-ai/ethermint) repositories, one need to pay attention to two points to allow go modules manager to work correctly.
+
+1. Check that GOPRIVATE is set to __github.com/zama-ai/*__ (normally this env variable is set by default in Makefile)
+2. Check you have the following lines in your gitconfig files:
+
+```bash
+[url "ssh://git@github.com/"]
+ insteadOf = https://github.com/
+```
+
+
-The following chat channels and forums are a great spot to ask questions about Evmos:
-- [Evmos Twitter](https://twitter.com/EvmosOrg)
-- [Evmos Discord](https://discord.gg/evmos)
-- [Evmos Forum](https://commonwealth.im/evmos)
-- [Tharsis Twitter](https://twitter.com/TharsisHQ)
## Contributing
Looking for a good place to start contributing? Check out some [`good first issues`](https://github.com/evmos/evmos/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
For additional instructions, standards and style guides, please refer to the [Contributing](./CONTRIBUTING.md) document.
-
-## Careers
-
-See our open positions on [Cosmos Jobs](https://jobs.cosmos.network/project/evmos-d0sk1uxuh-remote/), [Notion](https://tharsis.notion.site), or feel free to [reach out](mailto:careers@thars.is) via email.
diff --git a/docker-compose/docker-compose.local.override.yml b/docker-compose/docker-compose.local.override.yml
new file mode 100644
index 00000000..a51562d4
--- /dev/null
+++ b/docker-compose/docker-compose.local.override.yml
@@ -0,0 +1,5 @@
+version: '3'
+
+services:
+ evmosnodelocal:
+ entrypoint: /usr/bin/evmosd start --home /root/.evmosd --minimum-gas-prices=0.000000000000000001aevmos --json-rpc.gas-cap=9999999999999999 --gas-prices=0.00000000000000000000000000000000001aevmos --gas-adjustment=0.000000000000000000000000001 --json-rpc.api eth,txpool,personal,net,debug,web3
diff --git a/docker-compose/docker-compose.local.yml b/docker-compose/docker-compose.local.yml
new file mode 100644
index 00000000..e6f93c5b
--- /dev/null
+++ b/docker-compose/docker-compose.local.yml
@@ -0,0 +1,45 @@
+version: '3'
+
+services:
+ evmosnodelocal:
+ image: evmosnodelocal
+ container_name: evmosnodelocal0
+ build:
+ context: ../
+ dockerfile: docker/Dockerfile.evmos-node.local
+ ports:
+ - "26656-26657:26656-26657"
+ - "8545:8545"
+ volumes:
+ - ../running_node/node1:/root:Z
+ - ../private.ed25519:/config/private.ed25519:Z
+ - ../public.ed25519:/config/public.ed25519:Z
+ - ../node/init_scripts/setup.sh:/config/setup.sh:Z
+ - ../node/zama_config/zama_config_local_testnet.toml:/config/zama_config.toml:Z
+ - ../vm.log:/root/.evmosd/zama/vm.log:Z
+ security_opt:
+ - no-new-privileges:true
+ read_only: true
+ networks:
+ localnet:
+ ipv4_address: 192.167.10.2
+
+ oracledb:
+ image: ghcr.io/zama-ai/oracle-db-service:latest
+ container_name: zbcoracledb
+ ports:
+ - "8001:8001"
+ security_opt:
+ - no-new-privileges:true
+ read_only: true
+ networks:
+ localnet:
+ ipv4_address: 192.167.10.12
+
+networks:
+ localnet:
+ driver: bridge
+ ipam:
+ driver: default
+ config:
+ - subnet: 192.167.10.0/16
diff --git a/docker-compose/docker-compose.validator.override.yml b/docker-compose/docker-compose.validator.override.yml
new file mode 100644
index 00000000..9770b31e
--- /dev/null
+++ b/docker-compose/docker-compose.validator.override.yml
@@ -0,0 +1,5 @@
+version: '3'
+
+services:
+ validator:
+ entrypoint: /usr/bin/evmosd start --home /root/.evmosd --minimum-gas-prices=0.000000000000000001aevmos --json-rpc.gas-cap=9999999999999999 --gas-prices=0.00000000000000000000000000000000001aev0mos --gas-adjustment=0.000000000000000000000000001 --json-rpc.api eth,txpool,personal,net,debug,web3
diff --git a/docker-compose/docker-compose.validator.yml b/docker-compose/docker-compose.validator.yml
new file mode 100644
index 00000000..88b6d3d5
--- /dev/null
+++ b/docker-compose/docker-compose.validator.yml
@@ -0,0 +1,42 @@
+version: '3'
+
+services:
+ validator:
+ image: ghcr.io/zama-ai/evmos-node:v0.1.0
+ container_name: evmosnode0
+ ports:
+ - "26656-26657:26656-26657"
+ - "8545:8545"
+ volumes:
+ - ../running_node/node2:/root:Z
+ - ../node/evmos/private.ed25519:/config/private.ed25519:Z
+ - ../node/evmos/public.ed25519:/config/public.ed25519:Z
+ - ../node/init_scripts/setup.sh:/config/setup.sh:Z
+ - ../node/zama_config/zama_config_validator.toml:/config/zama_config.toml:Z
+ - ../vm.log:/root/.evmosd/zama/vm.log:Z
+ security_opt:
+ - no-new-privileges:true
+ read_only: true
+ networks:
+ localnet:
+ ipv4_address: 192.167.10.2
+
+ oracledb:
+ image: ghcr.io/zama-ai/oracle-db-service:latest
+ container_name: zbcoracledb
+ security_opt:
+ - no-new-privileges:true
+ read_only: true
+ ports:
+ - "8001:8001"
+ networks:
+ localnet:
+ ipv4_address: 192.167.10.12
+
+networks:
+ localnet:
+ driver: bridge
+ ipam:
+ driver: default
+ config:
+ - subnet: 192.167.10.0/16
diff --git a/docker-compose.yml b/docker-compose/docker-compose.yml
similarity index 100%
rename from docker-compose.yml
rename to docker-compose/docker-compose.yml
diff --git a/docker/Dockerfile.evmos-node.local b/docker/Dockerfile.evmos-node.local
new file mode 100644
index 00000000..aa39303f
--- /dev/null
+++ b/docker/Dockerfile.evmos-node.local
@@ -0,0 +1,39 @@
+FROM ghcr.io/zama-ai/zama-zbc-build:latest AS build-env
+
+ENV LD_LIBRARY_PATH=/usr/lib/tfhe
+ADD . /src/evmos
+
+WORKDIR /src/evmos
+
+RUN mkdir -p /usr/include
+
+RUN cp go.mod.updated /src/evmos/go.mod
+
+RUN tail /src/evmos/go.mod
+
+RUN make build
+RUN ls /src/evmos
+RUN ls /src/evmos/build
+RUN mkdir -p /src/evmos/build
+
+FROM ghcr.io/zama-ai/zama-zbc-build:latest
+
+RUN apt-get update -y
+RUN apt-get install ca-certificates jq -y
+ENV LD_LIBRARY_PATH=/usr/lib
+
+
+COPY --from=build-env /src/evmos/build/evmosd /usr/bin/evmosd
+COPY --from=build-env /usr/lib/libtfhe.* /usr/lib/
+COPY --from=build-env /usr/include/tfhe.h /usr/include
+
+WORKDIR /config
+ADD setup.sh .
+RUN chmod +x /config/setup.sh
+ADD zama_config.toml .
+RUN mkdir -p /root/.evmosd/zama
+RUN touch /root/.evmosd/zama/vm.log
+
+EXPOSE 26656 26657 1317 9090 8545 8546
+
+CMD ["/usr/bin/evmosd", "start", "--home", "/root/.evmosd"]
diff --git a/go.mod b/go.mod
index 59c76e72..3c230d90 100644
--- a/go.mod
+++ b/go.mod
@@ -173,6 +173,6 @@ replace (
replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
// TODO: Remove once our forks are public.
-replace github.com/ethereum/go-ethereum v1.10.19 => ../go-ethereum
+replace github.com/ethereum/go-ethereum v1.10.19 => github.com/zama-ai/go-ethereum v0.1.0
-replace github.com/evmos/ethermint v0.19.3 => ../ethermint
+replace github.com/evmos/ethermint v0.19.3 => github.com/zama-ai/ethermint v1.0.0-test
diff --git a/go.sum b/go.sum
index 0a6a2eb6..ace83802 100644
--- a/go.sum
+++ b/go.sum
@@ -862,6 +862,10 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/zama-ai/ethermint v1.0.0-test h1:x00Rxncw8qhzvV75S9lPbcmYBumGZ8ZZ8lGWgDawjHY=
+github.com/zama-ai/ethermint v1.0.0-test/go.mod h1:JEqkvu6ZC6GV0nq7txpzmaRQdfDzwFay1SRumKsEkg8=
+github.com/zama-ai/go-ethereum v1.0.1-test h1:WpTU7WP2W9fyZZYD+n0t26S1Njk6lzb3szKVgvVZ/SE=
+github.com/zama-ai/go-ethereum v1.0.1-test/go.mod h1:IJBNMtzKcNHPtllYihy6BL2IgK1u+32JriaTbdt4v+w=
github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8=
github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
diff --git a/node/init_scripts/setup.sh b/node/init_scripts/setup.sh
new file mode 100644
index 00000000..4da91618
--- /dev/null
+++ b/node/init_scripts/setup.sh
@@ -0,0 +1,153 @@
+#!/bin/bash
+
+KEY1="mykey1"
+KEY2="mykey2"
+CHAINID="evmos_9000-1"
+MONIKER="localtestnet"
+KEYRING="test" # remember to change to other types of keyring like 'file' in-case exposing to outside world, otherwise your balance will be wiped quickly. The keyring test does not require private key to steal tokens from you
+KEYALGO="eth_secp256k1"
+LOGLEVEL="info"
+# to trace evm
+#TRACE="--trace"
+TRACE=""
+HOME_EVMOSD="$HOME/.evmosd"
+# HOME_EVMOSD="/node/.evmosd"
+
+#EVMOSD="evmosd"
+EVMOSD="evmosd --home $HOME_EVMOSD"
+
+# validate dependencies are installed
+command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; }
+
+# used to exit on first error (any non-zero exit code)
+set -e
+
+# Reinstall daemon
+
+# Set client config
+$EVMOSD config keyring-backend $KEYRING
+$EVMOSD config chain-id $CHAINID
+
+# if keys exist, they should be deleted
+$EVMOSD keys add $KEY1 --keyring-backend $KEYRING --algo $KEYALGO
+
+# Set moniker and chain-id for Evmos (Moniker can be anything, chain-id must be an integer)
+$EVMOSD init $MONIKER --chain-id $CHAINID
+
+# Change parameter token denominations to aevmos
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["inflation"]["params"]["mint_denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set gas and txn limit in genesis
+cat $HOME_EVMOSD/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="9999999999999999"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.consensus_params["block"]["max_bytes"]="104857600"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set claims start time
+node_address=$($EVMOSD keys list | grep "address: " | cut -c12-)
+current_date=$(date -u +"%Y-%m-%dT%TZ")
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg current_date "$current_date" '.app_state["claims"]["params"]["airdrop_start_time"]=$current_date' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set claims records for validator account
+amount_to_claim=10000
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg node_address "$node_address" --arg amount_to_claim "$amount_to_claim" '.app_state["claims"]["claims_records"]=[{"initial_claimable_amount":$amount_to_claim, "actions_completed":[false, false, false, false],"address":$node_address}]' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set claims decay
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["claims"]["params"]["duration_of_decay"]="1000000s"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["claims"]["params"]["duration_until_decay"]="100000s"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Claim module account:
+# 0xA61808Fe40fEb8B3433778BBC2ecECCAA47c8c47 || evmos15cvq3ljql6utxseh0zau9m8ve2j8erz89m5wkz
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg amount_to_claim "$amount_to_claim" '.app_state["bank"]["balances"] += [{"address":"evmos15cvq3ljql6utxseh0zau9m8ve2j8erz89m5wkz","coins":[{"denom":"aevmos", "amount":$amount_to_claim}]}]' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Disable production of empty blocks.
+# Increase transaction and HTTP server body sizes.
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/max_body_bytes = 1000000/max_body_bytes = 1000000000/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/max_tx_bytes = 1048576/max_tx_bytes = 100000000/g' $HOME_EVMOSD/config/config.toml
+ else
+ sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/max_body_bytes = 1000000/max_body_bytes = 1000000000/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/max_tx_bytes = 1048576/max_tx_bytes = 100000000/g' $HOME_EVMOSD/config/config.toml
+fi
+
+if [[ $1 == "pending" ]]; then
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ sed -i '' 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ else
+ sed -i 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ fi
+fi
+
+# Allocate genesis accounts (cosmos formatted addresses)
+$EVMOSD add-genesis-account $KEY1 100000000000000000000000000aevmos --keyring-backend $KEYRING
+
+# Update total supply with claim values
+validators_supply=$(cat $HOME_EVMOSD/config/genesis.json | jq -r '.app_state["bank"]["supply"][0]["amount"]')
+# Bc is required to add this big numbers
+# total_supply=$(bc <<< "$amount_to_claim+$validators_supply")
+total_supply=100000000000000000000010000
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg total_supply "$total_supply" '.app_state["bank"]["supply"][0]["amount"]=$total_supply' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Sign genesis transaction
+$EVMOSD gentx $KEY1 1000000000000000000000aevmos --keyring-backend $KEYRING --chain-id $CHAINID
+## In case you want to create multiple validators at genesis
+## 1. Back to `$EVMOSD keys add` step, init more keys
+## 2. Back to `$EVMOSD add-genesis-account` step, add balance for those
+## 3. Clone this ~/.$EVMOSD home directory into some others, let's say `~/.clonedEvmosd`
+## 4. Run `gentx` in each of those folders
+## 5. Copy the `gentx-*` folders under `~/.clonedEvmosd/config/gentx/` folders into the original `~/.evmosd/config/gentx`
+
+# Collect genesis tx
+$EVMOSD collect-gentxs
+
+# Run this to ensure everything worked and that the genesis file is setup correctly
+$EVMOSD validate-genesis
+
+if [[ $1 == "pending" ]]; then
+ echo "pending mode is on, please wait for the first block committed."
+fi
+
+# Create a second account.
+$EVMOSD keys add $KEY2 --keyring-backend $KEYRING --algo $KEYALGO
+
+# Create Zama-specific directories and files.
+mkdir -p $HOME_EVMOSD/zama/keys/users-fhe-keys
+mkdir -p $HOME_EVMOSD/zama/keys/network-fhe-keys
+mkdir -p $HOME_EVMOSD/zama/keys/signature-keys
+mkdir -p $HOME_EVMOSD/zama/config
+cp ./zama_config.toml $HOME_EVMOSD/zama/config/
+cp ./private.ed25519 $HOME_EVMOSD/zama/keys/signature-keys
+cp ./public.ed25519 $HOME_EVMOSD/zama/keys/signature-keys
+
+echo "Your private keys:"
+$EVMOSD keys unsafe-export-eth-key mykey1 --keyring-backend test
+$EVMOSD keys unsafe-export-eth-key mykey2 --keyring-backend test
+
+
+echo "Export info for other nodes"
+echo "$HOME/privkey"
+touch $HOME/privkey
+$EVMOSD keys unsafe-export-eth-key mykey1 --keyring-backend test > $HOME/privkey
+echo "$HOME/node_id"
+touch $HOME/node_id
+$EVMOSD tendermint show-node-id > $HOME/node_id
diff --git a/node/init_scripts/setup_full_node.sh b/node/init_scripts/setup_full_node.sh
new file mode 100644
index 00000000..7ea697eb
--- /dev/null
+++ b/node/init_scripts/setup_full_node.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+
+CHAINID="evmos_9000-1"
+MONIKER="localtestnet"
+KEYRING="test" # remember to change to other types of keyring like 'file' in-case exposing to outside world, otherwise your balance will be wiped quickly. The keyring test does not require private key to steal tokens from you
+KEYALGO="eth_secp256k1"
+LOGLEVEL="info"
+# to trace evm
+#TRACE="--trace"
+TRACE=""
+HOME_EVMOSD="/$HOME/.evmosd"
+
+EVMOSD="evmosd"
+
+# validate dependencies are installed
+command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; }
+
+# used to exit on first error (any non-zero exit code)
+set -e
+
+# Reinstall daemon
+
+# Set client config
+$EVMOSD config keyring-backend $KEYRING
+$EVMOSD config chain-id $CHAINID
+
+# Set moniker and chain-id for Evmos (Moniker can be anything, chain-id must be an integer)
+$EVMOSD init $MONIKER --chain-id $CHAINID
+
+# Change parameter token denominations to aevmos
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["inflation"]["params"]["mint_denom"]="aevmos"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set gas and txn limit in genesis
+cat $HOME_EVMOSD/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="9999999999999999"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.consensus_params["block"]["max_bytes"]="104857600"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set claims start time
+node_address=$($EVMOSD keys list | grep "address: " | cut -c12-)
+current_date=$(date -u +"%Y-%m-%dT%TZ")
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg current_date "$current_date" '.app_state["claims"]["params"]["airdrop_start_time"]=$current_date' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set claims records for validator account
+amount_to_claim=10000
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg node_address "$node_address" --arg amount_to_claim "$amount_to_claim" '.app_state["claims"]["claims_records"]=[{"initial_claimable_amount":$amount_to_claim, "actions_completed":[false, false, false, false],"address":$node_address}]' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Set claims decay
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["claims"]["params"]["duration_of_decay"]="1000000s"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+cat $HOME_EVMOSD/config/genesis.json | jq '.app_state["claims"]["params"]["duration_until_decay"]="100000s"' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Claim module account:
+# 0xA61808Fe40fEb8B3433778BBC2ecECCAA47c8c47 || evmos15cvq3ljql6utxseh0zau9m8ve2j8erz89m5wkz
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg amount_to_claim "$amount_to_claim" '.app_state["bank"]["balances"] += [{"address":"evmos15cvq3ljql6utxseh0zau9m8ve2j8erz89m5wkz","coins":[{"denom":"aevmos", "amount":$amount_to_claim}]}]' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Disable production of empty blocks.
+# Increase transaction and HTTP server body sizes.
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/max_body_bytes = 1000000/max_body_bytes = 1000000000/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/max_tx_bytes = 1048576/max_tx_bytes = 100000000/g' $HOME_EVMOSD/config/config.toml
+ else
+ sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/max_body_bytes = 1000000/max_body_bytes = 1000000000/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/max_tx_bytes = 1048576/max_tx_bytes = 100000000/g' $HOME_EVMOSD/config/config.toml
+fi
+
+if [[ $1 == "pending" ]]; then
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ sed -i '' 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ else
+ sed -i 's/create_empty_blocks_interval = "0s"/create_empty_blocks_interval = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' $HOME_EVMOSD/config/config.toml
+ fi
+fi
+
+# Update total supply with claim values
+validators_supply=$(cat $HOME_EVMOSD/config/genesis.json | jq -r '.app_state["bank"]["supply"][0]["amount"]')
+# Bc is required to add this big numbers
+# total_supply=$(bc <<< "$amount_to_claim+$validators_supply")
+total_supply=100000000000000000000010000
+cat $HOME_EVMOSD/config/genesis.json | jq -r --arg total_supply "$total_supply" '.app_state["bank"]["supply"][0]["amount"]=$total_supply' > $HOME_EVMOSD/config/tmp_genesis.json && mv $HOME_EVMOSD/config/tmp_genesis.json $HOME_EVMOSD/config/genesis.json
+
+# Run this to ensure everything worked and that the genesis file is setup correctly
+# $EVMOSD validate-genesis
+
+if [[ $1 == "pending" ]]; then
+ echo "pending mode is on, please wait for the first block committed."
+fi
+
+
+# Create Zama-specific directories and files.
+mkdir -p $HOME_EVMOSD/zama/keys/users-fhe-keys
+mkdir -p $HOME_EVMOSD/zama/keys/network-fhe-keys
+mkdir -p $HOME_EVMOSD/zama/keys/signature-keys
+mkdir -p $HOME_EVMOSD/zama/config
+cp ./zama_config.toml $HOME_EVMOSD/zama/config/
+cp ./private.ed25519 $HOME_EVMOSD/zama/keys/signature-keys
+cp ./public.ed25519 $HOME_EVMOSD/zama/keys/signature-keys
diff --git a/node/zama_config/zama_config_full_node.toml b/node/zama_config/zama_config_full_node.toml
new file mode 100644
index 00000000..eaeecbf5
--- /dev/null
+++ b/node/zama_config/zama_config_full_node.toml
@@ -0,0 +1,8 @@
+[oracle]
+mode = "node"
+oracle_db_address = "http://13.37.31.214:8001"
+require_retry_count = 1
+
+[tfhe]
+ciphertexts_to_garbage_collect = 1000
+ciphertexts_garbage_collect_interval_secs = 2
diff --git a/node/zama_config/zama_config_local_testnet.toml b/node/zama_config/zama_config_local_testnet.toml
new file mode 100644
index 00000000..172c3db0
--- /dev/null
+++ b/node/zama_config/zama_config_local_testnet.toml
@@ -0,0 +1,8 @@
+[oracle]
+mode = "oracle"
+oracle_db_address = "http://zbcoracledb:8001"
+require_retry_count = 1
+
+[tfhe]
+ciphertexts_to_garbage_collect = 1000
+ciphertexts_garbage_collect_interval_secs = 2
\ No newline at end of file
diff --git a/node/zama_config/zama_config_validator.toml b/node/zama_config/zama_config_validator.toml
new file mode 100644
index 00000000..172c3db0
--- /dev/null
+++ b/node/zama_config/zama_config_validator.toml
@@ -0,0 +1,8 @@
+[oracle]
+mode = "oracle"
+oracle_db_address = "http://zbcoracledb:8001"
+require_retry_count = 1
+
+[tfhe]
+ciphertexts_to_garbage_collect = 1000
+ciphertexts_garbage_collect_interval_secs = 2
\ No newline at end of file
diff --git a/scripts/buf-generate-docs.sh b/scripts/buf-generate-docs.sh
old mode 100644
new mode 100755
diff --git a/scripts/get_module_version.sh b/scripts/get_module_version.sh
new file mode 100755
index 00000000..4126d6c2
--- /dev/null
+++ b/scripts/get_module_version.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+FILE=$1
+PATTERN=$2
+
+LINE=$(grep ${PATTERN} ${FILE})
+LAST_VALUE=$(echo ${LINE} | sed -n 's/.* \([^ ]*\)$/\1/p')
+
+echo ${LAST_VALUE}
\ No newline at end of file
diff --git a/scripts/get_repository_info.sh b/scripts/get_repository_info.sh
new file mode 100755
index 00000000..2c33d0f0
--- /dev/null
+++ b/scripts/get_repository_info.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+REPO_NAME=$1
+REPO_PATH=$2
+
+if [ ! -d "$REPO_PATH" ]; then
+ echo "######################################################"
+ echo "WARNING: $REPO_NAME does not exist or is not a directory"
+ echo "Given path: $REPO_PATH"
+ echo "######################################################"
+ exit
+fi
+
+if [ ! -d "$REPO_PATH/.git" ]; then
+ echo "Error: $REPO_PATH is not a Git repository"
+ exit 1
+fi
+
+cd $REPO_PATH
+
+BRANCH=$(git rev-parse --abbrev-ref HEAD)
+TAG=$(git describe --tags --exact-match 2>/dev/null)
+COMMIT=$(git rev-parse HEAD | cut -c 1-8)
+
+echo "$REPO_NAME --- branch: $BRANCH | tag: $TAG | commit: $COMMIT | path: $REPO_PATH"
diff --git a/scripts/get_version_from_makefile.sh b/scripts/get_version_from_makefile.sh
new file mode 100755
index 00000000..aa614291
--- /dev/null
+++ b/scripts/get_version_from_makefile.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+variable_name=$1
+value=$(grep "$variable_name ?=" Makefile | cut -d '=' -f 2- | tr -d '[:space:]')
+echo $value
\ No newline at end of file
diff --git a/scripts/prepare_demo_local.sh b/scripts/prepare_demo_local.sh
new file mode 100755
index 00000000..3f952b6a
--- /dev/null
+++ b/scripts/prepare_demo_local.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -Eeuo pipefail
+
+VOLUME_NETWORK_PUBLIC_KEYS_PATH=./volumes/network-public-fhe-keys
+VOLUME_NETWORK_PRIVATE_KEYS_PATH=./volumes/network-private-fhe-keys
+EVMOS_NETWORK_KEYS_PATH=./running_node/node1/.evmosd/zama/keys/network-fhe-keys
+
+mkdir -p $EVMOS_NETWORK_KEYS_PATH
+
+# In go-ethereum both private and public key for network are at the same place
+NETWORK_PUBLIC_KEYS_LIST=('sks' 'pks')
+
+for key in "${NETWORK_PUBLIC_KEYS_LIST[@]}"
+do
+ if [[ ! -f "$VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key" ]]; then
+ echo "The file $VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key does not exist."
+ exit
+ fi
+ echo "Copying $VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key to $EVMOS_NETWORK_KEYS_PATH, please wait ..."
+ cp -v $VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key $EVMOS_NETWORK_KEYS_PATH
+done
+
+NETWORK_PRIVATE_KEYS_LIST=('cks')
+
+for key in "${NETWORK_PRIVATE_KEYS_LIST[@]}"
+do
+ if [[ ! -f "$VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key" ]]; then
+ echo "The file $VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key does not exist."
+ exit
+ fi
+ echo "Copying $VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key to $EVMOS_NETWORK_KEYS_PATH, please wait ..."
+ cp -v $VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key $EVMOS_NETWORK_KEYS_PATH
+done
+
diff --git a/scripts/prepare_validator_ci.sh b/scripts/prepare_validator_ci.sh
new file mode 100755
index 00000000..ca543e09
--- /dev/null
+++ b/scripts/prepare_validator_ci.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -Eeuo pipefail
+
+VOLUME_NETWORK_PUBLIC_KEYS_PATH=./volumes/network-public-fhe-keys
+VOLUME_NETWORK_PRIVATE_KEYS_PATH=./volumes/network-private-fhe-keys
+EVMOS_NETWORK_KEYS_PATH=./running_node/node2/.evmosd/zama/keys/network-fhe-keys
+
+mkdir -p $EVMOS_NETWORK_KEYS_PATH
+
+# In go-ethereum both private and public key for network are at the same place
+NETWORK_PUBLIC_KEYS_LIST=('sks' 'pks')
+
+for key in "${NETWORK_PUBLIC_KEYS_LIST[@]}"
+do
+ if [[ ! -f "$VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key" ]]; then
+ echo "The file $VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key does not exist."
+ exit
+ fi
+ echo "Copying $VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key to $EVMOS_NETWORK_KEYS_PATH, please wait ..."
+ cp -v $VOLUME_NETWORK_PUBLIC_KEYS_PATH/$key $EVMOS_NETWORK_KEYS_PATH
+done
+
+NETWORK_PRIVATE_KEYS_LIST=('cks')
+
+for key in "${NETWORK_PRIVATE_KEYS_LIST[@]}"
+do
+ if [[ ! -f "$VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key" ]]; then
+ echo "The file $VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key does not exist."
+ exit
+ fi
+ echo "Copying $VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key to $EVMOS_NETWORK_KEYS_PATH, please wait ..."
+ cp -v $VOLUME_NETWORK_PRIVATE_KEYS_PATH/$key $EVMOS_NETWORK_KEYS_PATH
+done
+
diff --git a/scripts/prepare_volumes_from_fhe_tool.sh b/scripts/prepare_volumes_from_fhe_tool.sh
new file mode 100755
index 00000000..641730ca
--- /dev/null
+++ b/scripts/prepare_volumes_from_fhe_tool.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+# This bash script creates key for 4 different users: global, alice, bob and carol
+# and copy them to the right folder in volumes directory.
+# It accepts the path to the zbc-fhe tool as parameter.
+
+set -Eeuo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Please give the path to the zbc-fhe tool"
+ echo "Example: $(basename $0) PATH_TO/zbc-fhe-tool/target/release"
+ echo "Reminder to build zbc-fhe-tool: cargo build --release "
+ exit
+fi
+
+ZBC_FHE_TOOL_PATH=$1
+BINARY_NAME="zbc-fhe-tool"
+CURRENT_FOLDER=$PWD
+
+echo "Check if $BINARY_NAME is available in $ZBC_FHE_TOOL_PATH "
+if [ ! -f "$ZBC_FHE_TOOL_PATH/$BINARY_NAME" ]; then
+ echo "#####ATTENTION######"
+ echo "BINARY_NAME does not exist!"
+ echo "####################"
+ exit
+else
+ echo "$BINARY_NAME exists, let's create keys!"
+fi
+
+
+KEYS_FULL_PATH=$CURRENT_FOLDER/res/keys
+mkdir -p $KEYS_FULL_PATH
+
+$ZBC_FHE_TOOL_PATH/$BINARY_NAME generate-keys -d res/keys
+
+
+echo "###########################################################"
+echo "Keys creation is done, they are stored in $KEYS_FULL_PATH"
+echo "###########################################################"
+
+
+NETWORK_KEYS_PUBLIC_PATH=./volumes/network-public-fhe-keys
+NETWORK_KEYS_PRIVATE_PATH=./volumes/network-private-fhe-keys
+
+MANDATORY_KEYS_LIST=('sks' 'cks' 'pks')
+
+for key in "${MANDATORY_KEYS_LIST[@]}"
+ do
+ if [ ! -f "$KEYS_FULL_PATH/$key" ]; then
+ echo "#####ATTENTION######"
+ echo "$key does not exist in $KEYS_FULL_PATH!"
+ echo "####################"
+ exit
+ fi
+done
+
+echo "###########################################################"
+echo "All the required keys exist in $KEYS_FULL_PATH"
+echo "###########################################################"
+
+mkdir -p $NETWORK_KEYS_PUBLIC_PATH
+mkdir -p $NETWORK_KEYS_PRIVATE_PATH
+
+key="sks"
+echo "Copying $key to $NETWORK_KEYS_PUBLIC_PATH, please wait ..."
+cp $KEYS_FULL_PATH/$key $NETWORK_KEYS_PUBLIC_PATH/sks
+
+key="pks"
+echo "Copying $key to $NETWORK_KEYS_PUBLIC_PATH, please wait ..."
+cp $KEYS_FULL_PATH/$key $NETWORK_KEYS_PUBLIC_PATH/pks
+
+key="cks"
+echo "Copying $key to $NETWORK_KEYS_PRIVATE_PATH, please wait ..."
+cp $KEYS_FULL_PATH/$key $NETWORK_KEYS_PRIVATE_PATH/cks
+
+
+echo "###########################################################"
+echo "If you want to execute a local test using the same keys,"
+echo "please run the following command in zbc-solidity:"
+echo "prepare_fhe_keys_from_fhe_tool.sh $KEYS_FULL_PATH"
+echo "###########################################################"
+
diff --git a/scripts/prepare_volumes_validator_ci.sh b/scripts/prepare_volumes_validator_ci.sh
new file mode 100755
index 00000000..069ae218
--- /dev/null
+++ b/scripts/prepare_volumes_validator_ci.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -Eeuo pipefail
+
+NETWORK_KEYS_PUBLIC_PATH=./volumes/network-public-fhe-keys
+NETWORK_KEYS_PRIVATE_PATH=./volumes/network-private-fhe-keys
+S3_BUCKET_PATH="s3://zbc-testnet"
+S3_NETWORK_KEYS_PATH="$S3_BUCKET_PATH/network-fhe-keys"
+S3_NETWORK_KEYS_FULL_PATH="$S3_NETWORK_KEYS_PATH/staging-env"
+
+mkdir -p $NETWORK_KEYS_PUBLIC_PATH
+mkdir -p $NETWORK_KEYS_PRIVATE_PATH
+
+key="sks"
+echo "Downloading $key from $S3_NETWORK_KEYS_FULL_PATH to $NETWORK_KEYS_PUBLIC_PATH, please wait ..."
+aws s3 cp $S3_NETWORK_KEYS_FULL_PATH/$key $NETWORK_KEYS_PUBLIC_PATH/sks
+
+key="pks"
+echo "Downloading $key from $S3_NETWORK_KEYS_FULL_PATH to $NETWORK_KEYS_PUBLIC_PATH, please wait ..."
+aws s3 cp $S3_NETWORK_KEYS_FULL_PATH/$key $NETWORK_KEYS_PUBLIC_PATH/pks
+
+key="cks"
+echo "Downloading $key to $NETWORK_KEYS_PRIVATE_PATH, please wait ..."
+aws s3 cp $S3_NETWORK_KEYS_FULL_PATH/$key $NETWORK_KEYS_PRIVATE_PATH/cks
+
+
diff --git a/scripts/replace_go_mod.sh b/scripts/replace_go_mod.sh
new file mode 100755
index 00000000..472970ed
--- /dev/null
+++ b/scripts/replace_go_mod.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+FILE=$1
+REPO_NAME=$2
+
+#grep -n "zama.ai/$REPO_NAME" "$FILE" | cut -d: -f1 | xargs -I{} sed -i "{}s/=>.*/=> .\/work_dir\/$REPO_NAME/" "$FILE"
+grep -n "zama.ai/$REPO_NAME" "$FILE" | cut -d: -f1 | xargs -I{} sed -i -e "{}s/=>.*/=> .\/work_dir\/$REPO_NAME/" "$FILE"
diff --git a/scripts/upload_genesis.sh b/scripts/upload_genesis.sh
new file mode 100755
index 00000000..b28301d3
--- /dev/null
+++ b/scripts/upload_genesis.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -Eeuo pipefail
+
+S3_BUCKET_PATH="s3://zbc-testnet"
+S3_FULL_PATH="$S3_BUCKET_PATH/testnet_full_node"
+LOCAL_PATH_TO_NODE="./node"
+LOCAL_PATH_TO_EVMOSD="./running_node/node2"
+
+echo "Getting the privkey"
+docker compose -f docker-compose/docker-compose.validator.yml exec validator evmosd --home /root/.evmosd tendermint show-node-id > $LOCAL_PATH_TO_NODE/node_id
+
+echo "Getting the node_id"
+docker compose -f docker-compose/docker-compose.validator.yml exec validator evmosd --home /root/.evmosd keys unsafe-export-eth-key mykey1 --keyring-backend test > $LOCAL_PATH_TO_NODE/privkey
+
+echo "Uploading genesis.json to S3 bucket..."
+aws s3 cp $LOCAL_PATH_TO_EVMOSD/.evmosd/config/genesis.json $S3_FULL_PATH/genesis.json
+
+echo "Uploading privkey to S3 bucket..."
+aws s3 cp $LOCAL_PATH_TO_NODE/privkey $S3_FULL_PATH/privkey
+
+echo "Uploading node_id to S3 bucket..."
+aws s3 cp $LOCAL_PATH_TO_NODE/node_id $S3_FULL_PATH/node_id
+