# Configure

TIP

In order to connect to the testnet be sure to use one of the following configurations:

  • --peers="/ip4/45.76.215.117/tcp/4097/ipfs/QmNT5ZNU8Nf9shpuz45phNHimUnsNZRj35B3ucSE3iKCk5"
  • GNY_P2P_PEERS=/ip4/45.76.215.117/tcp/4097/ipfs/QmNT5ZNU8Nf9shpuz45phNHimUnsNZRj35B3ucSE3iKCk5

# Start Forging

WARNING

Do not reuse your delegate secret on different GNY Blockchain networks (localnet, testnet, mainnet). Otherwise you will make yourself vulnerable to replay attacks.

TIP

In order to start forging you need to first register as delegate. Be sure to checkout our Guides on how to register as delegate and how to create a random secret.

In order to start forging please pass a secret or multiple secrets (comma separated) to the GNY Blockchain. This option is optional.

Change CLI arguments:

- npm run start
+ npm run start -- --secret="chief next globe deny try danger trust wet spoil away eight task"
1
2

Change your docker-compose.yml:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+     - GNY_SECRET=chief next globe deny try danger trust wet spoil away eight task
1
2
3
4
5
6

# Configure Public IP

WARNING

The publicIp option is mandatory on the testnet and on the mainnet. If you don't set it then the node will automatically use its privateIp which which will make the p2p communication with other nodes not work.

The GNY Blockchain uses libp2p for p2p communication. Libp2p itself communicates with the help of multiaddr. The standard procedure is that the GNY Blockchain adds a multiaddrs that listens on 0.0.0.0 and the libp2p automatically binds to the privateIP address. As pointed out above this will not work on the testnet and on the mainnet

const multi = `/ip4/0.0.0.0/tcp/4097`;
peerInfo.multiaddrs.add(multi);
1
2

This results in a multiaddr array where for example 10.0.3.4 is used as the private IP address

{
  multiaddr: [
    "/ip4/10.0.3.4/tcp/4097/ipfs/QmQbVdde9AeXSP3FoLyVNd3Fi3BjCe2tFyJV43bNWEBYSA"
  ];
}
1
2
3
4
5

The problem shows itself in the communication with other nodes. Because our node announces a private IP address which other nodes can't communicate with. Therefore we have to pass the publicIP to the GNY node.

The public ip can be passed to the GNY node:

  • as argument: --publicIP=20.188.42.0
  • as environment variable: GNY_PUBLIC_IP=20.188.42.0

Pass public ip as argument:

- npm run start
+ npm run start -- --publicIP="20.188.42.0"
1
2

Pass public ip as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+	  - GNY_PUBLIC_IP=20.188.42.0
1
2
3
4
5
6

TIP

After that the nodes own public ip configuration should be checked with the HTTP API endpoint /api/peers/info. This endpoint displays information about the own node!

It is important that the multiaddrs array displays only one entry with the correct publicIp

multiaddrs_publicIp_config

multiaddrs_publicIp_api_peers_info


# Configure P2P Secret

The p2p secret keeps the connection between peers secure. This is option is mandatory.

The p2p secret can be passed to the GNY node:

  • as argument: --privateP2PKey="CAASqQkwggSlAgEA..."
  • as environment variable: GNY_P2P_SECRET="CAASqQkwggSlAgEA..."

Pass p2p secret as argument:

- npm run start
+ npm run start -- --privateP2PKey="CAASqQkwggSlAgEA..."
1
2

Pass p2p secret as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+	  - GNY_P2P_SECRET="CAASqQkwggSlAgEA..."
1
2
3
4
5
6

# Configure P2P Peers

The p2p peers option says to which peer(s) (comma separated) we should connect in the network. This option is optional

The p2p peers option can be passed to the GNY node:

  • as argument: --peers="/ip4/45.76.215.117/tcp/4097/ipfs/QmNT5ZNU8Nf9shpuz45phNHimUnsNZRj35B3ucSE3iKCk5"
  • as environment variable: GNY_P2P_PEERS=/ip4/45.76.215.117/tcp/4097/ipfs/QmNT5ZNU8Nf9shpuz45phNHimUnsNZRj35B3ucSE3iKCk5

Pass p2p peers as argument:

- npm run start
+ npm run start -- --peers="/ip4/45.76.215.117/tcp/4097/ipfs/QmNT5ZNU8Nf9shpuz45phNHimUnsNZRj35B3ucSE3iKCk5"
1
2

Pass p2p peers as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+	  - GNY_P2P_PEERS=/ip4/45.76.215.117/tcp/4097/ipfs/QmNT5ZNU8Nf9shpuz45phNHimUnsNZRj35B3ucSE3iKCk5
1
2
3
4
5
6

# Configure DB Password

The dbPassword option sets the password for the db to connect to.

The dbPassword option can be passed to the GNY node:

  • as argument: --dbPassword=docker
  • as environment variable: GNY_DB_PASSWORD=docker

Pass dbPassword as argument:

- npm run start
+ npm run start -- --dbPassword=docker
1
2

Pass dbPassword as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+    - GNY_DB_PASSWORD=docker
1
2
3
4
5
6

# Configure DB Name

The dbDatabase configures the database name to which the GNY Blockchain should connect to.

The dbDatabase option can be passed to the GNY node:

  • as argument: --dbDatabase=postgres
  • as environment variable: GNY_DB_PASSWORD=postgres

Pass dbDatabase as argument:

- npm run start
+ npm run start -- --dbDatabase=postgres
1
2

Pass dbDatabase as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+    - GNY_DB_DATABASE=postgres
1
2
3
4
5
6

# Configure DB User

The dbUser sets the database user with which the GNY Blockchain should connect to.

The dbUser option can be passed to the GNY node:

  • as argument: --dbUser=postgres
  • as environment variable: GNY_DB_USER=postgres

Pass dbUser as argument:

- npm run start
+ npm run start -- --dbUser=postgres
1
2

Pass dbUser as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+    - GNY_DB_USER=postgres
1
2
3
4
5
6

# Configure DB Host

The dbHost sets the database host to which the GNY Blockchain should connect to.

The dbHost option can be passed to the GNY node:

  • as argument: --dbHost=db1
  • as environment variable: GNY_DB_HOST=db1

Pass dbHost as argument:

- npm run start
+ npm run start -- --dbUser=db1
1
2

Pass dbHost as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+    - GNY_DB_HOST=db1
1
2
3
4
5
6

# Configure DB Port

The dbPort sets the database port to which the GNY Blockchain should connect to.

The dbPort option can be passed to the GNY node:

  • as argument: --dbPort=5432
  • as environment variable: GNY_DB_PORT=5432

Pass dbPort as argument:

- npm run start
+ npm run start -- --dbPort=5432
1
2

Pass dbPort as environment variable:

services:
  # db1 service omitted
  node1:
    # other keys omitted
    environment:
+    - GNY_DB_Port=5432
1
2
3
4
5
6

# All Environment Variable Options

# All available Options

Options:
  -V, --version            output the version number
  --config <path>          Config file path
  --port <port>            Listening port number
  --address <ip>           Listening host name or ip
  --genesisblock <path>    Genesisblock path
  --peers [peers...]       Peers list
  --log <level>            Log level: log|trace|debug|info|warn|error|fatal
  --base <dir>             Base directory
  --privateP2PKey <key>    Private P2P Key (base64 encoded) - overrides p2p_key.json file
  --secret [secret...]     comma separated secrets
  --publicIP <ip>          Public IP of own server, default private IP
  --network <network>      Must be: localnet | testnet | mainnet
  --dbPassword <password>
  --dbDatabase <database>
  --dbUser <user>
  --dbHost <host>
  --dbPort <port>
  -h, --help               output usage information

Environment Variables:
  GNY_NETWORK=<network>       Must be: localnet | testnet | mainnet
  GNY_PORT=<port>             Listening port number
  GNY_LOG_LEVEL=<level>       log|trace|debug|info|warn|error|fatal
  GNY_P2P_SECRET=<key>        Private P2P Key (base64 encoded) - overrides p2p_key.json file
  GNY_SECRET=[secret...]      comma separated secrets
  GNY_PUBLIC_IP=<ip>          Public IP of own server, default private IP
  GNY_P2P_PEERS=[peers...]    comma separated peers
  GNY_ADDRESS=<address>       Listening host name or ip
  GNY_DB_PASSWORD=<password>  db password
  GNY_DB_DATABASE=<database>  db name
  GNY_DB_USER=<user>          db user
  GNY_DB_HOST=<host>          db host
  GNY_DB_PORT=<port>          db port
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34