This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Kore Node

Intermediary between the different Kore Clients and Kore Base.

1 - What is

What is Kore Node?

Kore Node is an intermediary between Kore Base and the different Kore Clients such as Kore HTTP. Its main functions are 4:

  1. Create an API that will be consumed by the different Kore Clients in order to communicate with Kore Base, the objective of this API is the simplification of the types, that is, it is responsible for receiving basic types such as String and converting them into complex types that Kore Base expects to receive as a DigestIdentifier. Another objective of this API is to combine different methods of the Kore Base API to perform a specific functionality such as creating a traceability subject, in this way we add an abstraction layer on top of the Kore Base API.
  2. Implement the different methods that the databases need so that Kore Base can use them, in this way Kore Base is not coupled with any database and by defining some methods it is capable of working with a LevelDB, a SQlite or a Cassandra.
  3. Receive configuration parameters through .toml, .yaml and .json files; in addition to environment variables. To delve deeper into the configuration parameters, visit the following section.
  4. Optionally expose a Prometheus to obtain metrics. For more information on prometheus configuration visit the next section.

Currently Kore Node consists of 3 features:

  • sqlite: To make use of the SQlite database.
  • leveldb: To make use of the LevelDB database.
  • prometheus: to expose an API with an endpoint called /metrics where metrics can be obtained.

2 - Configuration

Configuration for Node Client Http

These configuration parameters are general to any node regardless of the type of client to be used, the specific parameters of each client will be found in their respective sections.

Configuring a node can be done in different ways. The supported mechanisms are listed below, from lowest to highest priority:

  • Environment Variables.
  • Configuration file.

Environment Variables

The following configuration parameters can only be configured through environment variables and as parameters to the binary that is generated when the client is compiled, but not using files:

Environment variable Description Input parameter What you receive
KORE_PASSWORD Password that will be used to encrypt the cryptographic material -p The password
KORE_FILE_PATH Path of the configuration file to use -f File path

The parameters that can be configured through environment variables and files are:

Environment variable Description What you receive Default value
KORE_PROMETHEUS Address and port where the server that contains the endpoint /metrics where the prometheus is located is going to be exposed An IP address and a port 0.0.0.0:3050
KORE_KEYS_PATH Path where the private key will be saved in PKCS8 format encrypted with PKCS5 A directory examples/keys
KORE_DB_PATH Path where the database will be created if it does not exist or where the database is located if it already exists A directory For LevelDB examples/leveldb and for SQlite examples/sqlitedb
KORE_NODE_KEY_DERIVATOR Key derivator to use A String with Ed25519 or Secp256k1 Ed25519
KORE_NODE_DIGEST_DERIVATOR Digest derivator to use >A String with Blake3_256, Blake3_512, SHA2_256, SHA2_512, SHA3_256 or SHA3_512 Blake3_256
KORE_NODE_REPLICATION_FACTOR Percentage of network nodes that receive protocol messages in an iteration Float value 0.25
KORE_NODE_TIMEOUT Waiting time to be used between protocol iterations Unsigned integer value 3000
KORE_NODE_PASSVOTATION Node behavior in the approval phase Unsigned integer value, 1 to always approve, 2 to always deny, another value for manual approval 0
KORE_NODE_SMARTCONTRACTS_DIRECTORY Directory where the subjects' contracts will be stored A directory Contracts
KORE_NETWORK_PORT_REUSE True to configure port reuse for local sockets, which involves reusing listening ports for outgoing connections to improve NAT traversal capabilities. Boolean Value false
KORE_NETWORK_USER_AGENT The user agent The user agent kore-node
KORE_NETWORK_NODE_TYPE Node type A String: Bootstrap, Addressable or Ephemeral Bootstrap
KORE_NETWORK_LISTEN_ADDRESSES Addresses where the node will listen Addresses where the node will listen /ip4/0.0.0.0/tcp/50000
KORE_NETWORK_EXTERNAL_ADDRESSES External address through which the node can be accessed, but it is not among its interfaces External address through which the node can be accessed, but it is not among its interfaces /ip4/90.0.0.70/tcp/50000
KORE_NETWORK_ROUTING_BOOT_NODES Addresses of the Boot Nodes in the P2P network to which we will connect to become part of the network Addresses of the Boot Nodes, where if it has more than one address it will be separated with a _ and the addresses are separated from the Peer-ID of the node using /p2p/
KORE_NETWORK_ROUTING_DHT_RANDOM_WALK True to enable random walk in Kademlia DHT Boolean Value true
KORE_NETWORK_ROUTING_DISCOVERY_ONLY_IF_UNDER_NUM Number of active connections for which we interrupt the discovery process Number of active connections u64::MAX
KORE_NETWORK_ROUTING_ALLOW_NON_GLOBALS_IN_DHT True if non-global addresses are allowed in the DHT Boolean Value false
KORE_NETWORK_ROUTING_ALLOW_PRIVATE_IP If the address of a node is false, it cannot be private Boolean Value false
KORE_NETWORK_ROUTING_ENABLE_MDNS True to activate mDNS Boolean Value true
KORE_NETWORK_ROUTING_KADEMLIA_DISJOINT_QUERY_PATHS When enabled, the number of separate paths used is equal to the configured parallelism Boolean Value true
KORE_NETWORK_ROUTING_KADEMLIA_REPLICATION_FACTOR The replication factor determines how many closest peers a record is replicated to Unsigned integer value greater than 0 false
KORE_NETWORK_ROUTING_PROTOCOL_NAMES Protocols supported by the node Protocols supported by the node /kore/routing/1.0.0
KORE_NETWORK_TELL_MESSAGE_TIMEOUT_SECS Message waiting time Number of seconds 10
KORE_NETWORK_TELL_MAX_CONCURRENT_STREAMS Maximum number of simultaneous transmissions Unsigned integer value 100
KORE_NETWORK_CONTROL_LIST_ENABLE Enable access control list Boolean value true
KORE_NETWORK_CONTROL_LIST_ALLOW_LIST List of allowed peers Comma separated text string Peer200,Peer300
KORE_NETWORK_CONTROL_LIST_BLOCK_LIST List of blocked peers Comma separated text string Peer1,Peer2
KORE_NETWORK_CONTROL_LIST_SERVICE_ALLOW_LIST List of allowed service URLs Comma separated text string http://90.0.0.1:3000/allow_list
KORE_NETWORK_CONTROL_LIST_SERVICE_BLOCK_LIST List of blocked service URLs Comma separated text string http://90.0.0.1:3000/block_list
KORE_NETWORK_CONTROL_LIST_INTERVAL_REQUEST Request interval in seconds Number of seconds 58

.json File

{
            "kore": {
              "network": {
                  "user_agent": "Kore2.0",
                  "node_type": "Addressable",
                  "listen_addresses": ["/ip4/127.0.0.1/tcp/50000","/ip4/127.0.0.1/tcp/50001","/ip4/127.0.0.1/tcp/50002"],
                  "external_addresses": ["/ip4/90.1.0.60/tcp/50000", "/ip4/90.1.0.61/tcp/50000"],
                  "tell": {
                    "message_timeout_secs": 58,
                    "max_concurrent_streams": 166
                  },
                  "control_list": {
                    "enable": true,
                    "allow_list": ["Peer200", "Peer300"],
                    "block_list": ["Peer1", "Peer2"],
                    "service_allow_list": ["http://90.0.0.1:3000/allow_list", "http://90.0.0.2:4000/allow_list"],
                    "service_block_list": ["http://90.0.0.1:3000/block_list", "http://90.0.0.2:4000/block_list"],
                    "interval_request": 99
                  },
                  "routing": {
                    "boot_nodes": ["/ip4/172.17.0.1/tcp/50000_/ip4/127.0.0.1/tcp/60001/p2p/12D3KooWLXexpg81PjdjnrhmHUxN7U5EtfXJgr9cahei1SJ9Ub3B","/ip4/11.11.0.11/tcp/10000_/ip4/12.22.33.44/tcp/55511/p2p/12D3KooWRS3QVwqBtNp7rUCG4SF3nBrinQqJYC1N5qc1Wdr4jrze"],
                    "dht_random_walk": false,
                    "discovery_only_if_under_num": 55,
                    "allow_non_globals_in_dht": true,
                    "allow_private_ip": true,
                    "enable_mdns": false,
                    "kademlia_disjoint_query_paths": false,
                    "kademlia_replication_factor": 30,
                    "protocol_names": ["/kore/routing/2.2.2","/kore/routing/1.1.1"]
                  },
                  "port_reuse": true
              },
              "node": {
                "key_derivator": "Secp256k1",
                "digest_derivator": "Blake3_512",
                "replication_factor": 0.555,
                "timeout": 30,
                "passvotation": 50,
                "smartcontracts_directory": "./fake_route"
              },
              "db_path": "./fake/db/path",
              "keys_path": "./fake/keys/path",
              "prometheus": "10.0.0.0:3030"
            }
          }

.toml File

[kore.network]
user_agent = "Kore2.0"
node_type = "Addressable"
port_reuse = true
listen_addresses = ["/ip4/127.0.0.1/tcp/50000","/ip4/127.0.0.1/tcp/50001","/ip4/127.0.0.1/tcp/50002"]
external_addresses = ["/ip4/90.1.0.60/tcp/50000","/ip4/90.1.0.61/tcp/50000"]
        
[kore.network.control_list]
enable = true
allow_list = ["Peer200", "Peer300"]
block_list = ["Peer1", "Peer2"]
service_allow_list = ["http://90.0.0.1:3000/allow_list", "http://90.0.0.2:4000/allow_list"]
service_block_list = ["http://90.0.0.1:3000/block_list", "http://90.0.0.2:4000/block_list"]
interval_request = 99

[kore.network.tell]
message_timeout_secs = 58
max_concurrent_streams = 166
        
[kore.network.routing]
boot_nodes = ["/ip4/172.17.0.1/tcp/50000_/ip4/127.0.0.1/tcp/60001/p2p/12D3KooWLXexpg81PjdjnrhmHUxN7U5EtfXJgr9cahei1SJ9Ub3B", "/ip4/11.11.0.11/tcp/10000_/ip4/12.22.33.44/tcp/55511/p2p/12D3KooWRS3QVwqBtNp7rUCG4SF3nBrinQqJYC1N5qc1Wdr4jrze"]
dht_random_walk = false
discovery_only_if_under_num = 55
allow_non_globals_in_dht = true
allow_private_ip = true
enable_mdns = false
kademlia_disjoint_query_paths = false
kademlia_replication_factor = 30
protocol_names = ["/kore/routing/2.2.2", "/kore/routing/1.1.1"]
        
[kore.node]
key_derivator = "Secp256k1"
digest_derivator = "Blake3_512"
replication_factor = 0.555
timeout = 30
passvotation = 50
smartcontracts_directory = "./fake_route"
        
[kore]
db_path = "./fake/db/path"
keys_path = "./fake/keys/path"    
prometheus = "10.0.0.0:3030"  

.yaml File

kore:
  network:
    control_list:
      allow_list:
        - "Peer200"
        - "Peer300"
      block_list:
        - "Peer1"
        - "Peer2"
      service_allow_list:
        - "http://90.0.0.1:3000/allow_list"
        - "http://90.0.0.2:4000/allow_list"
      service_block_list:
        - "http://90.0.0.1:3000/block_list"
        - "http://90.0.0.2:4000/block_list"
      interval_request: 99
      enable: true
    user_agent: "Kore2.0"
    node_type: "Addressable"
    listen_addresses:
      - "/ip4/127.0.0.1/tcp/50000"
      - "/ip4/127.0.0.1/tcp/50001"
      - "/ip4/127.0.0.1/tcp/50002"
    external_addresses:
      - "/ip4/90.1.0.60/tcp/50000"
      - "/ip4/90.1.0.61/tcp/50000"
    tell:
      message_timeout_secs: 58
      max_concurrent_streams: 166
    routing:
      boot_nodes:
        - "/ip4/172.17.0.1/tcp/50000_/ip4/127.0.0.1/tcp/60001/p2p/12D3KooWLXexpg81PjdjnrhmHUxN7U5EtfXJgr9cahei1SJ9Ub3B"
        - "/ip4/11.11.0.11/tcp/10000_/ip4/12.22.33.44/tcp/55511/p2p/12D3KooWRS3QVwqBtNp7rUCG4SF3nBrinQqJYC1N5qc1Wdr4jrze"
      dht_random_walk: false
      discovery_only_if_under_num: 55
      allow_non_globals_in_dht: true
      allow_private_ip: true
      enable_mdns: false
      kademlia_disjoint_query_paths: false
      kademlia_replication_factor: 30
      protocol_names:
        - "/kore/routing/2.2.2"
        - "/kore/routing/1.1.1"
    port_reuse: true
  node:
    key_derivator: "Secp256k1"
    digest_derivator: "Blake3_512"
    replication_factor: 0.555
    timeout: 30
    passvotation: 50
    smartcontracts_directory: "./fake_route"
  db_path: "./fake/db/path"
  keys_path: "./fake/keys/path"
  prometheus: "10.0.0.0:3030"