Running NEO blockchain full node with Node.js and MongoDB.
neo-js package is designed to interface with the NEO blockchain in a number of different ways that are configured by options that are used to initialize a node. A few examples of these different interaction mechanics are defined in the quickstart below as well as in the examples.
This is not a SDK library for interacting with NEO blockchain. You are looking for
Currently this module only support MongoDB for synchronizing the blockchain. You are expect to be connected to an instance of MongoDB 3.2+ to use most of its features.
- NodeJS 8+
- MongoDB 3.2+
Install the package using:
$ npm install --save @cityofzion/neo-js
Alternatively, to access to the latest available code, you can reference to the git repository directly:
$ npm install --save git://github.com/CityOfZion/neo-js.git#develop
More comprehensive examples can be found at
const Neo = Neo
To create a new blockchain instance:
// Create a neo instances to interface with RPC methodsconst testnetNeo = network: 'testnet'// Wait for mesh to be ready before attempt to fetch block informationtestnetNeomesh// To connect to the mainnet:const mainnetNeo = network: 'mainnet'mainnetNeomesh
This will create a new node instance and configure it to sync the blockchain to the defined mongoDB collections:
const options =network: 'testnet'storageType: 'mongodb'storageOptions:connectionString: 'mongodb://localhost/neo_testnet'// Create a neo instanceconst neo = options// Get block heightneostorage
Documentation for the project can be found at:
You can find more code examples at repository:
Blockchain Bootstrap Files
neo-js always encourages community code contribution. Before contributing please read the contributor guidelines and search the issue tracker as your issue may have already been discussed or fixed. To contribute, fork
neo-js, commit your changes and submit a pull request.
By contributing to
neo-js, you agree that your contributions will be licensed under its MIT license.