NodeChain EN
  • NodeChain
  • Learn
    • About NodeChain
    • Infrastructure
      • Connector
        • Wrapper APIs
      • Nodes
      • Startup script
    • License
    • Ecosystem
      • Supported APIs
      • Integrations
      • Acknowledgments
  • Develop
    • Quick start
      • Initial setup
      • Using command-line script
        • Commands
    • How-to
      • Run tests locally
      • Lint automatically with hooks
      • Integrate a new Blockchain/API
      • Connect to a public node
    • Wrapper API definition file
    • Contributing
  • Reference
    • API Reference
      • Admin
      • General Endpoints
      • REST Wrapper API
        • Bitcoin Cash
        • Bitcoin
        • Ethereum
          • ERC-20
      • JSON-RPC Wrapper API
        • Bitcoin Cash
        • Bitcoin
        • Ethereum
          • ERC-20
      • Real-Time Wrapper API
        • Bitcoin
        • Ethereum
Powered by GitBook
On this page
  • Running the connector
  • Running the nodes
  • Choosing Blockchain and Network
  • Register the API
  • Stopping the Connector
  • Stopping the nodes
  • Display services status
  1. Develop
  2. Quick start

Using command-line script

The following information explains the functions you can use from NodeChain, the command-line interface that connects to the Connector and enables you to interact with the blockchain nodes.

You need to be in the scripts folder to run nodechain.py file.

Running the connector

To start using NodeChain it is mandatory to start the connector. Just type:

$ python3 nodechain.py start

# or

$ ./nodechain.py start

An interface will open asking for the port and the SSL port on which you want to start the Connector.

$ ./nodechain.py start
---------------------------------------------------
  _  _          _        ___  _                   
 | \| | ___  __| | ___  / __|| |_   __ _ (_) _ _  
 | .` |/ _ \/ _` |/ -_)| (__ | ' \ / _` || || ' \ 
 |_|\_|\___/\__,_|\___| \___||_||_|\__,_||_||_||_|
---------------------------------------------------
===================================================
                CONNECTOR CONFIG
===================================================
Port to start: 60000
Port to start (SSL): 443
Starting network nodechain-network.
Starting connector and reverse proxy... This might take a while.
Connector has been started

Running the nodes

Once the Connector is started, you will be able to choose which nodes to start from the same interface.

With the Connector started, open the node interface simply typing:

$ python3 nodechain.py start

# or

$ ./nodechain.py start

Choosing Blockchain and Network

Follow the steps indicated in the menu to choose the blockchain and the network on which you want to start the node.

$ ./nodechain.py start
---------------------------------------------------
  _  _          _        ___  _                   
 | \| | ___  __| | ___  / __|| |_   __ _ (_) _ _  
 | .` |/ _ \/ _` |/ -_)| (__ | ' \ / _` || || ' \ 
 |_|\_|\___/\__,_|\___| \___||_||_|\__,_||_||_||_|
---------------------------------------------------
===================================================
		BLOCKCHAIN SELECTION
===================================================
[OFF]          1.Bitcoin
[OFF]          2.Ethereum
[OFF]          3.Bitcoin-cash
[OFF]          4.Terra
               5.Exit
Please choose the blockchain that you want to use to build up/stop the node(1-5): 2
===================================================
		NETWORK SELECTION
===================================================
[OFF]          1.Regtest
[OFF]          2.Testnet
[OFF]          3.Mainnet
               4.Exit
Please choose the network that you want to use (1-4): 2
Please choose the directory to save blockchain data (/srv/nodechain-node/eth_testnet): 

The default blockchain data path is /srv/nodechain-node/<TOKEN_NETWORK>

Register the API

Once you have chosen the blockchain and network, you must choose whether to initiate local nodes or connect to a remote node:

Do you want to connect to a remote node?: [y/N]: 
Starting ethtestnetapi node... This might take a while.
ethtestnetapi node started

Using local nodes will launch Docker containers. However, connecting to a remote node will not bring up these services.

Finally, choose whether you want to configure the configuration endpoints or load the default configuration.

Do you want to use the default configuration for the API  [Y/n]: Y
eth testnet has registered succesfully in the connector

The default configuration is stored in the config.json file. This is used to automatically load the node configuration.

Stopping the Connector

To stop the connector all you need to do is running:

$ python3 nodechain.py stop

# or

$ ./nodechain.py stop

After that, an interface will appear asking if you want to stop the connector. If you accept to stop the Connector all running nodes will also stop.

# Bitcoin Regtest and Ethereum Regtest nodes are running

$ ./nodechain.py stop
---------------------------------------------------
  _  _          _        ___  _                   
 | \| | ___  __| | ___  / __|| |_   __ _ (_) _ _  
 | .` |/ _ \/ _` |/ -_)| (__ | ' \ / _` || || ' \ 
 |_|\_|\___/\__,_|\___| \___||_||_|\__,_||_||_||_|
---------------------------------------------------
===================================================
		CONNECTOR CONFIG
===================================================
Do you want to stop the connector? [y/N]: y
Stopping all APIs...
btc regtest has removed succesfully from the connector
Stopping btcregtestapi node... This might take a while.
btcregtestapi node stopped
Can't stop btc in testnet. Containers are not running
Can't stop btc in mainnet. Containers are not running
eth regtest has removed succesfully from the connector
Stopping ethregtestapi node... This might take a while.
ethregtestapi node stopped
Can't stop eth in testnet. Containers are not running
Can't stop eth in mainnet. Containers are not running
Can't stop bch in testnet. Containers are not running
Can't stop bch in mainnet. Containers are not running
Can't stop luna in testnet. Containers are not running
Can't stop luna in mainnet. Containers are not running
Stopping connector and reverse proxy... This might take a while.
Connector has been stopped

Note that stopping the Connector will stop every running node.

Stopping the nodes

If a node is started and you want to stop it all you have to do is:

$ python3 nodechain.py stop

# or

$ ./nodechain.py stop

After refusing to stop the connector, follow the steps to stop any running node.

$ ./nodechain.py stop
---------------------------------------------------
  _  _          _        ___  _                   
 | \| | ___  __| | ___  / __|| |_   __ _ (_) _ _  
 | .` |/ _ \/ _` |/ -_)| (__ | ' \ / _` || || ' \ 
 |_|\_|\___/\__,_|\___| \___||_||_|\__,_||_||_||_|
---------------------------------------------------
===================================================
		CONNECTOR CONFIG
===================================================
Do you want to stop the connector? [y/N]: n
===================================================
		BLOCKCHAIN SELECTION
===================================================
[OFF]          1.Bitcoin
[RUNNING]      2.Ethereum
[OFF]          3.Bitcoin-cash
[OFF]          4.Terra
               5.Exit
Please choose the blockchain that you want to use to build up/stop the node(1-5): 2
===================================================
		NETWORK SELECTION
===================================================
[OFF]          1.Regtest
[RUNNING]      2.Testnet
[OFF]          3.Mainnet
               4.Exit
Please choose the network that you want to use (1-4): 2
eth testnet has removed succesfully from the connector
Stopping ethtestnetapi node... This might take a while.
ethtestnetapi node stopped

Running nodes will be marked as [RUNNING] in the interface

Display services status

You can display the status of node services. To do this, run the following command:

$ ./nodechain.py status
---------------------------------------------------
  _  _          _        ___  _                   
 | \| | ___  __| | ___  / __|| |_   __ _ (_) _ _  
 | .` |/ _ \/ _` |/ -_)| (__ | ' \ / _` || || ' \ 
 |_|\_|\___/\__,_|\___| \___||_||_|\__,_||_||_||_|
---------------------------------------------------
===================================================
                STATUS SELECTION
===================================================
[RUNNING]      1.Connector
[RUNNING]      2.Apis
               3.Exit
Please choose any option to show its status (1-3): 2
===================================================
                BLOCKCHAIN SELECTION
===================================================
[OFF]          1.Bitcoin
[RUNNING]      2.Ethereum
[OFF]          3.Bitcoin-cash
[OFF]          4.Terra
               5.Exit
Please choose the blockchain that you want to use to build up/stop the node(1-5): 2
===================================================
                NETWORK SELECTION
===================================================
[OFF]          1.Regtest
[RUNNING]      2.Testnet
[OFF]          3.Mainnet
               4.Exit
Please choose the network that you want to use (1-4): 2
Getting information of ethtestnetapi containers...
===================================================
                ETH TESTNET INFORMATION
===================================================
[RUNNING]      Ethereumgo

Connector API information:
{
    "coin": "eth",
    "config": {
        "host": "ethereumgo",
        "protocol": "http",
        "rpcPort": 8545,
        "wsPort": 8545
    },
    "message": "Configuration for testnet network for currency eth retrieved successfully",
    "network": "testnet",
    "success": true
}
PreviousInitial setupNextCommands

Last updated 3 years ago