Network Definition File (NDF)

From xx network wiki
Jump to navigation Jump to search
This is a team contributed page

The Network Definition File (NDF) describes the Nodes, Gateways, and other servers on the network and how to communicate with them. The NDF is a JSON file with a predefined structure that matches the internal NetworkDefinition structure.

Some objects on the NDF must have data that matches predefined formats. These are outlined below.

  • Id: must be a byte array 33 bytes long that matches the id.ID object. IDs must be generated using Crypto and cannot be created any other way.
  • Tls_certificate: must be a TLS certificate in PEM format. All new lines should be replaced with Unix escape sequence \n.

Example NDF

{
	"Timestamp": "YYYY-MM-DDTHH:MM:SS.0000000+00:00",

Timestamp in RFC3339 format.

	"Gateways": [
		
		{
			"Id": "dGVzdDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB",
			"Address": "0.0.0.0:80000",
			"Tls_certificate": "-----BEGIN CERTIFICATE-----..."
		},
		
	],

Array of Gateway objects in the network. Each Gateway has an ID, an address string (containing the IP address and port), and a TLS certificate.

	"Nodes": [
		
		{
			"Id": "dGVzdDMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC",
			"Address": "0.0.0.1:40000",
			"Tls_certificate": "-----BEGIN CERTIFICATE-----..."
		},
		
	],

Array of Node objects in the network. Each Node has an ID, address, and TLS certificate in the same format as the Gateway object.

	"Registration": {
		"Address": "0.0.0.3:18000",
		"Tls_certificate": "-----BEGIN CERTIFICATE-----..."
	},

The Registration field has information about the Permissioning server.

	"Notification": {
		"Address": "0.0.0.7",
		"Tls_certificate": "-----BEGIN CERTIFICATE-----..."
	},

The Notification field has information about Notification Bot.

	"Udb": {
		"Id": "dGVzdDYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD"
		"Cert": "-----BEGIN CERTIFICATE-----...",
		"Address": "0.0.0.52:18001",
		"DhPubKey": "eyJWYWx1ZSI6NTEwOTQzODAxNTcyOTQ4NjUzN...",
	},

The Udb field contains the ID, certificate, address, and Diffie–Hellman key of User Discovery

	"E2e": {
		"Prime": "E2EE983D031DC1DB6F1A7A67DF0E9A8E5561DB8E...",
		"Generator": "2"
	},
	"Cmix": {
		"Prime": "F6FAC7E480EE519354C0F856AEBDC43AD6014...",
		"Generator": "2"
	}
}

Both the E2e and Cmix fields define the cyclic groups that messaging and end to end encryption operate within. The E2e group is based on a 3192-bit strong and safe prime and the Cmix group is a 2048 strong and safe prime.