Skip to content

Commit

Permalink
Add detailed README
Browse files Browse the repository at this point in the history
This commit added a more comprehensive introduction, prerequisites, getting started guide, run instructions, contribution and contact details have been added to the main README. Additionally, an MIT license file has been included and some adjustments to the local setup script have been implemented for a smoother launch.
  • Loading branch information
Noooblien committed Apr 9, 2024
1 parent 7231373 commit fc8644c
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 59 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# EVM station
# 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 [email protected]
18 changes: 0 additions & 18 deletions docker/README.md

This file was deleted.

2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
73 changes: 33 additions & 40 deletions scripts/local-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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=""
Expand All @@ -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

Expand All @@ -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"
Expand All @@ -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"
./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"

0 comments on commit fc8644c

Please sign in to comment.