bd400dfe20
It can be a pointer to cached data: 2021-07-07T20:05:24.8508647Z ================== 2021-07-07T20:05:24.8509294Z WARNING: DATA RACE 2021-07-07T20:05:24.8510243Z Write at 0x00c000142cc8 by goroutine 51: 2021-07-07T20:05:24.8511350Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).Update() 2021-07-07T20:05:24.8529622Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:335 +0x70a 2021-07-07T20:05:24.8531266Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).updateWithData() 2021-07-07T20:05:24.8532544Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:316 +0x1e9 2021-07-07T20:05:24.8533726Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).update() 2021-07-07T20:05:24.8534928Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:303 +0x111 2021-07-07T20:05:24.8536123Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Management).update-fm() 2021-07-07T20:05:24.8537389Z /home/runner/work/neo-go/neo-go/pkg/core/native/management.go:302 +0x34 2021-07-07T20:05:24.8538462Z github.com/nspcc-dev/neo-go/pkg/core/native.Call() 2021-07-07T20:05:24.8539565Z /home/runner/work/neo-go/neo-go/pkg/core/native/interop.go:54 +0x90c 2021-07-07T20:05:24.8540751Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler() 2021-07-07T20:05:24.8542177Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:262 +0x216 2021-07-07T20:05:24.8543328Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler-fm() 2021-07-07T20:05:24.8544586Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:250 +0x53 2021-07-07T20:05:24.8545648Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).execute() 2021-07-07T20:05:24.8546635Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:1312 +0xb2d5 2021-07-07T20:05:24.8547632Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Step() 2021-07-07T20:05:24.8548640Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:416 +0x1f2 2021-07-07T20:05:24.8549836Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Run() 2021-07-07T20:05:24.8550852Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:393 +0x195 2021-07-07T20:05:24.8551989Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).runScriptInVM() 2021-07-07T20:05:24.8553174Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:1326 +0x7eb 2021-07-07T20:05:24.8554345Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).invokeFunction() 2021-07-07T20:05:24.8555560Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:1219 +0x50c 2021-07-07T20:05:24.8556616Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleIn() 2021-07-07T20:05:24.8557823Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:345 +0xecb 2021-07-07T20:05:24.8558987Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleRequest() 2021-07-07T20:05:24.8560356Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:315 +0x364 2021-07-07T20:05:24.8561599Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleHTTPRequest() 2021-07-07T20:05:24.8562976Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:309 +0xf9b 2021-07-07T20:05:24.8564208Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).handleHTTPRequest-fm() 2021-07-07T20:05:24.8565523Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:257 +0x64 2021-07-07T20:05:24.8566348Z net/http.HandlerFunc.ServeHTTP() 2021-07-07T20:05:24.8567290Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2042 +0x51 2021-07-07T20:05:24.8568185Z net/http.serverHandler.ServeHTTP() 2021-07-07T20:05:24.8569130Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2843 +0xca 2021-07-07T20:05:24.8569861Z net/http.(*conn).serve() 2021-07-07T20:05:24.8570634Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:1925 +0x84c 2021-07-07T20:05:24.8571139Z 2021-07-07T20:05:24.8571639Z Previous read at 0x00c000142cc8 by goroutine 41: 2021-07-07T20:05:24.8572892Z github.com/nspcc-dev/neo-go/pkg/core/interop/contract.callExFromNative() 2021-07-07T20:05:24.8574265Z /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:101 +0x2d4 2021-07-07T20:05:24.8575581Z github.com/nspcc-dev/neo-go/pkg/core/interop/contract.callInternal() 2021-07-07T20:05:24.8576951Z /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:85 +0x1f5 2021-07-07T20:05:24.8578094Z github.com/nspcc-dev/neo-go/pkg/core/interop/contract.Call() 2021-07-07T20:05:24.8579306Z /home/runner/work/neo-go/neo-go/pkg/core/interop/contract/call.go:69 +0x804 2021-07-07T20:05:24.8580514Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler() 2021-07-07T20:05:24.8581755Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:262 +0x216 2021-07-07T20:05:24.8582907Z github.com/nspcc-dev/neo-go/pkg/core/interop.(*Context).SyscallHandler-fm() 2021-07-07T20:05:24.8584300Z /home/runner/work/neo-go/neo-go/pkg/core/interop/context.go:250 +0x53 2021-07-07T20:05:24.8585422Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).execute() 2021-07-07T20:05:24.8586403Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:1312 +0xb2d5 2021-07-07T20:05:24.8590451Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Step() 2021-07-07T20:05:24.8591549Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:416 +0x1f2 2021-07-07T20:05:24.8592466Z github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Run() 2021-07-07T20:05:24.8593550Z /home/runner/work/neo-go/neo-go/pkg/vm/vm.go:393 +0x195 2021-07-07T20:05:24.8594531Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).storeBlock() 2021-07-07T20:05:24.8595708Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:717 +0x1694 2021-07-07T20:05:24.8596793Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).AddBlock() 2021-07-07T20:05:24.8598142Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:579 +0x544 2021-07-07T20:05:24.8599419Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).processBlock() 2021-07-07T20:05:24.8601093Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:521 +0x141 2021-07-07T20:05:24.8602485Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).processBlock-fm() 2021-07-07T20:05:24.8603809Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:517 +0x55 2021-07-07T20:05:24.8604910Z github.com/nspcc-dev/dbft.(*DBFT).checkCommit() 2021-07-07T20:05:24.8606098Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/check.go:73 +0xd8a 2021-07-07T20:05:24.8607235Z github.com/nspcc-dev/dbft.(*DBFT).checkPrepare() 2021-07-07T20:05:24.8608551Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/check.go:36 +0x677 2021-07-07T20:05:24.8609681Z github.com/nspcc-dev/dbft.(*DBFT).sendPrepareRequest() 2021-07-07T20:05:24.8611016Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/send.go:42 +0x47c 2021-07-07T20:05:24.8612107Z github.com/nspcc-dev/dbft.(*DBFT).OnTimeout() 2021-07-07T20:05:24.8613257Z /home/runner/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:188 +0x68c 2021-07-07T20:05:24.8614499Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).eventLoop() 2021-07-07T20:05:24.8615712Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:274 +0x17ed 2021-07-07T20:05:24.8616284Z 2021-07-07T20:05:24.8616757Z Goroutine 51 (running) created at: 2021-07-07T20:05:24.8617367Z net/http.(*Server).Serve() 2021-07-07T20:05:24.8618159Z /opt/hostedtoolcache/go/1.15.13/x64/src/net/http/server.go:2969 +0x5d3 2021-07-07T20:05:24.8619253Z github.com/nspcc-dev/neo-go/pkg/rpc/server.(*Server).Start.func2() 2021-07-07T20:05:24.8620437Z /home/runner/work/neo-go/neo-go/pkg/rpc/server/server.go:224 +0x85 2021-07-07T20:05:24.8620936Z 2021-07-07T20:05:24.8621405Z Goroutine 41 (running) created at: 2021-07-07T20:05:24.8622393Z github.com/nspcc-dev/neo-go/pkg/consensus.(*service).Start() 2021-07-07T20:05:24.8623562Z /home/runner/work/neo-go/neo-go/pkg/consensus/consensus.go:250 +0x17c 2021-07-07T20:05:24.8624682Z github.com/nspcc-dev/neo-go/pkg/network.(*Server).tryStartServices() 2021-07-07T20:05:24.8626078Z /home/runner/work/neo-go/neo-go/pkg/network/server.go:445 +0x2e1 2021-07-07T20:05:24.8627226Z github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start() 2021-07-07T20:05:24.8628333Z /home/runner/work/neo-go/neo-go/pkg/network/server.go:268 +0x2af 2021-07-07T20:05:24.8628973Z ================== |
||
---|---|---|
.circleci | ||
.docker | ||
.github | ||
cli | ||
config | ||
docs | ||
examples | ||
internal | ||
pkg | ||
scripts | ||
.dockerignore | ||
.gitignore | ||
.gitmodules | ||
.golangci.yml | ||
.travis.yml | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
Dockerfile | ||
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 under active development now (read: won't work out of the box) and aims to be compatible with Neo 3. For the current stable version compatible with Neo 2 please refer to the master-2.x branch and releases before 0.80.0 (0.7X.Y track). Releases starting from 0.90.0 contain Neo 3 code (0.90.0 being compatible with Neo 3 preview2).
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.14+ and make
:
make build
The resulting binary is bin/neo-go
.
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 private network use:
./bin/neo-go node
Or specify a different network with appropriate flag like this:
./bin/neo-go node --mainnet
Available network flags:
--mainnet, -m
--privnet, -p
--testnet, -t
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 (when they'd be available for 3.0 networks):
$ 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 private network. For details on how Go code is translated to Neo VM bytecode and what you can and can not do in 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 the wallet on RPC node to perform various actions (unless your node is providing some service for the network like consensus or oracle nodes).
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 an 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