epicchain-go

module
v0.0.0-...-886a677 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2024 License: MIT

README

EpicChain Go Node and SDK

EpicChain Node and SDK for the EpicChain blockchain.


codecov GithubWorkflows Tests Report GoDoc GitHub release (latest SemVer) License

Overview

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).

Getting Started

Installation

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:

  1. Download the Binary: Obtain the pre-built binary from the releases page.
  2. Docker Image: Use the Docker image available on Docker Hub. The :latest tag points to the most recent release.
  3. Build from Source: Compile the binary yourself by following the instructions below.
Building from Source

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.

Building on Windows

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.

Running a Node

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.

Docker

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).

Importing Chain Dumps

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.

Running a Private Network

For detailed instructions on running a private network, refer to the consensus node documentation.

Smart Contract Development

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.

Directories

Path Synopsis
cli
app
options
Package options contains a set of common CLI options and helper functions to use them.
Package options contains a set of common CLI options and helper functions to use them.
txctx
Package txctx contains helper functions that deal with transactions in CLI context.
Package txctx contains helper functions that deal with transactions in CLI context.
vm
examples
engine Module
events Module
iterator Module
nft-nd Module
nft-nd-nns Module
oracle Module
runtime Module
storage Module
timer Module
token Module
internal
testcli
Package testcli contains auxiliary code to test CLI commands.
Package testcli contains auxiliary code to test CLI commands.
pkg
compiler
Package compiler implements Go to NEF smart contract compiler.
Package compiler implements Go to NEF smart contract compiler.
config
Package config contains NeoGo node configuration definition.
Package config contains NeoGo node configuration definition.
config/limits
Package limits contains a number of system-wide hardcoded constants.
Package limits contains a number of system-wide hardcoded constants.
config/netmode
Package netmode contains well-known network magic numbers.
Package netmode contains well-known network magic numbers.
consensus
Package consensus contains Neo consensus node implementation.
Package consensus contains Neo consensus node implementation.
core
Package core implements Neo ledger functionality.
Package core implements Neo ledger functionality.
core/block
Package block contains Neo block definition.
Package block contains Neo block definition.
core/interop
Package interop contains implementations of Neo interop functions.
Package interop contains implementations of Neo interop functions.
core/mpt
Package mpt implements MPT (Merkle-Patricia Trie).
Package mpt implements MPT (Merkle-Patricia Trie).
core/native
Package native contains Neo native contracts.
Package native contains Neo native contracts.
core/native/nativehashes
package nativehashes contains hashes of all native contracts in their LE and Uint160 representation.
package nativehashes contains hashes of all native contracts in their LE and Uint160 representation.
core/statesync
Package statesync implements module for the P2P state synchronisation process.
Package statesync implements module for the P2P state synchronisation process.
core/storage/dbconfig
Package dbconfig is a micropackage that contains storage DB configuration options.
Package dbconfig is a micropackage that contains storage DB configuration options.
core/storage/dboper
Package dboper contains a type used to represent single DB operation.
Package dboper contains a type used to represent single DB operation.
core/transaction
Package transaction contains Neo transaction definition.
Package transaction contains Neo transaction definition.
crypto
Package crypto contains implementation of crypto functions used by Neo.
Package crypto contains implementation of crypto functions used by Neo.
crypto/hash
Package hash contains wrappers for Neo hashing algorithms.
Package hash contains wrappers for Neo hashing algorithms.
crypto/keys
Package keys wraps public/private keys and implements NEP-2 and WIF.
Package keys wraps public/private keys and implements NEP-2 and WIF.
encoding/address
Package address implements conversion of a script hash to/from a Neo address.
Package address implements conversion of a script hash to/from a Neo address.
encoding/base58
Package base58 wraps generic base58 encoder with NEO-specific checksumming.
Package base58 wraps generic base58 encoder with NEO-specific checksumming.
encoding/bigint
Package bigint implements Neo-specific big.Int (de)serialization to/from []byte.
Package bigint implements Neo-specific big.Int (de)serialization to/from []byte.
encoding/fixedn
Package fixedn implements fixed point integers with arbitrary precision.
Package fixedn implements fixed point integers with arbitrary precision.
io
neorpc
Package neorpc contains a set of types used for JSON-RPC communication with Neo servers.
Package neorpc contains a set of types used for JSON-RPC communication with Neo servers.
neotest
Package neotest contains a framework for automated contract testing.
Package neotest contains a framework for automated contract testing.
neotest/chain
Package chain contains functions creating new test blockchain instances.
Package chain contains functions creating new test blockchain instances.
rpcclient
Package rpcclient implements NEO-specific JSON-RPC 2.0 client.
Package rpcclient implements NEO-specific JSON-RPC 2.0 client.
rpcclient/actor
Package actor provides a way to change chain state via RPC client.
Package actor provides a way to change chain state via RPC client.
rpcclient/gas
Package gas provides a convenience wrapper for GAS contract to use it via RPC.
Package gas provides a convenience wrapper for GAS contract to use it via RPC.
rpcclient/invoker
Package invoker provides a convenient wrapper to perform test calls via RPC client.
Package invoker provides a convenient wrapper to perform test calls via RPC client.
rpcclient/management
Package management provides an RPC wrapper for the native ContractManagement contract.
Package management provides an RPC wrapper for the native ContractManagement contract.
rpcclient/neo
Package neo provides an RPC-based wrapper for the NEOToken contract.
Package neo provides an RPC-based wrapper for the NEOToken contract.
rpcclient/nep11
Package nep11 contains RPC wrappers for NEP-11 contracts.
Package nep11 contains RPC wrappers for NEP-11 contracts.
rpcclient/nep17
Package nep17 contains RPC wrappers to work with NEP-17 contracts.
Package nep17 contains RPC wrappers to work with NEP-17 contracts.
rpcclient/neptoken
Package neptoken contains RPC wrapper for common NEP-11 and NEP-17 methods.
Package neptoken contains RPC wrapper for common NEP-11 and NEP-17 methods.
rpcclient/nns
Package nns provide RPC wrappers for the non-native NNS contract.
Package nns provide RPC wrappers for the non-native NNS contract.
rpcclient/notary
Package notary provides an RPC-based wrapper for the Notary subsystem.
Package notary provides an RPC-based wrapper for the Notary subsystem.
rpcclient/oracle
Package oracle allows to work with the native OracleContract contract via RPC.
Package oracle allows to work with the native OracleContract contract via RPC.
rpcclient/policy
Package policy allows to work with the native PolicyContract contract via RPC.
Package policy allows to work with the native PolicyContract contract via RPC.
rpcclient/rolemgmt
Package rolemgmt allows to work with the native RoleManagement contract via RPC.
Package rolemgmt allows to work with the native RoleManagement contract via RPC.
rpcclient/unwrap
Package unwrap provides a set of proxy methods to process invocation results.
Package unwrap provides a set of proxy methods to process invocation results.
smartcontract
Package smartcontract contains functions to deal with widely used scripts and NEP-14 Parameters.
Package smartcontract contains functions to deal with widely used scripts and NEP-14 Parameters.
smartcontract/manifest/standard
Package standard contains interfaces for well-defined standards and a function for checking if an arbitrary manifest complies with them.
Package standard contains interfaces for well-defined standards and a function for checking if an arbitrary manifest complies with them.
smartcontract/zkpbinding
Package zkpbinding contains a set of helper functions aimed to generate and interact with Verifier smart contract written in Go and using Groth-16 proving system over BLS12-381 elliptic curve to verify proofs.
Package zkpbinding contains a set of helper functions aimed to generate and interact with Verifier smart contract written in Go and using Groth-16 proving system over BLS12-381 elliptic curve to verify proofs.
util/bitfield
Package bitfield provides a simple and efficient arbitrary size bit field implementation.
Package bitfield provides a simple and efficient arbitrary size bit field implementation.
util/slice
Package slice contains byte slice helpers.
Package slice contains byte slice helpers.
vm
vm/vmstate
Package vmstate contains a set of VM state flags along with appropriate type.
Package vmstate contains a set of VM state flags along with appropriate type.
interop Module
scripts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL