TrustedChain quick start
On this page we want to share how to start using our TrustedChain data platoform.
So to see your telemetry data in blockchains and our dashboards, you need to prepare data and send it to our platform.
Data reading and preparation
For example you have data from some sensor like temperature or humidity.
Convert value from sensor to integer 64-bit number. At the moment Staex TrustedChain platform accepts only integer 64-bit numbers as telemetry value or string values as base64.
Preparation for hashing and signing
After that you need to prepare data string (byte array) in following format:
<data_type>,<telemetry_value>,<unix_timestamp_ms>
Or if you have GPS coordinates:
<data_type>,<telemetry_value>,<unix_timestamp_ms>,<lon>,<lat>
where data_type is an unsigned integer 64-bit on your behalf (for ex. 1 - temperature, 2 - humidity), telemetry_value is actual value from previous step (sensor), lan and lon - integer 64-bit.
Hash and signing
Make hash from prepared data string with SHA256 hash function.
Sign prepared hash value with Ed25519 elliptic curve.
If you are already using Staex MCC, you can use it's private key to sign, do not create your own. Usually it is located at: /etc/mcc/node-private-key.txt.
If you are not using Staex MCC, you can create new private key by your own.
Prepare JSON to send
After that you can prepare JSON with following format:
{
"name": "<your_device_name>",
"gps": [0, 0],
"data": {
"type": 666,
"value": 123,
"created_at": <unix_timestamp_ms>
},
"public_key": "<ed25519_public_key_base64>",
"hash": "<hash_base64>",
"signature": "<ed25519_base64>",
"api_token": "<api_token>"
}
Send data
Send this JSON payload to our platform through MQTT protocol. Data source name: mqtt://<your_username>:<your_password>@80.158.51.185:31982, MQTT topic is telemetry_sync_t
.
Platform credentials
Right now to obtain MQTT credentials and API token you need to write to Staex team directly and we will send you credentials ASAP.