ngind

module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: GPL-3.0

README ΒΆ

Ngind

Official Ngin daemon.

Install

πŸš€ From a release binary

The simplest way to get started running a node is to visit our Releases page and download a zipped executable binary (matching your operating system, of course), then moving the unzipped file ngind to somewhere in your $PATH. Now you should be able to open a terminal and run $ ngind help to make sure it's working.

πŸ”¨ Building the source

If your heart is set on the bleeding edge, install from source. However, please be advised that you may encounter some strange things, and we can't prioritize support beyond the release versions. Recommended for developers only.

Dependencies

Building ngind requires latest Rust, Go(>=1.11) and a C compiler(gcc). On Linux systems, a C compiler can, for example, by installed with sudo apt-get install build-essential. On Mac: xcode-select --install. On Windows we recommends using msys2 environment.

Install and build command executables

Executables installed from source will, by default, be installed in ./bin/.

Requirements
# Linux & Mac:
sudo pacman -S base-devel git gcc go rust

# Windows(msys2):
pacman -S base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-go mingw-w64-x86_64-rust
Building a specific release
git clone github.com/NginProject/ngind
cd ngind && git checkout <TAG OR REVISION>
make build_ngind
./bin/ngind version

Executables

This repository includes several wrappers/executables found in the cmd directory.

Command Description
ngind The main Ngin CLI client. It is the entry point into the Ngin network (main-, test-, or private net), capable of running as a full node (default) archive node (retaining all historical state) or a light node (retrieving data live). It can be used by other processes as a gateway into the Ngin network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports.
abigen Source code generator to convert Ngin contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain Ethereum contract ABIs with expanded functionality if the contract bytecode is also available. However it also accepts Solidity source files, making development much more streamlined. Please see our Native DApps wiki page for details.
bootnode Stripped down version of our Ngin client implementation that only takes part in the network node discovery protocol, but does not run any of the higher level application protocols. It can be used as a lightweight bootstrap node to aid in finding peers in private networks.
disasm Bytecode disassembler to convert EVM (Ethereum Virtual Machine) bytecode into more user friendly assembly-like opcodes (e.g. `echo "6001"
evm Developer utility version of the EVM (Ethereum Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow insolated, fine graned debugging of EVM opcodes (e.g. evm --code 60ff60ff --debug).
rlpdump Developer utility tool to convert binary RLP (Recursive Length Prefix) dumps (data encoding used by the Ngin protocol both network as well as consensus wise) to user friendlier hierarchical representation (e.g. rlpdump --hex CE0183FFFFFFC4C304050583616263).

πŸ“— ngind: the basics

Data directory

By default, ngind will store all node and blockchain data in a parent directory depending on your OS:

  • Linux: $HOME/.Ngin/
  • Mac: $HOME/Library/Ngin/
  • Windows: $HOME/AppData/Roaming/Ngin/

You can specify this directory with --data-dir=$HOME/id/rather/put/it/here.

Within this parent directory, ngind will use a /subdirectory to hold data for each network you run. The defaults are:

  • /mainnet for the Mainnet
Full node on the main Ngin network
ngind

It's that easy! This will establish an WEB blockchain node and download ("sync") the full blocks for the entirety of the WEB blockchain. However, before you go ahead with plain ol' ngind, we would encourage reviewing the following section...

🚀 --mine

To gain the Ngin cash, you should run the ngind with --mine tag.

If you dont have address, run ngind address new before ngind --mine

If you still get error, plz check your coinbase address.

--fast

The most common scenario is users wanting to simply interact with the Ngin network: create accounts; transfer funds; deploy and interact with contracts, and mine. For this particular use-case the user doesn't care about years-old historical data, so we can fast-sync to the current state of the network. To do so:

ngind --fast

Using ngind in fast sync mode causes it to download only block state data -- leaving out bulky transaction records -- which avoids a lot of CPU and memory intensive processing.

Fast sync will be automatically disabled (and full sync enabled) when:

  • your chain database contains any full blocks
  • your node has synced up to the current head of the network blockchain

In case of using --mine together with --fast, ngind will operate as described; syncing in fast mode up to the head, and then begin mining once it has synced its first full block at the head of the chain.

Note: To further increase ngind performace, you can use a --cache=2054 flag to bump the memory allowance of the database (e.g. 2054MB) which can significantly improve sync times, especially for HDD users. This flag is optional and you can set it as high or as low as you'd like, though we'd recommend the 1GB - 2GB range.

Create or manage account(s)

ngind is able to create, import, update, unlock, and otherwise manage your private (encrypted) key files. Key files are in JSON format and, by default, stored in the respective chain folder's /keystore directory; you can specify a custom location with the --keystore flag.

ngind account new

This command will create a new account and prompt you to enter a passphrase to protect your account. It will return output similar to:

Address: {0x52a8029355231d78099667a95d5875fab0d4fc4d}

So your address is: 0x52a8029355231d78099667a95d5875fab0d4fc4d

Other account subcommands include:

SUBCOMMANDS:

        list    print account addresses
        new     create a new account
        update  update an existing account
        import  import a private key into a new account

Learn more at the Accounts Wiki Page. If you're interested in using ngind to manage a lot (~100,000+) of accounts, please visit the Indexing Accounts Wiki page.

Fast synchronisation

ngind syncs with the network automatically after start. However, this method is might be slow for several nodes.

Linux:
$ $HOME/.Ngin//mainnet/

Mac
$ $HOME/Library/Ngin/mainnet/

Windows:
> %APPDATA%\Ngin\mainnet\

Then, restart the ngin instance.

Interact with the Javascript console
ngind console

This command will start up ngind built-in interactive JavaScript console, through which you can invoke all official web3 methods as well as ngind own management APIs. This too is optional and if you leave it out you can always attach to an already running ngind instance with ngind attach.

Learn more at the Javascript Console Wiki page.

And so much more

For a comprehensive list of command line options, please consult our CLI Wiki page.

πŸ“™ ngind: developing and advanced useage

Programatically interfacing ngind nodes

As a developer, sooner rather than later you'll want to start interacting with ngind and the Ngin network via your own programs and not manually through the console. To aid this, ngind has built in support for a JSON-RPC based APIs (standard APIs and ngind specific APIs). These can be exposed via HTTP, WebSockets and IPC (unix sockets on unix based platroms, and named pipes on Windows).

The IPC interface is enabled by default and exposes all the APIs supported by ngind, whereas the HTTP and WS interfaces need to manually be enabled and only expose a subset of APIs due to security reasons. These can be turned on/off and configured as you'd expect.

HTTP based JSON-RPC API options:

  • --rpc Enable the HTTP-RPC server
  • --rpc-addr HTTP-RPC server listening interface (default: "localhost")
  • --rpc-port HTTP-RPC server listening port (default: 52521)
  • --rpc-api API's offered over the HTTP-RPC interface (default: "eth,net,web3")
  • --rpc-cors-domain Comma separated list of domains from which to accept cross origin requests (browser enforced)
  • --ws Enable the WS-RPC server
  • --ws-addr WS-RPC server listening interface (default: "localhost")
  • --ws-port WS-RPC server listening port (default: 52522)
  • --ws-api API's offered over the WS-RPC interface (default: "eth,net,web3")
  • --ws-origins Origins from which to accept websockets requests
  • --ipc-disable Disable the IPC-RPC server
  • --ipc-api API's offered over the IPC-RPC interface (default: "admin,debug,ngin,miner,net,personal,shh,txpool,web3")
  • --ipc-path Filename for IPC socket/pipe within the datadir (explicit paths escape it)

You'll need to use your own programming environments' capabilities (libraries, tools, etc) to connect via HTTP, WS or IPC to a ngind node configured with the above flags and you'll need to speak JSON-RPC on all transports. You can reuse the same connection for multiple requests!

Note: Please understand the security implications of opening up an HTTP/WS based transport before doing so! Hackers on the internet are actively trying to subvert Ngin nodes with exposed APIs! Further, all browser tabs can access locally running webservers, so malicious webpages could try to subvert locally available APIs!*

Contribution

Thank you for considering to help out with the source code!

The core values of democratic engagement, transparency, and integrity run deep with us. We welcome contributions from everyone, and are grateful for even the smallest of fixes. πŸ‘

If you'd like to contribute to ngind, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base.

Please see the Wiki for more details on configuring your environment, managing project dependencies, and testing procedures.

License

The ngind library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.

The ngind binaries (i.e. all code inside of the cmd directory) is licensed under the GNU General Public License v3.0, also included in our repository in the COPYING file.

Directories ΒΆ

Path Synopsis
Package accounts implements encrypted storage of secp256k1 private keys.
Package accounts implements encrypted storage of secp256k1 private keys.
abi
Package abi implements the Ethereum ABI (Application Binary Interface).
Package abi implements the Ethereum ABI (Application Binary Interface).
abi/bind
Package bind generates Ethereum contract Go bindings.
Package bind generates Ethereum contract Go bindings.
cmd
bootnode
bootnode runs a bootstrap node for the Ethereum Discovery Protocol.
bootnode runs a bootstrap node for the Ethereum Discovery Protocol.
disasm
disasm is a pretty-printer for EVM bytecode.
disasm is a pretty-printer for EVM bytecode.
evm
evm executes EVM code snippets.
evm executes EVM code snippets.
rlpdump
rlpdump is a pretty-printer for RLP data.
rlpdump is a pretty-printer for RLP data.
Package common contains various helper functions.
Package common contains various helper functions.
hexutil
Package hexutil implements hex encoding with 0x prefix.
Package hexutil implements hex encoding with 0x prefix.
Package core implements the Ethereum consensus protocol.
Package core implements the Ethereum consensus protocol.
assets
Package assets is generated by github.com/omeid/go-resources
Package assets is generated by github.com/omeid/go-resources
state
Package state provides a caching layer atop the Ethereum state trie.
Package state provides a caching layer atop the Ethereum state trie.
types
Package types contains data types related to Ethereum consensus.
Package types contains data types related to Ethereum consensus.
vm
Package vm implements the Ethereum Virtual Machine.
Package vm implements the Ethereum Virtual Machine.
vm/runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.
sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package event implements an event multiplexer.
Package event implements an event multiplexer.
filter
Package filter implements event filters.
Package filter implements event filters.
internal
jsre
Package jsre provides execution environment for JavaScript.
Package jsre provides execution environment for JavaScript.
web3ext
package web3ext contains geth specific web3.js extensions.
package web3ext contains geth specific web3.js extensions.
Package logger implements a multi-output leveled logger.
Package logger implements a multi-output leveled logger.
glog
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package metrics centralizes the registration.
Package metrics centralizes the registration.
Package miner implements Ethereum block creation and mining.
Package miner implements Ethereum block creation and mining.
Package ngin implements the Ngin protocol.
Package ngin implements the Ngin protocol.
downloader
Package downloader contains the manual full chain synchronisation.
Package downloader contains the manual full chain synchronisation.
fetcher
Package fetcher contains the block announcement based synchronisation.
Package fetcher contains the block announcement based synchronisation.
filters
package filters implements an ethereum filtering system for block, transactions and log events.
package filters implements an ethereum filtering system for block, transactions and log events.
Package node represents the Ethereum protocol stack container.
Package node represents the Ethereum protocol stack container.
p2p
Package p2p implements the Ethereum p2p network protocols.
Package p2p implements the Ethereum p2p network protocols.
discover
Package discover implements the Node Discovery Protocol.
Package discover implements the Node Discovery Protocol.
nat
Package nat provides access to common network port mapping protocols.
Package nat provides access to common network port mapping protocols.
Package rlp implements the RLP serialization format.
Package rlp implements the RLP serialization format.
Package rpc provides access to the exported methods of an object across a network or other I/O connection.
Package rpc provides access to the exported methods of an object across a network or other I/O connection.
Package trie implements Merkle Patricia Tries.
Package trie implements Merkle Patricia Tries.
Package whisper implements the Whisper PoC-1.
Package whisper implements the Whisper PoC-1.

Jump to

Keyboard shortcuts

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