diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f5dbc01 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Airchains + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 816c923..e5d222f 100644 --- a/README.md +++ b/README.md @@ -1 +1,43 @@ -# EVM station \ No newline at end of file +# EVM station + +## Introduction + +The EVM-based Cosmos Chain is a cutting-edge platform for building decentralized applications (DApps) and smart contracts. Leveraging the scalability of Cosmos and the flexibility of the Ethereum Virtual Machine, our platform offers a unique environment for blockchain developers. + + +## Prerequisites +The project requires: + +- [Go](https://golang.org/dl/) (Version 1.22 or later) +- [jq](https://stedolan.github.io/jq/download/): A lightweight and flexible command-line JSON processor. + + +## Getting Started + +- To begin using this project, firstly clone this repository to your local machine. +```shell + git clone https://github.com/airchains-network/evm-station + cd evm-station; + go mod tidy; +``` + + + +## Running the project + +- To run the project, execute the following command: +```shell + /bin/bash ./scripts/local-setup.sh +``` + + + +## Contributing +Contributions are greatly appreciated. You can make contributions by creating issues, fixing bugs, or suggesting new features. Feel free to fork this repository and create pull requests to affect changes. + + +## License +This project is licensed under the MIT license - see the [LICENSE](LICENSE) file for more information. + +## Contact +For any inquiries or constructive feedback, please contact this email contact@airchains.io diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index c8da8cb..0000000 --- a/docker/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# How to run dual node local network - -1. make your changes in code -2. mage cosmos:dockerx base arm64 && mage cosmos:dockerx seed arm64 - -To run a 4 nodes test: -3. in terminal window 1: cd e2e/testapp/docker && sh ./reset-temp.sh && docker-compose up -4. in terminal window 2: cd e2e/testapp/docker && sh ./network-init-4.sh -5. in terminal window 2: docker exec -it polard-node0 bash -c ./scripts/seed-start.sh -6. in terminal window 3: docker exec -it polard-node1 bash -c ./scripts/seed-start.sh -7. in terminal window 4: docker exec -it polard-node2 bash -c ./scripts/seed-start.sh -8. in terminal window 5: docker exec -it polard-node3 bash -c ./scripts/seed-start.sh - -note: added "-it" in steps 5-8, so that ctrl+c can kill the process - -To run a 2 nodes test: -in step 4, use network-init-2.sh instead -then use 2 nodes in the rest of the steps diff --git a/go.sum b/go.sum index e3966d5..598a7b4 100644 --- a/go.sum +++ b/go.sum @@ -389,6 +389,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/cometbft/cometbft v0.38.2 h1:io0JCh5EPxINKN5ZMI5hCdpW3QVZRy+o8qWe3mlJa/8= +github.com/cometbft/cometbft v0.38.2/go.mod h1:PIi48BpzwlHqtV3mzwPyQgOyOnU94BNBimLS2ebBHOg= github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= diff --git a/scripts/local-setup.sh b/scripts/local-setup.sh index 24668eb..1d0c708 100755 --- a/scripts/local-setup.sh +++ b/scripts/local-setup.sh @@ -2,30 +2,11 @@ command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; } - -# Check if ../.tmp directory exists -if [ -d "../.tmp" ]; then - read -p "The evm station directory already exists. Do you want to continue? (y/n) " -n 1 -r - echo # Move to a new line - if [[ $REPLY =~ ^[Nn]$ ]] - then - echo "Running evmstationd start command." - ../build/bin/evmstationd start --pruning=nothing "" --log_level info --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "../.tmp/polard" - exit 0 - fi -fi - - -rm -rf ../.tmp -rm -rf ../build -cd ../ -make clean -make build -cd scripts declare -a KEYS KEYS[0]="dev0" KEYS[1]="dev1" KEYS[2]="dev2" +# shellcheck disable=SC2145 echo "KEYS: ${KEYS[@]}" CHAINID="nooob-69420" @@ -34,8 +15,8 @@ PersistentPeers="id1@ip1:port1,id2@ip2:port2" # Example format; replace with you KEYRING="test" KEYALGO="eth_secp256k1" LOGLEVEL="info" -# Set dedicated home directory for the ../build/bin/evmstationd instance -HOMEDIR="../.tmp/polard" +# Set dedicated home directory for the ./build/bin/evmstationd instance +HOMEDIR="./.tmp/polard" # to trace evm #TRACE="--trace" TRACE="" @@ -47,6 +28,25 @@ GENESIS=$HOMEDIR/config/genesis.json TMP_GENESIS=$HOMEDIR/config/tmp_genesis.json +# Check if ../.tmp directory exists +if [ -d "../.tmp" ]; then + read -p "The evm station directory already exists. Do you want to continue? (y/n) " -n 1 -r + echo # Move to a new line + if [[ $REPLY =~ ^[Nn]$ ]] + then + echo "Running evmstationd start command." + ./build/bin/evmstationd start --pruning=nothing "" --log_level info --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "$HOMEDIR" + exit 0 + fi +fi + + +rm -rf ./.tmp +rm -rf ./build +make clean +make build + + #EVM Config @@ -57,18 +57,18 @@ EVMCHAINID="69420" set -e - ../build/bin/evmstationd init $MONIKER -o --chain-id $CHAINID --home "$HOMEDIR" + ./build/bin/evmstationd init $MONIKER -o --chain-id $CHAINID --home "$HOMEDIR" # Set client config - ../build/bin/evmstationd config set client keyring-backend $KEYRING --home "$HOMEDIR" - ../build/bin/evmstationd config set client chain-id "$CHAINID" --home "$HOMEDIR" + ./build/bin/evmstationd config set client keyring-backend $KEYRING --home "$HOMEDIR" + ./build/bin/evmstationd config set client chain-id "$CHAINID" --home "$HOMEDIR" # If keys exist they should be deleted for KEY in "${KEYS[@]}"; do - ../build/bin/evmstationd keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --home "$HOMEDIR" + ./build/bin/evmstationd keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --home "$HOMEDIR" done - # Change parameter token denominations to abera + # Change parameter token denominations to absera jq '.app_state["staking"]["params"]["bond_denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["crisis"]["constant_fee"]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="abera"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -85,32 +85,25 @@ sed -i "/\[polaris\.polar\.chain\]/!b;n;c chain-id = \"$EVMCHAINID\"" ../.tmp/po # Allocate genesis accounts (cosmos formatted addresses) for KEY in "${KEYS[@]}"; do - ../build/bin/evmstationd genesis add-genesis-account $KEY 100000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" + ./build/bin/evmstationd genesis add-genesis-account $KEY 100000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" done # Test Account # absurd surge gather author blanket acquire proof struggle runway attract cereal quiz tattoo shed almost sudden survey boring film memory picnic favorite verb tank # 0xfffdbb37105441e14b0ee6330d855d8504ff39e705c3afa8f859ac9865f99306 - ../build/bin/evmstationd genesis add-genesis-account cosmos1yrene6g2zwjttemf0c65fscg8w8c55w58yh8rl 69000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" + ./build/bin/evmstationd genesis add-genesis-account cosmos1yrene6g2zwjttemf0c65fscg8w8c55w58yh8rl 69000000000000000000000000abera --keyring-backend $KEYRING --home "$HOMEDIR" # Sign genesis transaction - ../build/bin/evmstationd genesis gentx ${KEYS[0]} 1000000000000000000000abera --keyring-backend $KEYRING --chain-id $CHAINID --home "$HOMEDIR" - ## In case you want to create multiple validators at genesis - ## 1. Back to `../build/bin/evmstationd keys add` step, init more keys - ## 2. Back to `../build/bin/evmstationd add-genesis-account` step, add balance for those - ## 3. Clone this ~/.../build/bin/evmstationd home directory into some others, let's say `~/.cloned../build/bin/evmstationd` - ## 4. Run `gentx` in each of those folders - ## 5. Copy the `gentx-*` folders under `~/.cloned../build/bin/evmstationd/config/gentx/` folders into the original `~/.../build/bin/evmstationd/config/gentx` + ./build/bin/evmstationd genesis gentx ${KEYS[0]} 1000000000000000000000abera --keyring-backend $KEYRING --chain-id $CHAINID --home "$HOMEDIR" - # Collect genesis tx - ../build/bin/evmstationd genesis collect-gentxs --home "$HOMEDIR" + ./build/bin/evmstationd genesis collect-gentxs --home "$HOMEDIR" # Run this to ensure everything worked and that the genesis file is setup correctly - ../build/bin/evmstationd genesis validate-genesis --home "$HOMEDIR" + ./build/bin/evmstationd genesis validate-genesis --home "$HOMEDIR" if [[ $1 == "pending" ]]; then echo "pending mode is on, please wait for the first block committed." fi # Start the node (remove the --pruning=nothing flag if historical queries are not needed)m -../build/bin/evmstationd start --pruning=nothing "$TRACE" --log_level $LOGLEVEL --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "$HOMEDIR" \ No newline at end of file +./build/bin/evmstationd start --pruning=nothing "$TRACE" --log_level $LOGLEVEL --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "$HOMEDIR" \ No newline at end of file