-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from Alzymologist/beta-release
major: 0.3 release preparation
- Loading branch information
Showing
10 changed files
with
188 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
[package] | ||
name = "kalatori" | ||
authors = ["Alzymologist Oy <[email protected]>"] | ||
version = "0.2.8" | ||
authors = [ | ||
"Alexander Slesarev <[email protected]>", | ||
"Vova Lando <[email protected]>", | ||
"Artyom Sheviakov <[email protected]>", | ||
] | ||
version = "0.3.0" | ||
edition = "2021" | ||
description = "A gateway daemon for Kalatori." | ||
license = "GPL-3.0-or-later" | ||
homepage = "https://github.com/Alzymologist/Kalatori-backend" | ||
repository = "https://github.com/Alzymologist/Kalatori-backend" | ||
readme = true | ||
documentation = "README.md" | ||
readme = "README.md" | ||
keywords = ["substrate", "blockchain", "finance", "service", "middleware"] | ||
categories = ["finance"] | ||
exclude = [".github", "cliff.toml", "Dockerfile", "chopsticks/", "configs", "is_version_greater.sh", "shoot.sh", "start.sh", "/tests"] | ||
rust-version = "1.82" | ||
|
||
[dependencies] | ||
|
@@ -61,10 +68,10 @@ async-lock = "3" | |
time = "0.3" | ||
reqwest = "0.12" | ||
|
||
substrate_parser = { git = "https://github.com/Alzymologist/substrate-parser" } | ||
substrate-constructor = { git = "https://github.com/Alzymologist/substrate-constructor" } | ||
mnemonic-external = { git = "https://github.com/Alzymologist/mnemonic-external" } | ||
substrate-crypto-light = { git = "https://github.com/Alzymologist/substrate-crypto-light" } | ||
substrate_parser = "0.7.0" | ||
substrate-constructor = "0.2.0" | ||
mnemonic-external = "0.1.0" | ||
substrate-crypto-light = "0.1.0" | ||
|
||
[build-dependencies] | ||
# Don't forget to update me in `[dependencies]`! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,133 @@ | ||
## A gateway daemon for Kalatori | ||
## A Gateway Daemon for Kalatori | ||
|
||
!!! KALATORI IS IN PUBLIC BETA !!! | ||
|
||
Kalatori is an open-source daemon designed to enable secure and scalable blockchain payment processing. Licensed under GPLv3 ([LICENSE](LICENSE)), Kalatori currently supports assets on the Polkadot relay chain and its parachains. | ||
|
||
The daemon derives unique accounts for each payment using a provided seed phrase and outputs all payments to a specified recipient wallet. It also offers limited transaction tracking for order management. Kalatori operates in a multithreaded mode and supports multiple currencies configured in a simple TOML-based configuration file. | ||
|
||
Client facing frontends can communicate with Kalatori leveraging exposed API described in the [API documentation](https://alzymologist.github.io/kalatori-api). | ||
|
||
--- | ||
### Download | ||
|
||
Compiled binaries for Linux x86-64 can be found in the "Releases" section. | ||
Download the latest Docker container or x86-64 release from the [GitHub releases page](https://github.com/Alzymologist/Kalatori-backend/releases/latest). | ||
|
||
### Compile from the source | ||
--- | ||
|
||
To compile the daemon, the latest stable Rust compiler version is required. Then run the following command: | ||
### Compile from Source | ||
|
||
To compile the daemon, ensure you have the latest stable version of the Rust compiler installed. Then, run: | ||
|
||
```sh | ||
cargo b -r --workspace | ||
cargo build --release --workspace | ||
``` | ||
The compiled binaries will be located in the `target/release` path. | ||
|
||
### Project Structure | ||
|
||
- `chopsticks`: Contains configuration files for the Chopsticks tool and a Docker Compose setup for spawning Polkadot and AssetHub test chains. | ||
- `configs`: Contains configuration files for supported chains and assets. | ||
- `docs`: Includes project documentation. | ||
- `src`: The source code for the Kalatori daemon. | ||
- `tests`: Black-box test suite with a Docker Compose setup for testing the daemon. | ||
- `Dockerfile`: Instructions for building a Docker image of the daemon. | ||
|
||
### Configuration File Example | ||
|
||
For Polkadot and Asset Hub chains, the configuration file should look like this: | ||
|
||
```toml | ||
account-lifetime = 604800000 # 1 week. | ||
debug = true | ||
depth = 86400000 # 1 day. | ||
|
||
[[chain]] | ||
name = "polkadot" | ||
native-token = "DOT" | ||
decimals = 10 | ||
endpoints = [ | ||
"wss://rpc.polkadot.io", | ||
"wss://1rpc.io/dot", | ||
] | ||
|
||
[[chain]] | ||
name = "statemint" | ||
endpoints = [ | ||
"wss://polkadot-asset-hub-rpc.polkadot.io", | ||
"wss://statemint-rpc.dwellir.com", | ||
] | ||
|
||
[[chain.asset]] | ||
name = "USDC" | ||
id = 1337 | ||
|
||
[[chain.asset]] | ||
name = "USDt" | ||
id = 1984 | ||
``` | ||
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 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). | ||
### Environment variables | ||
|
||
Both variants have almost the same startup environment variables: | ||
- 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 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. | ||
Kalatori requires the following environment variables for configuration: | ||
- `KALATORI_HOST`: Address for the daemon's TCP socket server. | ||
- `KALATORI_SEED`: Seed phrase for account derivation. | ||
- `KALATORI_CONFIG`: Path to the chain configuration file in the configs directory. | ||
- `KALATORI_RECIPIENT`: The hexadecimal address to which received payments will be transferred. | ||
- `KALATORI_REMARK`: A string added to the transaction's remark field. | ||
|
||
### Examples | ||
### Usage Example | ||
|
||
A tipical command to run `kalatori` for the Polkadot chain may look like this: | ||
Run Kalatori for the Polkadot chain: | ||
|
||
```sh | ||
KALATORI_HOST="127.0.0.1:16726" \ | ||
KALATORI_CONFIG="configs/polkadot.toml" \ | ||
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_RECIPIENT="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" \ | ||
KALATORI_REMARK="test" \ | ||
kalatori | ||
``` | ||
```` | ||
|
||
And a command to run `kalatori-ah`for the Polkadot AssetHub chain may look like this: | ||
### Testing | ||
|
||
```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-ah-usdc.redb" \ | ||
KALATORI_RPC="wss://polkadot-asset-hub-rpc.polkadot.io" \ | ||
KALATORI_DESTINATION="0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" \ | ||
KALATORI_USD_ASSET="USDC" | ||
kalatori-ah | ||
``` | ||
The black-box test suite verifies the daemon's functionality by interacting with a running instance. Use the following steps to set it up: | ||
1. Start the daemon and test environment: | ||
```sh | ||
cd tests | ||
docker-compose up | ||
``` | ||
2. Run the tests manually using Yarn: | ||
```sh | ||
ct tests/kalatori-api-test-suite | ||
yarn | ||
yarn test | ||
``` | ||
### Testing | ||
Ensure the `DAEMON_HOST` environment variable points to the running daemon (default: `localhost:16726`). | ||
[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: | ||
For more details, refer to the [testing suite README.md](tests/kalatori-api-test-suite/README.md). | ||
### - Polkadot | ||
### Contributing | ||
Use the following command inside this repository root directory to run Chopstick with the Polkadot config example: | ||
We welcome contributions! Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on contributing and submitting pull requests. | ||
```sh | ||
npx @acala-network/chopsticks@latest -c chopsticks/pd.yml | ||
``` | ||
### License | ||
Then run `kalatori` with `KALATORI_RPC` set on the Chopsticks default server: | ||
Kalatori is open-source software licensed under the GPLv3 License. See the [LICENSE](LICENSE) file for more details. | ||
```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 | ||
``` | ||
### Community and Support | ||
### - Polkadot Asset Hub | ||
Join the discussion and get support on: | ||
- [Kalatori Matrix](https://matrix.to/#/#Kalatori-support:matrix.zymologia.fi) | ||
- [GitHub Discussions](https://github.com/Alzymologist/Kalatori-backend/discussions) | ||
Use the following command inside this repository root directory to run Chopstick with the Polkadot Asset Hub config example: | ||
### Roadmap | ||
```sh | ||
npx @acala-network/chopsticks@latest -c chopsticks/pd-ah.yml | ||
``` | ||
Refer to the Kalatori project [board](https://github.com/orgs/Alzymologist/projects/2) and [milestones](https://github.com/Alzymologist/Kalatori-backend/milestones) for the current roadmap and upcoming features. | ||
Then run `kalatori-ah` with `KALATORI_RPC` set on the Chopsticks default server, and `KALATORI_USD_ASSET` set on the USD asset being tested: | ||
### Acknowledgments | ||
- Polkadot community | ||
- Liberland team | ||
```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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
account-lifetime = 86400000 # 1 day. | ||
depth = 3600000 # 1 hour. | ||
debug = true | ||
|
||
[[chain]] | ||
name = "rococo" | ||
native-token = "DOT" | ||
decimals = 10 | ||
endpoints = [ | ||
"wss://node-polkadot.zymologia.fi", | ||
] | ||
|
||
[[chain]] | ||
name = "statemint" | ||
endpoints = [ | ||
"wss://node-polkadot-ah.zymologia.fi", | ||
] | ||
|
||
[[chain.asset]] | ||
name = "USDC" | ||
id = 1337 | ||
|
||
[[chain.asset]] | ||
name = "USDt" | ||
id = 1984 |
Oops, something went wrong.