Skip to content

Nodechain is a service that allows you to create nodes on a blockchain and connect to them natively through APIs. The goal is to allow the user to build their own nodes natively without having to rely on external services.

License

Notifications You must be signed in to change notification settings

phoenix-web3/NodeChain

 
 

Repository files navigation

NodeChain

RedditTwitterMediumDocs


Nodechain is a service that allows you to create nodes on a blockchain and connect to them natively through the JSON-RPC protocol to its API. In short, it allows the user to build and manage their own nodes natively without having to rely on external services.

This repository contains all the code related to the RPC and WS APIs, including the connection to the APIs of the native nodes of each blockchain.

All the documentation related to the project can be found here.


Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Download the project

The first thing to do is to download the project from GitHub. To do this we will use the command-line. Follow the CONTRIBUTING.md guidelines before cloning the repository.

$ git clone git@github.com:swapper-org/NodeChain.git

Install dependencies

Depending on your setup, you will need to install the requirements.txt file dependencies if you have not installed them previously:

# Go to the scripts folder
$ cd scripts

# Install via pip
$ pip install -r "requirements.txt"

Run NodeChain

You are ready to start your node. Just type:

$ python3 nodechain.py start

# or

$ ./nodechain.py start

Flags

You can get more information about NodeChain:

~$ python3 nodechain.py -h

Usage

NodeChain uses the JSON RPC protocol for API requests. The API provides the following endpoints:

  • https://<URL-SERVER>:<PORT>/<TOKEN>/<NETWORK>/rpc for RPC requests.
  • wss://<URL-SERVER>:<PORT>/<TOKEN>/<NETWORK>/ws for real time requests.

We also support REST API (HTTP)

  • GET / POST https://<URL-SERVER>:<PORT>/<TOKEN>/<NETWORK>/<METHOD> for HTTP requests

More information can be founded here.

Environments

Regtest stage

This environment is intended for the development and contribution of the project. Blockchains used are created locally (regtest, ganache,...) facilitating the development and waiting times in block mining.

Testnet stage

This environment is used to interact with any test network.

IMPORTANT: To work with full nodes in testnet mode, You need to have the blockchain synchronized for its use. If the testnet blockchain is not synchronized locally, some features might not work.

Mainnet stage

This environment is intended for real cases. You will be able to interact with any mainnet of any blockchain. Be aware that transactions may cost real fees if you use this environment.

IMPORTANT: You must use a different port for each API

Test

We use Flake8 for linting and PyTest for testing.

Lint

The Flake8 configuration is inside the .flake8 file. The project is configured only for linting python code from the Connector/ and scripts/ directories.

You can lint with the following command:

~$ flake8 --statistics

As optional, you can create a GitHub Hook to automatically check that your code follows the linting rules before commiting your changes.

You can find the tutorial to lint automatically with hooks here.

Local testing

Do you need to test your changes without download the whole blockchain?. Follow the tutorial and help to improve NodeChain!

CircleCI testing

If you have a CircleCI account, you can use it for remote testing. Use the GitHub account with your forked Nodechain repository.

Follow the steps for CircleCI remote testing

  1. Go to the projects tab and click on the Set Up Project button of your forked Nodechain repository.
  2. Select the staging branch
  3. Implement your fix or feature
  4. Push the code to GitHub and tests will be automatically executed

Note: When running test remotely, CircleCI will execute all the jobs defined in the .circleci/config.yml

Contributing

Please read Contribution Guidelines for details on our code of conduct, and the process for submitting pull requests to us.

Docs

We use GitBook for docs. All the documentation concerning Nodechain is available at NodeChain Docs

All changes to the RPC/WS documentation must be made in the NodeChain-docs repository.

Version

Please read Contribution Guidelines for details on our versioning system. For the version available, see the tags on this repository.

License

This software is licensed under the MIT License. See LICENSE for the full details.

Motivation and Vision

The main goal of the project is to give the user an easy way to be able to build their own blockchain nodes without external services, either inbuilt on their own local machines or on production servers.

In developing NodeChain we seek to incorporate purely native services and protocols, avoiding unofficial dependencies.

We believe in decentralizing the world and work to make it easily accessible to everyone.

NodeChain is a project by the community and for the community. We stand firm in the context of collaboration by growing the Blockchain ecosystem and enabling the scalability of projects in a simple way.

Growing the ecosystem around NodeChain is an arduous but necessary task. For this reason, we thank all the contributors who give part of their time.

Related projects

Thanks to every project that make NodeChain possible. You can see the list here.

About

Nodechain is a service that allows you to create nodes on a blockchain and connect to them natively through APIs. The goal is to allow the user to build their own nodes natively without having to rely on external services.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.0%
  • Dockerfile 1.5%
  • Shell 1.5%