Introduction
Digital Ledger Technology (DLT), and one of its most well known application,
Blockchain, is becoming increasingly ubiquitous, by providing independent trust through
the storage and access of immutable and unfalsifiable data.
While Blockchain technology is becoming extremely popular and a lot of open source code has been made
available, for common users without coding skills, daily dealings with DLTs remain difficult. This is the
challenge that Cryptolex, through its Ntity Framework is solving for users or companies that wish to access
a turn key authenticity certification solution without the need to invest large sums of money to build one.
Datagram
The datagram is a precise structure in which the data or hash of a ntity will be encapsulated. The datagram is destined to be scalable.
This is the reason why there are several versions of the datagam.
Versions
| ID |
Version |
Detail |
Compatibility |
| 01 |
Certificate |
+---------+----------+----------+----------+---------+-------------+ ------------------+ | 12 Hex | 4 Hex | 8 Hex | 64 Hex | 16 Hex | 56 Hex | Variable size | | Char[6] | Byte[2] | Byte[4] | Byte[32] | Char[8] | Varchar[28] | Varchar[] | ├---------┼----------┼----------┼----------┼---------┼-------------┤ ------------------┤ | NTITY | 01 | Template | Hash | Expire | Name | Data | | | | version | SHA256 | | | | +---------+----------+----------+----------+---------+-------------+ ------------------+
In this datagram (01), if you wish to surcharge the certificate you must use the Data part. If you use Bitcoin as blockchain the only way to surchage is to use the Universal datagram (02) |
✓ Bitcoin, No data ✓ Ethereum ✓ Ntity
80 Bytes |
| 02 |
Universal Datagram on IPFS |
+---------+----------+----------+-------------+---------+----------+ ------------------+ | 12 Hex | 4 Hex | 8 Hex | 64 Hex | 8 Hex | 64 Hex | Variable size | | Char[6] | Byte[2] | Byte[4] | Byte[32] | Char[4] | Byte[32] | Varchar[] | ├---------┼----------┼----------┼-------------┼---------┼----------┤ ------------------┤ | NTITY | 02 | Type | Parent Tx | Operat- | Args | Data | | | | | or 0x00...0 | ion | | | +---------+----------+----------+-------------+---------+----------+ ------------------+ |
✓ Bitcoin, No data ✓ Ethereum ✓ Ntity
80 Bytes |
Syntax
| ID |
Comment |
Version |
HEX |
| NTITY |
Ntity marker followed by one [Space] |
01,02 |
4e5449545920 |
| Datagram Version |
The version number of the Ntity datagram on 2 Bytes. |
01,02 |
3031 |
| Template Version |
It is the ID of the template for the reconstruction of the Hash.
In the present example above the templates can be found in the Ethereum blockchain at the transaction 0x192fa4d6f3011d6bb3f7f46bd1a8cad521148ffa03c6639b9f01cc4e53cf9877
Linked to the official wallet's template address 0x6B3FD6c568e6c0de99d159372113FA1b7BA4a834
In Ethereum case this ID corresponds to the nonce of the transaction. On 4 Byte (a space of 2^64). |
01,02 |
30303031 |
| Hash |
The Hash (in ASCII representation) |
01,02 |
|
| Expire |
Expiry date, 2 ways to represent it :
- YYYYMMDD, NOEXPIRY, ETERNAL
- or 64 bits timestamp |
01 |
|
| Name |
The name of the certificate cannot start with “ @ ” or “>” and cannot be null.
Here is an example of Name "MasterBlock:0001"
Name can also be defined into a specific domain using pattern @Domain:Name
For example @mydomain.com:123456
Be careful maximum number of characters is 28 including @ and : |
01 |
|
| Type |
See operations list |
02 |
|
| Operation |
See operations list |
02 |
|
| Args |
See operations list |
02 |
|
| Parent TX |
If this is the first transaction, when creating a new certificate then the Parent TX is null (0x0). In all other cases the Parent TX links the previous operation transaction address. |
02 |
|
| Data |
See Data section. About Bitcoin blockchain: It is not possible to use the Data part of the datagram |
01,02 |
|
Note for Bitcoin
In the case of using the Bitcoin blockchain, the easiest way to write a datagram on the blockchain is to use the OP_RETURN method.
The OP_RETURN writing technique allows to add 80 Byte in the blockchain. This method requires us to optimize each byte without using a separator (fixed length)
The proposed datagram as follows:
Note for Ethereum & EVMs
Ethereum has not Bitcoin OP_RETURN size restriction and allow us a wider range of possibilities.
The major feature of Ethereum datagram is to link each transaction to a parent transaction.
This allow us to have multiple part Ntity certificate and can be used for product transformation case.
Datagram desicription is similar to Bitcoin Datagram above except "Data" part because there is much more bigger size limitation on Ethereum.
Data
Data represent all information that need to be displayed (depending on Template version).
There are two ways to save data. Both have advantages and disadvantages, it is important to choose the right method according to the use case. The table below can help you make the right decision.
Comparison
| Blockchain |
On-chain |
Off-chain |
| Data Storage |
Blockchain |
IPFS or Hash based Storage |
| Integrity, long term |
✔ High |
⚠ Storage / Backup needed |
| Writing cost |
⚠ High |
✔ Null |
| Storage cost |
✔ Null |
⚠ Not null |
| Access |
✔ Fast (1 reading) |
⚠ Slow (2 readings) |
| Privacy |
Public |
Public / Private |
| Bitcoin & clones |
✖ |
✔ |
| Ethereum & EVMs |
✔ |
✔ |
On-chain
Data Syntax
| > |
Data start with “>” char . |
|
|
| Network Code |
The network name is optional. If the network name is not defined, then it is the same network as the parent transaction. |
ETH, BTC, ... |
|
| TX |
It is the blockchain transaction hash |
0x12345.... |
|
| Data |
Can be any kind of data or script and it is formated as defined by the template language (usualy json)
| Format | Examples |
| Json | {"N":"Sport:Licence","V":1,"L":"json","D+":{"T":"e","n":"Player Name", ... |
| IFPS file | The ipfs format has short version Without ipfs://Qm for ipfs://Qmd6BGV8wA1Wcia3ZWSu4fJtuiQRTEH6s1DBmBc8x5dRZ9 |
| Png Image | data:image/png;base64,iVBORw0KGgoAAAAN |
|
|
|
Off-chain
As described in the comparison table, the off-chain data are linked by a hash. This hash allows the document to be retrieved on IPFS or any other network allowing hash addressing. Although IPFS is not a blockchain as such, and therefore does not guarantee the durability of the data, it remains decentralized.
The hash of the document is always written in the datagram for the
certify and
event operations.
On & Off-chain
Ntity also gives the possibility to write on-chain and off-chain data at the same time. Moreover the content of the data can be different.
Operations
The operations give us great flexibility and a different way to process information without having to use a smart contract.
For all the operations above :
- only the last owner can make a valid operation.
- if another person tries to broadcast any operation, this operation could be written but remains invalid, until owner accept it.
More information to be found in the
CBD section.
State Diagram, mermaid ▽%%{init: {'theme':'base', 'themeVariables': { 'lineColor': '#888', 'primaryColor': '#bbb'}}}%%
stateDiagram-v2
classDef ope stroke:black, stroke-width:3px
[*] --> certify
certify --> certify
certify --> own
certify --> transfer
certify --> event
certify --> merge
event --> approval : Not owner
event --> certify : Owner
merge --> approval
certify --> move
certify --> Status?
Status? --> revoke
Status? --> lock
lock --> unlock
unlock --> certify
transfer --> Blockchain?
move --> [*]
revoke --> [*]
own --> [*]
ack --> [*]
Blockchain? --> ack : Cross BC
Blockchain? --> [*] : Same BC
approval --> [*]
class certify, own, merge, transfer, move, event, revoke, lock, ack, unlock, approval ope
Operations list
certify or event
Certify
This is the first possible operation. It allows to write the basic model of any Ntity certificate.
It is possible to use
certify to overload existing data according to the CBD model, only the last information will be valid. The structure of the certificate is defined in the
template section, while the structure of the
event is much more basic.
Event
The operation
event is a similar operation to
certify and its purpose is to add events to the life of the certified Ntity.
Some examples of
event:
• Warranty extension
• Service
• Repair
• ...
Event example
for example first certificate
approval
Approval is used to validate a certificate or event issued by a third-party wallet.
In concrete terms, if you own a watch and have it repaired, the repairer will be able to issue a repair
event ,
but for it to be valid, only the owner of the watch will be able to validate the
event using the
approval operation.
Approval type
| ID |
|
Status |
Comment |
| 0000 0019 (25) |
Accepted |
Published |
Event seen by everyone |
| 0000 001A (26) |
Accepted |
Private |
Only the owner can see the event |
| 0000 0018 (24) |
Rejected |
Rejected |
The event will be hidden |
| 0000 001D (29) |
Rejected |
Spam |
All event comming from this address, will be flagged as spam |
status
Status is a pseudo operation, the operation status allows you to
•
lock •
unlock •
revokea certificate.
A Ntity certificate can have several types of status during its lifetime.
By default, the certificate is valid until its expiration date, even if it is eternal (ETERNAL).
However, in some cases we may need to
lock &
unlock a certificate for some time or even
revoke it.
From the moment we send the status
revoke . No more operations are possible and all the following operations will be ignored.
As described above, only the owner of the certificate can change its status.
transfer
transfer is the combination of the operations
move &
own in only one operation.
• Same Blockchain
The sender is the current owner and the receiver will be the new owner.
ack is useless in the same blockchain operation.
• Cross Blockchain
In the case of cross blockchain transfer, it is not possible to do it using only
transfer. To keep the track we must Acknowledge the transfer using
ack on the recipient blockchain wallet.
The bridging is done by Ntity offical wallets. The bridge is currently being implemented
TODO
Transfer example
Same Blockchain
 |
Cross-Blockchain
 |
Cross-Blockchain transfer example datagram from ETH to BTC Wallet
move
The interesting thing about
move is that you can move a certificate to another wallet and still retain ownership of it. Until you use the
own operation which will change the owner of the certificate
Be careful, if you make a
move on a wallet of which you are not the owner, the owner can take over the ntity and become the owner, by using
own.
own
own will allow to give the ownership to another wallet.
The original owner of a certificate is the signing wallet owner.
The signatory’s wallet can be different than the item wallet.
For example Company MyGem holds wallet 0xABCD, it wants to certify a stone having the wallet 0x1234:
the "FROM" will be 0xABCD and "TO" wallet 0x1234.
MyGem remains the owner of the certificate event if the certificate is written on wallet 0x1234.
If the
own is set to a wallet like 0x00000000...000 the ownership will be lost forever.
merge
A merge is a request to bind a certificate that has no connection with the future certificate.
The
merge operation must be followed by an
ack operation to be validated.
Please note that the
merge operation transfers ownership to the owner of the target certificate.
ack
Acknowledge the transfer or merge operation using
ack on the recipient's certificate.
Please refer to the
transfer or
merge section for further explanations.
CBD : Cascading Blockchain Datagram
CBD; what's that smoky acronym ?
The CBD stands for Cascading Blockchain Datagram. This means that all data is overwritten from the first to the last transaction following 2 simple rules:
- New operations stand into the current wallet
- Only the operations signed by the current owner are valid
The operations of a CBD can be linked in 2 ways, either serially or in parallel.
- SERIAL : operation is linked to the last operation or to the original certificate if there is no operation: for example in the case of a production line or the follow-up of the life of a product.
- PARALLEL : operation is linked to the original certificate: for example in the case of a vote.
Use case, serial
• First the watch factory certify the brand new watch. • Then the factory transfers the certificate to the new owner. The transfer operation first move the certificate to the new owner's wallet then defines the new owner of the certificate. At this time the factory doesn’t have any possibility to get the watch certificate back.
• The new owner decides to buy a warranty extension. The factory sends and signs the warranty extension and once the owner accepts, it creates a new event. Data is signed by the factory and the event is signed by the owner.
• The owner decides to send the watch for service. Exactly like the warranty extension, it creates an event.
• The owner lost the watch, at this time he can broadcast the new status of the watch as lock and add message like: "Stolen !"
• One week later the owner finds the watch into the dishwasher, he can now change the status to "Unlock" with the message : "Found :)"
|  |
Use case, parallel & serial
This example shows how it is possible to use Ntity for raw material processing. This makes traceability possible and the supply chain simple to implement.
Example of steel transformation that involves multiple writing on the blockchain
In this example raw steel material
0xabc… is split in 2 parts
0xdef… &
0x012….
The parts
0x012… is transformed in 3mm steel bar
0x345….
The bar is transformed in steel chain
0x678….
Having the final Ntity certificate with the transaction number
0x678… we can reconstruct the full supply chain.
Looking at the example above, we can see that there is information linked by transaction numbers. The last transaction
0x345… is linked to a parent.
In the case of the datagram this results in adding the TX to the blockchain concerned
ETH:0x345…. We can obviously have parent's link who are on a third blockchain. Here is an example of notation.
Example with a parent transaction
Example with a parent transaction and data into IPFS