Knowledge Base
OP codes and messages
Every ObjectID include a TEXT field called OP_code.
The content of this field can be set by the Producer or by the Owner of the ObjectID and can be used tto trigger specific application features.
Code must be made of 4 numeric digits and can be set in sequenze separated by a comma (in example “0001, 0010”)
Codes from 0000 to 0999 are reseved for ObjectID applications.
This is the currently used codes:
Code | Meaning – effect |
0000 | Indicate that the product represented by the ObjectID has been stolen. It instructs the smart contract to accept calls to the message function and send one of the predefined messages, plus the geolocation code provided by the user, to the product owner (onwer_did). |
0001 | Indicate that the product represented by the ObjectID has been lost. It instructs the smart contract to accept calls to the message function and send one of the predefined messages, plus the geolocation code provided by the user, to the product owner (onwer_did) |
0002 | This code allows an identified user to send predefined messages to the agent. It instructs the smart contract to accept calls to the message function only when the destination DID matches the agent_did field of the ObjectID. |
0003 | This code allows an identified user to send predefined messages to the onwer. It instructs the smart contract to accept calls to the message function only when the destination DID matches the owner_did field of the ObjectID. |
0010 | In normal operation Agent can set a new ObjectID onwer. This code indicate to the smartcontract to accept calls for update_owner function only coming from a DID matching the ObjectID owner_did field. |
0020 | In normal operation any identity with sufficient credit can call the smart contract function add_event to add an event to an ObjectID . This code indicate to the smartcontract to accept calls for add_event function only coming from a DID matching the ObjectID owner_did field. |
0021 | In normal operation any identity with sufficient credit can call the smart contract function add_event to add an event to an ObjectID . This code indicate to the smartcontract to accept calls for add_event function only coming from a DID matching the ObjectID owner_did field or agent_did field. |
0030 | In normal operation Owner and Agent can update the product geolocation. This code indicate to the smartcontract to accept calls for update_geolocation function only coming from a DID matching the ObjectID owner_did field. |
Messages
ObjectID allows subjects identified by a DID, who have scanned a QR code representing an object, to send messages. These messages can be generated either through the ObjectID dApp or by third-party applications.
A message is an object created by the ObjectID smart contract under specific conditions. It may contain the following fields:
Field name | Meaning |
from_did | Represents the identity of the subject invoking the message function of the smart contract. This field is automatically determined by the smart contract using the provided Identity Capability Token. |
dest_did | Represents the identity of the subject designated to receive the alert indicating the presence of a message to read. It can only be the owner, the agent, or the object_did associated with the specified object. |
object | Represents the unique identifier of the object to which the message refers. |
message_code | Represents the identifier of a predefined message. This code enables applications to send messages over the blockchain without exposing sensitive data, ensuring compliance with GDPR. See the table below for reference. |
message | Represents the body of the message. It can typically be filled only when the from_did matches the creator_did, meaning the message source must be clearly identifiable for this field to be used. |
geolocation | Represents a geolocation reference, used to provide contextual information related to the message. |
link | May contain a URL linking to additional resources. |
Message codes
Messages are objects created by the smartcontract that remain in the blockchain for a limited period of time. The message code is a u16 number. Values from 0 to 40 are reserved for ObjectID applications. The following are the predefined messages generated by the ObjectID dApp based on these codes:
Code | Message sent and rules |
0 | When this code is used to call the message function of the smart contract, the dApp displays the message: ‘Someone found your object ID‘ to the object’s owner. This message is generated by the smart contract only if the object’s op_code is set to 0000 (object_stolen). Geolocation data assists the owner in locating and retrieving the object.Note: the ObjectID dApp silently call the smart contract alert function keeping anonymous the identity of the user. |
1 | When this code is used to call the message function of the smart contract, the dApp displays the message: ‘Hello, I’ve found your object ID‘ to the object’s owner. This message is generated by the smart contract only if the object’s op_code is set to 0001 (object_lost). Geolocation data assists the owner in locating and retrieving the object. |
2 | When this code is used to invoke the message function of the smart contract, the dApp displays the message: ‘Hello, I’ve found your object ID. I’m reporting and delivering it to the police.’ to the object’s owner. This message is generated by the smart contract only if the object’s op_code is set to 0001 (object_lost). Geolocation data assists the owner in locating and retrieving the object. |
3 | When this code is used to call the message function of the smart contract, the dApp displays the message: ‘Hello, I’ve found your object with ID … I’m keeping it safe until you collect it.’ to the object’s owner. This message is generated by the smart contract only if the object’s op_code is set to 0001 (object_lost). Geolocation data helps the owner locate and retrieve the object. |
11 | When this code is used to invoke the message function of the smart contract, the dApp displays the message: ‘I need support for the Object ID‘ to the object’s owner or agent, depending on the op_code . This message is generated by the smart contract only if the object’s op_code is set to 0002 (message_to_agent) or 0003 (message_to_owner). Geolocation data assists the owner/agent in locating the object. |
12 | When this code is used to invoke the message function of the smart contract, the dApp displays the message: ‘I want to report an improper use of object ID‘ to the object’s owner or agent, depending on the op_code . This message is generated by the smart contract only if the object’s op_code is set to 0002 (message_to_agent) or 0003 (message_to_owner). Geolocation data assists the owner/agent in locating the object. |
13 | When this code is used to invoke the message function of the smart contract, the dApp displays the message: ‘This object requires maintenance: ID‘ to the object’s owner or agent, depending on the op_code . This message is generated by the smart contract only if the object’s op_code is set to 0002 (message_to_agent) or 0003 (message_to_owner). Geolocation data assists the owner/agent in locating the object. |
14 | When this code is used to invoke the message function of the smart contract, the dApp displays the message: ‘This object has been damaged …’ to the object’s owner or agent, depending on the op_code . This message is generated by the smart contract only if the object’s op_code is set to 0002 (message_to_agent) or 0003 (message_to_owner). Geolocation data assists the owner/agent in locating the object. |
15 | Code reserved. |