From 05fac9fbc93d21c140630a438cbe1b6654f442ce Mon Sep 17 00:00:00 2001 From: Fluid <90795031+fluiderson@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:37:08 +0200 Subject: [PATCH 1/3] Add README --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..963e8ac --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +The daemon for Kalatori consists of 2 variants: +- `kalatori` may be used for the Polkadot chain and DOT, its native currency. +- `kalatori-ah` may be used for the Polkadot Asset Hub chain and the USDT (1984) asset. + +Both variants have almost the same startup environment variables: +- KALATORI_HOST: an address where the daemon will open its TCP socket server. +- KALATORI_SEED: a seed that will be used as a base for the account derivation. +- KALATORI_DATABASE: a path to the daemon future/existing database. +- KALATORI_RPC: an address of a Substrate RPC server. +- KALATORI_OVERRIDE_RPC: add this variable to allow changing RPC server address in the database. +- KALATORI_DECIMALS: set decimals for the chain native currency (presents only in `kalatori`). +- KALATORI_DESTINATION: a hexadecimal address of the account that the daemon will send all payments to. From f4fddfa8fb3516d017b8365c7bc18ef9613a748a Mon Sep 17 00:00:00 2001 From: Fluid <90795031+fluiderson@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:53:05 +0200 Subject: [PATCH 2/3] Add more info --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 963e8ac..a056b36 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +To compile the daemon, the latest stable Rust compiler version is required. Then run the following command: +```bash +cargo b -r --workspace +``` +Compiled binaries may be found in the `target/release` path. + The daemon for Kalatori consists of 2 variants: - `kalatori` may be used for the Polkadot chain and DOT, its native currency. - `kalatori-ah` may be used for the Polkadot Asset Hub chain and the USDT (1984) asset. @@ -10,3 +16,25 @@ Both variants have almost the same startup environment variables: - KALATORI_OVERRIDE_RPC: add this variable to allow changing RPC server address in the database. - KALATORI_DECIMALS: set decimals for the chain native currency (presents only in `kalatori`). - KALATORI_DESTINATION: a hexadecimal address of the account that the daemon will send all payments to. + +For example, a tipical command to run `kalatori` may look like this: +```bash +KALATORI_HOST="127.0.0.1:16726" \ +KALATORI_SEED="bottom drive obey lake curtain smoke basket hold race lonely fit walk" \ +KALATORI_DATABASE="database.redb" \ +KALATORI_RPC="wss://rpc.polkadot.io" \ +KALATORI_DECIMALS="12" \ +KALATORI_DESTINATION="0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" \ +kalatori +``` + +And a command to run `kalatori-ah` may look like this: + +```bash +KALATORI_HOST="127.0.0.1:16726" \ +KALATORI_SEED="bottom drive obey lake curtain smoke basket hold race lonely fit walk" \ +KALATORI_DATABASE="database.redb" \ +KALATORI_RPC="wss://polkadot-asset-hub-rpc.polkadot.io" \ +KALATORI_DESTINATION="0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" \ +kalatori-ah +``` From 2e98699922797149b2ef419108d187339b74cc5b Mon Sep 17 00:00:00 2001 From: Fluid <90795031+fluiderson@users.noreply.github.com> Date: Thu, 7 Mar 2024 21:02:34 +0200 Subject: [PATCH 3/3] Add Chopsticks configs, update readme --- README.md | 87 +++++++++++++++++++++++++++++++++++++------- chopsticks/pd-ah.yml | 15 ++++++++ chopsticks/pd.yml | 11 ++++++ 3 files changed, 100 insertions(+), 13 deletions(-) create mode 100644 chopsticks/pd-ah.yml create mode 100644 chopsticks/pd.yml diff --git a/README.md b/README.md index a056b36..db80f50 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,42 @@ +## A gateway daemon for Kalatori + +### Download + +Compiled binaries for Linux x86-64 can be found in the "Releases" section. + +### Compile from the source + To compile the daemon, the latest stable Rust compiler version is required. Then run the following command: -```bash + +```sh cargo b -r --workspace ``` -Compiled binaries may be found in the `target/release` path. +Compiled binaries can be found in the `target/release` path. + +### Structure & settings The daemon for Kalatori consists of 2 variants: -- `kalatori` may be used for the Polkadot chain and DOT, its native currency. -- `kalatori-ah` may be used for the Polkadot Asset Hub chain and the USDT (1984) asset. +- `kalatori` may be used for DOT, the native currency of the Polkadot and Polkadot Asset Hub chains. +- `kalatori-ah` may be used for the Polkadot Asset Hub chain and 2 of its assets: USDt (1984) & USD Coin (1337). Both variants have almost the same startup environment variables: -- KALATORI_HOST: an address where the daemon will open its TCP socket server. -- KALATORI_SEED: a seed that will be used as a base for the account derivation. +- KALATORI_HOST: an address where the daemon opens its TCP socket server. +- KALATORI_SEED: a seed that's used as a base for the account derivation. - KALATORI_DATABASE: a path to the daemon future/existing database. +> Note that a separate database file must be used for each supported currency, otherwise the database will be corrupted. - KALATORI_RPC: an address of a Substrate RPC server. -- KALATORI_OVERRIDE_RPC: add this variable to allow changing RPC server address in the database. -- KALATORI_DECIMALS: set decimals for the chain native currency (presents only in `kalatori`). +- KALATORI_OVERRIDE_RPC: add this variable with any value to allow changing an RPC server address in the database. +- KALATORI_DECIMALS: set decimals for the chain native currency. +> Presents only in `kalatori`. +- KALATORI_USD_ASSET: sets which USD asset should be used. Possible value is "USDT" or "USDC". +> Presents only in `kalatori-ah`. - KALATORI_DESTINATION: a hexadecimal address of the account that the daemon will send all payments to. -For example, a tipical command to run `kalatori` may look like this: -```bash +### Examples + +A tipical command to run `kalatori` for the Polkadot chain may look like this: + +```sh KALATORI_HOST="127.0.0.1:16726" \ KALATORI_SEED="bottom drive obey lake curtain smoke basket hold race lonely fit walk" \ KALATORI_DATABASE="database.redb" \ @@ -28,13 +46,56 @@ KALATORI_DESTINATION="0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7 kalatori ``` -And a command to run `kalatori-ah` may look like this: +And a command to run `kalatori-ah`for the Polkadot AssetHub chain may look like this: -```bash +```sh KALATORI_HOST="127.0.0.1:16726" \ KALATORI_SEED="bottom drive obey lake curtain smoke basket hold race lonely fit walk" \ -KALATORI_DATABASE="database.redb" \ +KALATORI_DATABASE="database-ah-usdc.redb" \ KALATORI_RPC="wss://polkadot-asset-hub-rpc.polkadot.io" \ KALATORI_DESTINATION="0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" \ +KALATORI_USD_ASSET="USDC" +kalatori-ah +``` + +### Testing + +[Chopsticks](https://github.com/AcalaNetwork/chopsticks) can be used to test the daemon out on a copy of a real network. This repository contains 2 config examples for testing: + +### - Polkadot + +Use the following command inside this repository root directory to run Chopstick with the Polkadot config example: + +```sh +npx @acala-network/chopsticks@latest -c chopsticks/pd.yml +``` + +Then run `kalatori` with `KALATORI_RPC` set on the Chopsticks default server: + +```sh +KALATORI_HOST="127.0.0.1:16726" \ +KALATORI_SEED="bottom drive obey lake curtain smoke basket hold race lonely fit walk" \ +KALATORI_RPC="ws://localhost:8000" \ +KALATORI_DECIMALS="12" \ +KALATORI_DESTINATION="0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" \ +kalatori +``` + +### - Polkadot Asset Hub + +Use the following command inside this repository root directory to run Chopstick with the Polkadot Asset Hub config example: + +```sh +npx @acala-network/chopsticks@latest -c chopsticks/pd-ah.yml +``` + +Then run `kalatori-ah` with `KALATORI_RPC` set on the Chopsticks default server, and `KALATORI_USD_ASSET` set on the USD asset being tested: + +```sh +KALATORI_HOST="127.0.0.1:16726" \ +KALATORI_SEED="bottom drive obey lake curtain smoke basket hold race lonely fit walk" \ +KALATORI_RPC="ws://localhost:8000" \ +KALATORI_DESTINATION="0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" \ +KALATORI_USD_ASSET="USDC" kalatori-ah ``` diff --git a/chopsticks/pd-ah.yml b/chopsticks/pd-ah.yml new file mode 100644 index 0000000..8e28c18 --- /dev/null +++ b/chopsticks/pd-ah.yml @@ -0,0 +1,15 @@ +endpoint: wss://polkadot-asset-hub-rpc.polkadot.io + +import-storage: + System: + Account: + - + - + - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY + - providers: 1 + data: + free: 1000000000000000 + Assets: + Account: + - [[1984, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], { balance: 1000000000 }] + - [[1337, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], { balance: 1000000000 }] diff --git a/chopsticks/pd.yml b/chopsticks/pd.yml new file mode 100644 index 0000000..8d69928 --- /dev/null +++ b/chopsticks/pd.yml @@ -0,0 +1,11 @@ +endpoint: wss://rpc.polkadot.io + +import-storage: + System: + Account: + - + - + - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY + - providers: 1 + data: + free: 1000000000000000