Go Node and SDK for the NEO blockchain
Find a file
Anthony De Meulemeester a67728628e
Persist blockchain with leveldb on disk (#48)
* Created test_data folder with block json files for testing + create separate file for block base.

* Fixed bug in WriteVarUint + Trim logic + unit tests

* Refactored store and add more tests for it.

* restore headerList from chain file

* Fix tx decode bug + lots of housekeeping.

* Implemented Node restore state from chain file.

* Created standalone package for storage. Added couple more methods to Batch and Store interfaces.

* Block persisting + tests

* bumped version -> 0.31.0
2018-03-17 12:53:21 +01:00
.github Release documentation (#13) 2018-02-02 19:04:56 +00:00
cli Persist blockchain with leveldb on disk (#48) 2018-03-17 12:53:21 +01:00
config Server configuration (#43) 2018-03-15 21:45:37 +01:00
pkg Persist blockchain with leveldb on disk (#48) 2018-03-17 12:53:21 +01:00
.gitignore Node improvements (#47) 2018-03-14 10:36:59 +01:00
circle.yml Server configuration (#43) 2018-03-15 21:45:37 +01:00
CONTRIBUTING.md Release documentation (#13) 2018-02-02 19:04:56 +00:00
Gopkg.lock Persist blockchain with leveldb on disk (#48) 2018-03-17 12:53:21 +01:00
Gopkg.toml Server configuration (#43) 2018-03-15 21:45:37 +01:00
LICENCE.md Updated README and LICENSE according to other COZ repo’s. 2018-01-31 13:50:11 +01:00
Makefile Persist blockchain with leveldb on disk (#48) 2018-03-17 12:53:21 +01:00
README.md Fix bug where channel for peers events is called after it's closed (#34) 2018-03-03 08:16:05 +01:00
VERSION Persist blockchain with leveldb on disk (#48) 2018-03-17 12:53:21 +01:00

neo-go

Go Node and SDK for the NEO blockchain.

Overview

This project is currently in alpha and under active development.

Project Goals

Full port of the original C# NEO project. A complete toolkit for the NEO blockchain, including:

  • Full consensus node
  • Full RPC node
  • RPC client
  • CLI tool
  • Smart contract compiler

Current State

The project will exist out of the following packages:

Package State Developer
core started @anthdm
network started @anthdm
vm started @anthdm
compiler started @anthdm
client started @revett
cli started @revett
wallet started @pawanrawal

Getting Started

Node

Install dependencies, this requires dep:

make deps

Build the neo-go CLI:

make build

Currently, there is a minimal subset of the NEO protocol implemented. To start experimenting make sure you a have a private net running on your machine. If you dont, take a look at docker-privnet-with-gas.

Start a NEO node:

make run

You can add multiple seeds if you want:

make run -e SEEDS="127.0.0.1:20333,127.0.01:20334"

By default the server will currently run on port 3000, for testing purposes. You can change that by setting the tcp flag:

make run -e PORT="1337"

To run the binary directly:

./bin/neo-go node -seed 127.0.0.1:20333 -tcp 1337

RPC

If you want your node to also serve JSON-RPC, you can do that by setting the following flag:

./bin/neo-go node -rpc 4000

In this case the server will accept and respond JSON-RPC on port 4000. Keep in mind that currently there is only a small subset of the JSON-RPC implemented. Feel free to make a PR with more functionality.

VM

TODO

Smart Contracts

In depth documentation about the neo-go compiler and smart contract examples can be found inside the compiler package.

Compile a smart contract

./bin/neo-go contract compile -i mycontract.go

By default the filename will be the name of your .go file with the .avm extension, the file will be located in the same directory where you called the command from. If you want another location for your compiled contract:

./bin/neo-go contract compile -i mycontract.go --out /Users/foo/bar/contract.avm

Debugging your smart contract

You can dump the opcodes generated by the compiler with the following command:

./bin/neo-go contract opdump -i mycontract.go

This will result in something like this:

INDEX    OPCODE    DESC
0        0x52      OpPush2
1        0xc5      OpNewArray
2        0x6b      OpToAltStack
3        0x 0      OpPush0
4        0x6c      OpFromAltStack
5        0x76      OpDup
6        0x6b      OpToAltStack
7        0x 0      OpPush0
8        0x52      OpPush2
9        0x7a      OpRoll
10       0xc4      OpSetItem

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 feauture/topic you are going to implement.

Contact

License

  • Open-source MIT