A modular sidechain for Steem, written in TypeScript (ESM), using MongoDB for storage, Kafka for notifications, WebSocket for P2P networking, and Express for HTTP APIs.
Echelon operates as a sidechain for Steem with these key characteristics:
- Processes only transactions that originate from Steem custom_json operations with our specific sidechain ID
- Implements block recovery/replay mechanisms to allow nodes to synchronize with peers
- Supports special sync mode to rapidly catch up with Steem blockchain when behind
- Steem custom_json transaction listener
- Hardcoded operations (transaction logic)
- DPoS consensus with witness scheduling and rewards
- P2P networking via WebSocket
- MongoDB for accounts, tokens, and blockchain state
- Kafka for event notifications
- Express HTTP API for querying accounts, tokens, etc.
- Coming soon
- Block Recovery: Nodes can recover and replay blocks from any peers in the network
- Chain Replay: New nodes automatically replay the chain history until they catch up with the network head
- Steem Sync Mode: Accelerated catch-up mechanism with reduced block time when the network falls behind Steem
- NodeJS v20 or higher
- MongoDB v8 or higher
- PM2 (optional, for production)
- Update package list and add MongoDB repo
sudo apt update
# Install prerequisites
sudo apt-get install -y gnupg curl
# Add MongoDB 8.0 PGP key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
# Add MongoDB repository for the appropriate Ubuntu version (change `focal` if needed)
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/8.0 multiverse" | \
sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list- Install and start MongoDB after adding the repo
sudo apt-get update
# Install MongoDB
sudo apt-get install -y mongodb-org
# Start MongoDB service
sudo systemctl start mongod
# Enable MongoDB to start on boot
sudo systemctl enable mongod- (Optional) Install NVM (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# Ensure nvm is available in the current terminal session
source ~/.bashrc
# Install Node.js version 20.19.4
nvm install 20.19.4- (Optional) Install PM2 globally
npm install pm2 -g- (Optional) Download and restore the latest backup from https://meeray.com/backups/
mongorestore --uri="mongodb://127.0.0.1:27017" --archive=meeray-latest.gz --gzip- (Optional) Create a logrotate config for MongoDB (rotate logs daily, keep 14 days, compress, and create a new log file for each day)
sudo nano /etc/logrotate.d/mongodbPaste the following content into the file:
/var/log/mongodb/mongod.log {
daily
rotate 14
compress
delaycompress
missingok
notifempty
create 640 mongodb adm
sharedscripts
postrotate
if pgrep mongod > /dev/null; then
kill -USR1 $(pidof mongod)
fi
endscript
}
- Clone the repository
git clone https://github.com/FutureShockco/echelon.git
cd echelon- Install dependencies
npm install- Configure your node
cp .env.example .env
# Edit .env with your settings (you must obtain a key pair first using /witnesses/generate-keypair endpoint, this is only for active witnesses)3a. (Optionnal) Setup your bridge
# Create your STEEM and SBD wrapped tokens on the sidechain then edit .env with your settings and the steem account informations (which should be the issuer of the wrapped tokens), so when a STEEM or SBD deposit are made to this particular account it can mint the wrapped tokens.- Start MongoDB
mongod --dbpath /your/db/path- Start the node
node start.jsFor production:
pm2 start scripts/start.sh --interpreter bash --name "echelon"The easiest way to run a Echelon node and MongoDB is with Docker Compose. This will automatically build the app, set up MongoDB, and handle environment variables.
- Docker and Docker Compose installed
-
Clone the repository:
git clone https://github.com/FutureShockco/echelon.git cd echelon -
(Optional) Edit the
.envfile to customize your node settings. -
Build and start the containers:
docker-compose build --no-cache docker-compose up
This will start both the Echelon node and MongoDB. The node will connect to MongoDB using the correct Docker network.
-
(Optional) Restore the latest backup:
- Download the backup file:
curl -o ./meeray-latest.gz https://meeray.com/backups/meeray-latest.gz
- Restore into the running MongoDB container:
docker cp ./meeray-latest.gz meeray-mongo:/meeray-latest.gz docker exec -it meeray-mongo mongorestore --archive=/meeray-latest.gz --gzip --nsInclude=meeray.*
- Download the backup file:
- The node will use environment variables from
.envand any overrides indocker-compose.yml. - To run multiple nodes, duplicate the
node1service indocker-compose.ymland adjust ports and environment variables as needed. - For development, you can still use
npm run devlocally if you have Node.js and MongoDB installed.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project was originally forked from Avalon, but it has since undergone extensive modifications, improvements, a complete rewrite from JavaScript to TypeScript, and new features that make it a unique evolution of the original concept.
We appreciate the foundation laid by the Avalon developers and acknowledge their contributions to the open-source community.
This project is licensed under the MIT License - see the LICENSE file for details.