A service which perform the below operations on each state
- API Check to get the Balance of Wallet
- Fetch and store the subgraph data into IPFS, In this service we are using Omen xDai subgraph for fetch data(https://gateway.thegraph.com/api/{api_key}/subgraphs/id/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz)
- Retrive the IPFS for data validation
- Decession making for Single Tx preparation / Multi Tx preparation Based on Balance
- If Balance is more then the threashhold defined then preparaing Multi Tx for Native and a token
- Genearate hash for the same and submit for Transcation
- Python
>=3.10
- Tendermint
==0.34.19
- IPFS node
==0.6.0
- Pip
- Poetry
- Docker Engine
- Docker Compose
- Set Docker permissions so you can run containers as non-root user
-
Clone this repo:
git clone git@github.com:kuresh-isotrp/academy-learning-service-template.git
-
Create the virtual environment:
cd academy-learning-service poetry shell poetry install
-
Sync packages:
autonomy packages sync --update-packages
-
Prepare a
keys.json
file containing wallet address and the private key for each of the four agents.autonomy generate-key ethereum -n 4
-
Prepare a
ethereum_private_key.txt
file containing one of the private keys fromkeys.json
. Ensure that there is no newline at the end. -
Deploy a Safe on Gnosis (it's free) and set your agent addresses as signers. Set the signature threshold to 3 out of 4.
-
Create a Tenderly account and from your dashboard create a fork of Gnosis chain (virtual testnet).
-
From Tenderly, fund your agents and Safe with a small amount of xDAI, i.e. $0.02 each.
-
Make a copy of the env file:
cp sample.env .env
-
Fill in the required environment variables in .env. These variables are:
ALL_PARTICIPANTS
,GNOSIS_LEDGER_RPC
,COINGECKO_API_KEY
,SAFE_CONTRACT_ADDRESS
. You will need to get a Coingecko. SetGNOSIS_LEDGER_RPC
to your Tenderly fork Admin RPC.- set TRANSFER_TARGET_ADDRESS as the target address where you want to do the transfer
- set SUBGRAPH_URL to read the data and pused to IPFS.In this service we have used Omen xDai subgraph for fetch data https://gateway.thegraph.com/api/{api_key}/subgraphs/id/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz
- set MULTI_SEND_CONTRACT_TOKEN_ADDRESS as the token for multisend on gnosis chain
- set TRANSFER_CONTRACT_TOKEN_ADDRESS as the token for ERC-20 on gnosis chain
-
Verify that
ALL_PARTICIPANTS
in.env
contains only 1 address. -
Run the agent:
bash run_agent.sh
-
Check that Docker is running:
docker
-
Verify that
ALL_PARTICIPANTS
in.env
contains 4 addresses. -
Run the service:
bash run_service.sh
-
Look at the service logs for one of the agents (on another terminal):
docker logs -f learningservice_abci_0