# README
spike-web3-server quick start
Prequisition
SDK
- Go.
https://go.dev/ - Morails.
https://moralis.io/ - bscscan.
https://bscscan.com/ - Redis.
https://redis.io/ - MySQL.
https://www.mysql.com/ - ChainStack.
https://chainstack.com/
Services
- Signature Service.
https://github.com/spike-engine/spike-signature-server
Build and install spike-web3-server
- Clone the repository
git clone https://github.com/spike-engine/spike-web3-server.git
cd spike-web3-server/
- Install all the dependencies
go mod tidy
- Install swagger
go get -u github.com/swaggo/swag/cmd/swag
go install github.com/swaggo/swag/cmd/swag
sudo mv $(go env GOPATH)/bin/swag /usr/local/bin
swag -v
if you want to update swagger doc, please execute :
swag init
- Make build
go build -o spike-web3-server ./main.go
- Update Config
cp config-example.toml config.toml
- Run
./spike-web3-server
Register spike as a system service
- Link server into system binary path
sudo ln ./spike-web3-server /usr/local/bin
- Copy config file into spike home
sudo mkdir -p /etc/spike/
sudo cp ./config.toml /etc/spike/config-web3.toml
- Startup script
sudo vim /etc/systemd/system/spike-web3-server.service
Specify the path to the binary
[Service]
ExecStart=/usr/local/bin/spike-web3-server
Environment=SPIKE_WEB3_CONFIG=/etc/spike/config.toml
Restart=always
RestartSec=5
sudo systemctl daemon-reload
sudo systemctl start spike-web3-server.service
sudo journalctl -u spike-web3-server.service -f
Config
By default, spike-web3-server reads configuration from config.toml under the current folder. If it is not created, you may copy from config-example.config. If you need to specify the config file, you may set the enviornment as follows:
export SPIKE_WEB3_CONFIG=~/spike_home/config-web3.toml
Database
# create database, replace 'spike_web3_server' with DbName config
mysql -u root -p <sql/create-db.sql
# create tables
mysql -u root -p spike_web3_server < sql/create-tables.sql
Swagger
If you run the project successfully, you can visit http://localhost:3000/swagger/index.html. And you can see some interface information.
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author