Documentation

Template

How Ntity templates describe the structure of a certificate, and the list of official templates and wallets.

Data structure

When writing to a blockchain each byte has a cost, which is why the JSON of an Ntity document is minimized with short keys, while keeping the data human readable. The keys are described in the tables below.

Header keys

KeyTitleDescriptionDefault
HHashHash of the full document, including private datarequired
VVersionVersion of the template, or datagram version for a certificate00
NNameCertificate name. It should be unique, or the same across the versions of a certificate. For sub-certificates the convention is to use a slash, eg. Sport/Tennis/License or Sport/Basket/License.not null
EExpirationFormat defined in the datagram. Older documents may use the key X.null
SServerServer URLntity.io
MTemplateID_Doc of the templatenull
LLanguageID_Lang. JSON by default, but it can be any notation or scripting language, eg. SYS_VAR_DOCUMENT_JSON.null
ZCompressionID_Format, used for compressed data on data oriented blockchains only. When set, it is visible on the blockchain, eg. SYS_VAR_DOCUMENT_GZCOMPRESS, SYS_VAR_DOCUMENT_ZIP. Only the fields flagged with the caret sign ^ are compressed, see flags.null
AAddressOnly used by a move or transfer operation. JSON object made of networkName, networkId and address, eg. {"networkName":"ETH", "networkId":"1", "address":"0x321321321…"}

Data & children

KeyTitleDescriptionDefault
DDataHeader of the complete structureobject
CChildThe syntax of a child follows the regular expression C(?:([0-9]*([\+\-])?)(?:\#([0-9]*)(?:\-([0-9]*))?)?)?, for example:
  • C1: first child, 0 to 99 occurrences
  • C2#1-3: second child, minimum 1 and maximum 3 occurrences
  • C3+#5: third child, published, exactly 5 occurrences
C1
TTypeStructure type of the block, one of the values below
eEntityTable
aAttributeTable
rRelationTable
tTransactionTable
hDocumentTable

Fields

KeyTitleDescription
nNameField, can also be used as the make of an object
fFirstnameField, can also be used as the model of an object
vValueField
dDescriptionField
yID_TypeRelated to the SYS_VAR table, can be an array, eg. [14,15,16,17]
sID_Type_SubRelated to the SYS_VAR table
stID_StatusRelated to the SYS_VAR table
cCommentField
cnContentField
eoOpeningA birth date, or a creation date for an entity. Date format¹
ecClosingA day of death, or a destruction date for an entity. Date format¹
cbCreatedByRelated to the Entity table (ID_Entity). cb: Operator returns the ID of the entity (int), cb: Operator:n returns its name (string).
ctCreatedDate format¹
pParamsField
ftID_FormatLinked to a document
tqQuantityLinked to a transaction
tuUnitLinked to a transaction
tpPriceLinked to a transaction
tdDiscountLinked to a transaction
txTaxLinked to a transaction
ttTotalLinked to a transaction
tcCurrencyLinked to a transaction
poPositionLinked to a transaction

¹ Dates can be a timestamp or a human readable date YYYYMMDD[hhmm[ss]].

Flags

Flags are appended to a key, eg. D+, n*, c!.

FlagTitleDescription
+ - ^Published dataSet after Data (D) or a Child (C), only on data oriented blockchains:
  • + published, readable on the blockchain
  • - unpublished
  • ^ published and compressed, with the algorithm set in Z
All children inherit the status of their parent. Without a flag, data is not published (see published or hidden data).
=ConstantData is a constant value. A constant can also be set with an array of a single value, like ["123456"]
*RequiredData is required and not null
!PrivateData must be hidden from the public
~Out of hashData is not used in the hash, and therefore cannot be used to verify the certificate
Precautions and advice
  • Use the character table [a-z0-9] and ASCII signs.
  • Capital letters and accented characters are not recommended.
  • No spaces before or after a string (trim).
  • No tabs or double spaces: all spaces must be converted to a single space.
  • No line breaks.

Examples

This simple example uses the JSON notation to create a basketball player license. The language is optional in case of JSON.

Sport license template
N: Sport/License
V: 1
L: json
D+:
 T: e
 n: Player Name
 f: Team name
 eo: Birthdate
 ad1: League
 ad2: Season
 v-: License Number
Same template in JSON
{
  "N": "Sport/License",
  "V": 1,
  "L": "json",
  "D+": {
    "T": "e",
    "n": "Player Name",
    "f": "Team name",
    "eo": "Birthdate",
    "ad1": "League",
    "ad2": "Season",
    "v-": "License Number"
  }
}
Same template in compact JSON
{"N":"Sport/License","V":1,"L":"json","D+":{"T":"e","n":"Player Name","f":"Team name","eo":"Birthdate","ad1":"League","ad2":"Season","v-":"License Number"}}
Full certificate
{
  "N": "Sport/License",
  "V": 1,
  "L": "json",
  "D+": {
    "T": "e",
    "n": "Michael Jordan",
    "f": "Chicago Bulls",
    "eo": "1963-02-17",
    "ad1": "Alumni",
    "v-": "NN787685555"
  }
}
Published certificate
{
  "N": "Sport/License",
  "V": 1,
  "L": "json",
  "H": "A875876t76Ae223…",
  "E": "ETERNAL",
  "D+": {
    "T": "e",
    "n": "Michael Jordan",
    "f": "Chicago Bulls",
    "eo": "1963-02-17",
    "ad1": "Alumni"
  }
}

In this example the data (D+) is published, but not the license number (v-). The published document generates a hash, eg. 429387429387942d98798798e7987, which is also its IPFS link.

Notations

The same template and certificate in different notations. In this simple example the template does not need any end date: the issue date and the expiry date of the certificate define the validity of the license.

Template, YAML
Name: Basketball_license
Version: 1
Language: json
Data:
  Type: e
  Name: Name
  Firstname: Firstname
  Description: Team Name
  Opening: Birthdate
Certificate, YAML
Name: NBA:112233
Data:
  Type: e
  Name: Jordan
  Firstname: Michael
  Description: Chicago Bulls
  Opening: 1963-02-17
Template, raw JSON
{
  "Name": "Basketball_license",
  "Version": 1,
  "Language": "json",
  "Data": {
    "Type": "e",
    "Name": "Name",
    "Firstname": "Firstname",
    "Description": "Team Name",
    "Opening": "Birthdate"
  }
}
Certificate, raw JSON
{
  "Name": "NBA:112233",
  "Data": {
    "Type": "e",
    "Name": "Jordan",
    "Firstname": "Michael",
    "Description": "Chicago Bulls",
    "Opening": "1963-02-17"
  }
}
Template, compact JSON
{"T":"e","n":"Name","f":"Firstname",
"d":"Team Name","eo":"Birthdate"}
Certificate, compact JSON
{"T":"e","n":"Jordan","f":"Michael",
"d":"Chicago Bulls","eo":"1963-02-17"}

Advanced example: watch making

Template
{
  "T": "e",
  "n*": "Make",
  "f*": "Model",
  "d": "Serial",
  "C1": [{
    "T": "t",
    "y*": "Process",
    "d*": "Step",
    "cb": "Operator:n",
    "ct": "End date",
    "c!": "Serial / Result"
  }]
}
Certificate
{
  "T": "e",
  "n": "GVCHIANI",
  "f": "MasterBlock",
  "d": "2009",
  "C1": [
    {
      "T": "t",
      "y": 10000,
      "d": "Mounting",
      "cb": 123,
      "ct": "2021-04-30",
      "c": "Secret 1"
    },
    {
      "T": "t",
      "y": 10001,
      "d": "Control Quality",
      "cb": 123,
      "ct": "2021-04-30",
      "c": "Secret 2"
    }
  ]
}
Information

Flags such as * or ! are not part of the output. Each result is displayed through the filter of its template only.

Published or hidden data

Published data
{"N":"Sport/License","V":1,"L":"json","D+":{"T":"e","n":"Player Name", …

The IPFS hash of this document is computed (eg. 0xhashNo1): the content in the database and the data stored on IPFS are the same.

Hidden data
{"N":"Sport/License","V":1,"L":"json","D":{"T":"e","n":"Player Name", …

The only difference with the previous example is the missing + sign after D: by default data is not published.

Template store options

Optional parameters that can be added to restrict a template:

KeyExampleDescription
bc["NTT"]Only on the given blockchains
to"0x353f8302CDD831D1a438AA56EE0a1570965251B0"Send to a specific wallet
price["10","CHF"]Fix the certificate price
name"Force Certificate Name"Lock the certificate name
logged"true"Only for logged in users
logo"https://cdn.cryptolex.ch/img/icon/miner.svg"Add an illustration
tag["#system","#validator","#ntity","#node"]Add hashtags
Example
{
  "bc": ["NTT"],
  "to": "0x353f8302CDD831D1a438AA56EE0a1570965251B0",
  "price": ["10", "CHF"],
  "name": "Force Certificate Name",
  "logged": "true",
  "logo": "https://cdn.cryptolex.ch/img/icon/miner.svg",
  "tag": ["#system", "#validator", "#ntity", "#node"]
}

Template list

Version 0 is the previous version / testnet. The ID is the nonce, a unique transaction counter, on the official ETH template wallet.

IDNameVersionDescriptionTransaction
16Production MasterBlock2CreatedBy is an int and the output value is the name0xa7cbd07a…
1Production MasterBlock1Field "Serial / Result" is now private0x192fa4d6…
0Production MasterBlock0Original version of the MasterBlock supply chain production. It can be used as a universal basic tool linking transactions to one entity: each process is a transaction.0xd893d5ed…
18VOIX3Quorum information added0xbe159b97…
13VOIX2Children is a transaction, constant added, data published0x5e01a49a…
12VOIX1Children is an attribute0x4cc15b9b…
14VOIX-Token3Compression is now the general argument Z0xc9556bd3…
15VOIX-Ballots1Plain data compressed0x7ead0c2b…
20Sport:License2License expiry date0x9a21c153…
6Sport:License1Original version0xf7a2fe03…
23Ntity:AddPeer1Add peer0x35537162…
22Ntity:Pay2Payment0x3b06e313…
21Ntity:Pay1Payment datagram v10x705a993e…

API & rights management

By default all ntities are published and private fields are hidden from the public. See the API documentation.

Ntity official wallets

Services

BlockchainFunctionNetworkWallet
NtityCertificate / FeeMainnet0xCAF82fEB1abcb131a2FAb6584BE79c69e5929a68
NtityTemplateMainnet0x6B3FD6c568e6c0de99d159372113FA1b7BA4a834
NtityPay OUTMainnet0x84529da6ea24d9c5980c186ffb5b220abd17152c
NtityBuy creditMainnet0xD7CAaf4FAd165a472BAEa85845f08b14147b2523
EthereumCertificateMainnet0xCAF82fEB1abcb131a2FAb6584BE79c69e5929a68
EthereumTemplateMainnet0x6B3FD6c568e6c0de99d159372113FA1b7BA4a834
BitcoinCertificateMainnet1A3Y57pBQEPzNz2WKuGnsztEjDZXniXVS4
BitcoinCertificate v2Mainnetbc1qg2ad8xfwyg8padvjdmugm3ryqax2ya3ktaen4t

Validators

BlockchainFunctionNetworkWallet
NtityReward OUTMainnet0x126ec1b3f2a8eab944ad3df9f30806ce77196717
NtityRegisterMainnet0x353f8302CDD831D1a438AA56EE0a1570965251B0

Core wallets

Testnet

BlockchainFunctionNetworkWallet
NtityFaucet OUTHaradev0xfA6c3De8F7E15a7e1DC10068da43b2fe1a4f8C47
NtityCertificate OUTHaradev0xacaf3e2d226c4f64b70ce84f002b60dda15a2cc0
NtityOld FaucetHaradev0x0dcb3043c88a2a63e4e3fbcc348f11a6bcc6c833
EthereumOld TemplateRopsten0x4a07c2c95fd7aea20e125d42e6f973c3a4bcb03a