c5c5e4c208
See https://github.com/nspcc-dev/neo-go/pull/2485#discussion_r872695786. Allows to avoid panic: ``` (18:28:29)[sergio@transient:morph-control-load]% downloads/neofs-adm morph -c configuration/config.yaml init --contracts downloads/neofs-contract-v0.15.1 Stage 1: transfer GAS to alphabet nodes. Waiting for transactions to persist... Stage 2: set notary and alphabet nodes in designate contract. Stage 2: already performed. Stage 3: deploy NNS contract. NNS contract is already deployed. Stage 4: deploy NeoFS contracts. Alphabet contract #0 is already deployed. Alphabet contract #1 is already deployed. Alphabet contract #2 is already deployed. Alphabet contract #3 is already deployed. audit contract is already deployed. balance contract is already deployed. container contract is already deployed. neofsid contract is already deployed. netmap contract is already deployed. proxy contract is already deployed. reputation contract is already deployed. subnet contract is already deployed. Waiting for transactions to persist... Stage 4.1: Transfer GAS to proxy contract. Stage 5: register candidates. Stage 6: transfer NEO to alphabet contracts. Stage 7: set addresses in NNS. NNS: Set alphabet0.neofs -> 2efeb27866fa774ec6bfb43babaadcc7b28f9bb7 NNS: Set alphabet1.neofs -> 5606bc6598a538ac59ded3caa842247b9b26097a NNS: Set alphabet2.neofs -> 2a8308cfd2706ddd5f67adfdf3954c6836806b5d NNS: Set alphabet3.neofs -> 718d0459e6787f0f13f1e1898bf2ce6bc4bb452d NNS: Set audit.neofs -> 54d516b36c3380efa2b2f26bda300b6c6302b8e7 NNS: Set balance.neofs -> 72b3255944524cb822788a7542c9d06cba208c0c NNS: Set container.neofs -> 20a20f4352a49f161eccb7d5a806fd46dcab81ea NNS: Set neofsid.neofs -> 04a3a71535689b820093cefe7ae188ed7591ad27 NNS: Set netmap.neofs -> 9a34c97b2ba6bd986fd9140a9c3d59059fa430f4 NNS: Set proxy.neofs -> 4eba34ec016f8709a511b02765a1195e31a921ea NNS: Set reputation.neofs -> 77b5b2cf596957cc05ca3d57503ef08d72792301 NNS: Set subnet.neofs -> b0abe16bc7f56b2e7e0694ae2b36207c6aaa8636 panic: error serializing *transaction.Transaction: transaction has no script goroutine 1 [running]: github.com/nspcc-dev/neo-go/pkg/io.GetVarSize({0xbf6240, 0xc0003634a0}) github.com/nspcc-dev/neo-go@v0.98.2/pkg/io/size.go:68 +0x6fd github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).AddNetworkFee(0xc0004080c0, 0xc0003634a0, 0x0, {0xc00000e248, 0x1, 0x93}) github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/rpc.go:966 +0x6b github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).CreateTxFromScript(0x0, {0x0, 0x0, 0x0}, 0x1, 0x0, 0x0, {0xc0001c7990, 0x1, 0x1}) github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/nep17.go:128 +0x345 github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.(*initializeContext).sendCommitteeTx(0xc00014a370, {0x0, 0x0, 0x0}, 0xc0016bcf30, 0x2) github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize.go:336 +0x131 github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.(*initializeContext).updateNNSGroup(0xc0001c7c88, {0x13, 0xd3, 0x6b, 0x85, 0x3e, 0x86, 0xbe, 0x77, 0xb7, ...}, ...) github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize_nns.go:89 +0x134 github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.(*initializeContext).setNNS(0xc00014a370) github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize_nns.go:74 +0x8c5 github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.initializeSideChainCmd(0x12a00e0, {0xc22a22, 0x4, 0x4}) github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize.go:94 +0x2bc github.com/spf13/cobra.(*Command).execute(0x12a00e0, {0xc00013a6c0, 0x4, 0x4}) github.com/spf13/cobra@v1.1.3/command.go:852 +0x60e github.com/spf13/cobra.(*Command).ExecuteC(0x129c760) github.com/spf13/cobra@v1.1.3/command.go:960 +0x3ad github.com/spf13/cobra.(*Command).Execute(...) github.com/spf13/cobra@v1.1.3/command.go:897 github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules.Execute(...) github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/root.go:48 main.main() github.com/nspcc-dev/neofs-node/cmd/neofs-adm/main.go:10 +0x25 zsh: exit 2 downloads/neofs-adm morph -c configuration/config.yaml init --contracts ``` |
||
---|---|---|
.circleci | ||
.docker | ||
.github | ||
cli | ||
config | ||
docs | ||
examples | ||
internal | ||
pkg | ||
scripts | ||
.dockerignore | ||
.gitignore | ||
.gitmodules | ||
.golangci.yml | ||
.travis.yml | ||
CHANGELOG.md | ||
codecov.yml | ||
CONTRIBUTING.md | ||
Dockerfile | ||
Dockerfile.wsc | ||
go.mod | ||
go.sum | ||
LICENSE.md | ||
Makefile | ||
neo-go.service.template | ||
README.md | ||
ROADMAP.md |
Go Node and SDK for the Neo blockchain.
Overview
This project aims to be a full port of the original C# Neo project. A complete toolkit for the NEO blockchain, including:
- Consensus node
- RPC node & client
- CLI tool
- Smart contract compiler
- NEO virtual machine
- Smart contract examples
- Oracle service
- State validation service
This branch (master) is Neo N3-compatible. For the current Legacy-compatible version please refer to the master-2.x branch and releases before 0.80.0 (0.7X.Y track).
Getting started
Installation
NeoGo is distributed as a single binary that includes all the functionality
provided (but smart contract compiler requires Go compiler to operate). You
can grab it from releases
page, use a Docker image (see
Docker Hub for various releases of
NeoGo, :latest
points to the latest release) or build yourself.
Building
To build NeoGo you need Go 1.16+ and make
:
make build
The resulting binary is bin/neo-go
.
Building on Windows
To build NeoGo on Windows platform we recommend you to install make
from MinGW
package. Then, you can build NeoGo with:
make build
The resulting binary is bin/neo-go.exe
.
We also recommend you to switch the Windows Firewall off for further NeoGo node run.
Running a node
A node needs to connect to some network, either local one (usually referred to
as privnet
) or public (like mainnet
or testnet
). Network configuration
is stored in a file and NeoGo allows you to store multiple files in one
directory (./config
by default) and easily switch between them using network
flags.
To start Neo node on a private network, use:
./bin/neo-go node
Or specify a different network with an appropriate flag like this:
./bin/neo-go node --mainnet
Available network flags:
--mainnet, -m
--privnet, -p
--testnet, -t
To run a consensus/committee node, refer to consensus documentation.
Docker
By default, the CMD
is set to run a node on privnet
. So, to do this, simply run:
docker run -d --name neo-go -p 20332:20332 -p 20331:20331 nspccdev/neo-go
Which will start a node on privnet
and expose node's ports 20332
(P2P
protocol) and 20331
(JSON-RPC server).
Importing mainnet/testnet dump files
If you want to jump-start your mainnet or testnet node with chain archives provided by NGD, follow these instructions:
$ wget .../chain.acc.zip # chain dump file
$ unzip chain.acc.zip
$ ./bin/neo-go db restore -m -i chain.acc # for testnet use '-t' flag instead of '-m'
The process differs from the C# node in that block importing is a separate mode. After it ends, the node can be started normally.
Running a private network
Refer to consensus node documentation.
Smart contract development
Please refer to neo-go smart contract development workshop that shows some simple contracts that can be compiled/deployed/run using neo-go compiler, SDK and a private network. For details on how Go code is translated to Neo VM bytecode and what you can and can not do in a smart contract, please refer to the compiler documentation.
Refer to examples for more NEO smart contract examples written in Go.
Wallets
NeoGo differs substantially from C# implementation in its approach to wallets. NeoGo wallet is just a NEP-6 file that is used by CLI commands to sign various things. There is no database behind it, the blockchain is the database and CLI commands use RPC to query data from it. At the same time, it's not required to open a wallet on an RPC node to perform various actions (unless your node provides some service for the network like consensus or oracle nodes do).
Developer notes
Nodes have such features as Prometheus and Pprof in order to have additional information about them for debugging.
How to configure Prometheus or Pprof:
In config/protocol.*.yml
there is
Prometheus:
Enabled: true
Port: 2112
where you can switch on/off and define port. Prometheus is enabled and Pprof is disabled by default.
Contributing
Feel free to contribute to this project after reading the contributing guidelines.
Before starting to work on a certain topic, create a new issue first describing the feature/topic you are going to implement.
Contact
- @roman-khimov on GitHub
- @AnnaShaleva on GitHub
- @fyrchik on GitHub
- Reach out to us on the NEO Discord channel
License
- Open-source MIT