ngcore

module
v0.0.0-...-8d08d5c Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: GPL-3.0

README

ngCore

NG
ngcore: Brand-new golang daemon implement of Ngin Network Node

What is NGIN?

NGIN is a radically updating brand-new blockchain network, which is not a fork of ethereum or any other chain.

NGIN's goal is to build a blockchain engine which acts more auditable, scalable, security-oriented and supports more network tasks with vm.

NGIN uses modern models - Vault(Block), Account, Multi-type Tx, and the traditional Block model to build the blockchain ecosystem. And NGIN strictly follow the idea of blockchain, locking items with hash to keep engine work safely. Not only blockchain, but Vault(Block) will also link up to be a chain for account security and powerful functions like fast ignition, free account state and so on. So It's safe and robust like bitcoin and ethereum but more scalable and powerful on the node's operational capacity and p2p network's speed and performance.

Status

Go Report Card CI GitHub GitHub last commit

Features

  • Fast ignition
  • Less, or no storage cost(mem only)
  • With humanizing account model, users can send tx with memorable short number
  • High security with Sheet and Vault(Block) model
  • Powerful and scalable types of tx
  • Support Multi-Tx, sending coins to different places in the same time
  • Powerful WASM VM support based on account state(contract).
  • Libp2p(ipfs) powered p2p networking
  • Available anonymous address for saving balance
  • Using the schnorr signature, allowing Multi-Sig when sending and receiving
  • ...

Requirements

go version >= 1.14

NOTICE: go build on Windows you should use -buildmode=exe flag (go version >= 1.15)

Build

Go
# go will automatically sync the dependencies
# GCC is required because of high performance db & vm
go build ./cmd/ngcore

Usage

# dircetly run the binary
export GOLOG_FILE=ngcore.log # disable stderr output and write to the ngcore.log file
export GOLOG_LOG_LEVEL=debug # print more logs
./ngcore

# ngwallet is a rpc client in dart for ngin's daemon, see https://github.com/ngchain/ngwallet-dart
./ngwallet register 10086
./ngwallet transact 10010 1.5 # send 1.5 NG to account 10010
./ngwallet transact QfUnsE4CNgnpVS4oC4WEYH8u7WWAs8AwMrFBknWWqGSYwBXU 1.5 # send 1.5 NG to address QfUn...

If you wanna start mining(proof of work), try --mining <Thread Num> flag

./ngcore --mining 0 # zero means using all available cores

You can view more flags and options with --help flag

./ngcore --help

Or you can choose to run in a docker

git clone https://github.com/ngchain/ngcore && cd ngcore
sudo docker build . -t ngcore:alpine

# Run as a bootstrap node
sudo docker run -p 52520:52520 -p 52521:52521 -v .:/workspace -v ~/.ngkeys:~/.ngkeys ngcore --bootstrap true

# Run as a mining node, 0 means using all cpu cores, --in-mem will disable writing into disk and make the miner lighter
sudo docker run -p 52520:52520 -p 52521:52521 -v .:/workspace -v ~/.ngkeys:~/.ngkeys ngcore --mining 0 --in-mem

Run a NGIN Forknet

It's so easy to run an independent PoW chain on ngCore codebase.

  1. Modify the GenesisAddressBase58 in ./ngtypes/defaults.go and protocolVersion in ./ngp2p/defaults/defaults.go

  2. Generate a new signature for genesis generate tx, and genesis block's nonce (with ngcore gentools toolset)

  3. Run more than 2 bootstrap node with --bootstrap flag (without mining)

  4. Write the bootstrap node to bootstrapNodes in ./ngp2p/bootstrap_nodes.go

  5. Run a mining node with --mining 0 flag

  6. Enjoy your fascinating PoW chain

Directories

Path Synopsis
cmd
ngcore
package main is the entry of daemon
package main is the entry of daemon
Package consensus implements the PoWork consensus
Package consensus implements the PoWork consensus
Package jsonrpc is the json-rpc2 module in ngcore All commands/methods should follow these rules: - All (private or public) keys are encoded with base58 - All bytes are encoded in base64 (forced by protobuf) - All numbers are float64, coin uint is NG.
Package jsonrpc is the json-rpc2 module in ngcore All commands/methods should follow these rules: - All (private or public) keys are encoded with base58 - All bytes are encoded in base64 (forced by protobuf) - All numbers are float64, coin uint is NG.
Package keytools is the module to reuse the key pair
Package keytools is the module to reuse the key pair
Package ngblocks is a store for blocks which contains txs
Package ngblocks is a store for blocks which contains txs
Package ngp2p is the ngin p2p protocol implement based on libp2p ngp2p uses libp2p(ipfs)'s dht for public peer discovery and mDNS for private, and uses pub-sub to work the broadcast net the main peer-to-peer communication is based on Wired Protocol, which uses fast protobuf to encode and decode objects
Package ngp2p is the ngin p2p protocol implement based on libp2p ngp2p uses libp2p(ipfs)'s dht for public peer discovery and mDNS for private, and uses pub-sub to work the broadcast net the main peer-to-peer communication is based on Wired Protocol, which uses fast protobuf to encode and decode objects
Package ngpool is an autonomous module to handle the new-coming txs from internal or external events ngpool's use requires some other module's initialization: - ngchain(and ngblocks) - ngstate - ngp2p - storage
Package ngpool is an autonomous module to handle the new-coming txs from internal or external events ngpool's use requires some other module's initialization: - ngchain(and ngblocks) - ngstate - ngp2p - storage
Package ngstate provides a global account status manager which controls all accounts and balance besides that, the manager can do generating current sheet for fasy sync ngstate can get init from genesis sheet or remote sheet.
Package ngstate provides a global account status manager which controls all accounts and balance besides that, the manager can do generating current sheet for fasy sync ngstate can get init from genesis sheet or remote sheet.
Package ngtypes implements the block structure and related types.
Package ngtypes implements the block structure and related types.
Package utils are some **utilities** while developing
Package utils are some **utilities** while developing

Jump to

Keyboard shortcuts

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