EpicChain Node and SDK for the EpicChain blockchain.
Welcome to EpicChainGo, the comprehensive platform for developing distributed applications on the EpicChain blockchain. EpicChainGo provides an extensive suite of tools and components essential for blockchain development, including but not limited to:
- Consensus Node: Handle the consensus mechanism of the EpicChain network. For detailed information, check out the consensus documentation.
- RPC Node & Client: Facilitate remote procedure calls to interact with the EpicChain blockchain. For more details, refer to RPC documentation.
- CLI Tool: Command-line interface tool for various blockchain operations. Instructions can be found in the CLI documentation.
- Smart Contract Compiler: Compile smart contracts written in Go into EpicChain VM bytecode. For guidance, see compiler documentation.
- EpicChain Virtual Machine: The virtual machine that executes smart contracts. More information is available in the VM documentation.
- Smart Contract Examples: Explore various smart contract examples to help you get started. See the examples directory for more.
- Oracle Service: Service for providing external data to the blockchain. Learn more in the oracle documentation.
- State Validation Service: Ensure the validity of the blockchain state. Detailed information can be found in the state validation documentation.
EpicChainGo is designed to be compatible with the EpicChain N3 protocol. However, if you need to work with the EpicChain Legacy protocol, you can find an implementation in the master-2.x branch and releases prior to version 0.80.0 (version 0.7X.Y track).
EpicChainGo is distributed as a single binary, encompassing all the features and functionality you need (please note that the smart contract compiler requires the Go compiler). You have several options for installation:
- Download the Binary: Obtain the pre-built binary from the releases page.
- Docker Image: Use the Docker image available on Docker Hub. The
:latest
tag points to the most recent release. - Build from Source: Compile the binary yourself by following the instructions below.
To build EpicChainGo from source, you need Go 1.20+ and make
installed:
make
The build process will generate the binary located at bin/epicchain-go
. We recommend using tagged releases rather than random revisions from the master
branch, as these may contain bugs or incompatibilities depending on the development stage.
For building EpicChainGo on Windows, install make
from the MinGW package. Then, you can build EpicChainGo with:
make
The resulting binary will be bin/epicchain-go.exe
.
To run an EpicChain node, it must be connected to a network, either a local network (commonly referred to as privnet
) or a public network (such as mainnet
or testnet
). Network configurations are managed via files, and EpicChainGo supports storing multiple configuration files in one directory (./config
by default) and switching between them using network flags.
To start a node on a private network, use:
./bin/epicchain-go node
To specify a different network, use an appropriate flag:
./bin/epicchain-go node --mainnet
Available network flags include:
--mainnet, -m
--privnet, -p
--testnet, -t
For running a consensus/committee node, please refer to the consensus documentation.
If you're using Windows, ensure that Windows Firewall is configured to allow inbound connections to the P2P port.
By default, the Docker image is configured to run a node on privnet
. To start a node using Docker, execute:
docker run -d --name epicchain-go -p 20332:20332 -p 20331:20331 nspccdev/epicchain-go
This command starts a node on privnet
and exposes ports 20332
(for P2P protocol) and 20331
(for JSON-RPC server).
To initialize your mainnet or testnet node with chain archives provided by NGD, follow these steps:
$ wget .../chain.acc.zip # download the chain dump file
$ unzip chain.acc.zip
$ ./bin/epicchain-go db restore -m -i chain.acc # use '-t' flag instead of '-m' for testnet
The import process differs from that of the C# node in that block importing is a separate mode. After importing, you can start the node normally.
For detailed instructions on running a private network, refer to the consensus node documentation.
For guidance on developing smart contracts with EpicChainGo, visit the EpicChainGo smart contract development workshop. This workshop provides examples of simple contracts that can be compiled, deployed, and run using the EpicChainGo compiler, SDK, and a private network. For specifics on translating Go code to EpicChain VM bytecode and contract limitations, consult the compiler documentation.
Explore more EpicChain smart contract examples written in Go in the examples directory.