Data
All commands for Data section are listed below and detailed on their own sections.
This endpoint forms the basis for the customized usage of the PIRI network. Thanks to this feature in the PIRI network, which enables data to be included in transactions and moved, user data can be transferred from any source, address, or recipient (recipient address).
Pirichain offers a dynamic method to facilitate the addition of data to the blockchain. Data can be added as a Key & Value pair with different security levels, denoted by "enc," which represents the encryption level. There are three different encryption types for "enc." 0: Non-Encrypted, where the Key & Value pair is stored openly in the blockchain. 1: Value Encrypted, where the Key value is stored openly, but the Value is encrypted. 2: Key & Value Encrypted, where both values are added to the blockchain in an encrypted form.
When data is stored encrypted in the PIRI network, two different approaches can be applied. The parameter that enables this is "to". In other words, customData can be made shareable with another PIRI address, beyond belonging to the PIRI address that added it to the system. This is made possible through a "shared key" in the PIRI network.
Once customData is added to the blockchain, it becomes immutable and cannot be altered or deleted, similar to a transaction. This ensures the immutability of the given data.
Thanks to this feature, applications for data-driven web3.0 concepts can be developed without the need for external applications, and the use of this feature with Pirichain Smart Scenarios can also be facilitated.
PIRI Address
Private Key
Recipient PIRI Address
Custom data [{"key":"key","value":"value","enc":<0: non-encrypted, 1: value-encrypted, 2: key&value-encrypted>}, ...]
Recipient Public Key
OK
POST /pushData HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 89
"address='text'&privateKey='text'&to='text'&customData='text'&indPubKey='text'"
OK
{
"error": 0,
"tx": "2053d0aad075f3af0574d3883cecff298c72a2d6b1cbcdb60baaeb0cd70cb0f9",
"sign": "3046022100b87759aeb25195a49e9fef79faba7210b77b622dbb6bed04562c63d333989cea022100d62d1521f2b8b5458839aed44136f2c86e1383388394183debc7d95a61e5c9fa",
"timeStamp": 1651837236483
}
This endpoint is created for a customData added to the PIRI network, with the intention of enabling decryption by either the data provider or the recipient. The data added with the "pushData1 endpoint" comes with different encryption levels, two of which do not require additional decryption: 1: Value Encrypted, 2: Key & Value Encrypted.
In such a scenario, the address that added the data to the blockchain or the address that became the recipient at the time of data addition through the "to" parameter can decrypt this encrypted data or data using this endpoint.
Custom Data Id
Private Key
Recipient Public Key
OK
POST /decrypt HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 59
"customID='text'&privateKey='text'&receiptPub='text'"
OK
{
"error": 0,
"key": "key of encrypted data",
"value": "value of encrypted data"
}
This endpoint lists the data present in the PIRI network based on the skip and limit parameters.
Record count for per page
Page count for skip according to limit value.
OK
POST /listData HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 20
"limit=1&skip=1"
OK
{
"data": [
{
"_id": "632b8a7d96d5ee532e945af0",
"txID": "c22af19b8eb45c4a67fdedf5cffa19e0b70e0ec33a766e8e4f4b315054dfb95a",
"key": "0257ca14e439ad0f000dac6f20e03505",
"value": "fb07e227f45ae43e3ad10305c6d9b68617dff238773a2364aa0a8ca42d058138",
"timeStamp": 1663797885040,
"from": "PRTMQ2aLJgU3kQSaXrCdVQ7XRvsmp3MH9n56fv9q62Q",
"enc": 2,
"__v": 0,
"blockHeight": 711557
}
],
"count": 7162831
}
This endpoint lists the data associated with the PIRI address specified in the "address" parameter on the PIRI network, depending on the skip and limit parameters.
PIRI Address
Record count for per page
Page count for skip according to limit value.
OK
POST /listDataByAddress HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 37
"address='text'&limit=1&skip=1"
OK
{
"data": [
{
"_id": "632b8169eed024f009a988c2",
"txID": "2cfa3df4fbabe0bb38c7721faf1e05b0ac468deea95fcb513192f2b02a87efec",
"key": "a30984384f3916940bfc5e2ab40212b4",
"value": "d3d9ab4eb0c223d49e9faf10cda3cb3d",
"timeStamp": 1663795561663,
"from": "PRTMQ2aLJgU3kQSaXrCdVQ7XRvsmp3MH9n56fv9q62Q",
"enc": 2,
"__v": 0,
"blockHeight": 711325
}
],
"count": 10209
}
List data entries between specific addresses
From address
To address
Number of results to return
Number of results to skip
OK
POST /listDataByAddresses HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 46
"from='text'&to='text'&limit=1&skip=1"
OK
{
"error": 0,
"data": [
{
"_id": "632b8169eed024f009a988c2",
"txID": "2cfa3df4fbabe0bb38c7721faf1e05b0ac468deea95fcb513192f2b02a87efec",
"key": "a30984384f3916940bfc5e2ab40212b4",
"value": "d3d9ab4eb0c223d49e9faf10cda3cb3d",
"timeStamp": 1663795561663,
"from": "PRTMQ2aLJgU3kQSaXrCdVQ7XRvsmp3MH9n56fv9q62Q",
"to": "PRTMPaWeNEuR5p7edg7hRMkNogkLPUhqmwkpb2hCJb8",
"enc": 2,
"__v": 0,
"blockHeight": 711325
}
]
}
Push data to blockchain using raw transaction format
Sender address
Public key
Transaction signature
Transaction timestamp
Recipient address
Custom data array in JSON format
Individual public key
OK
POST /pushDataRawTransaction HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 123
"address='text'&pubKey='text'&signature='text'&timeStamp='text'&to='text'&customData='text'&indPubKey='text'"
OK
{
"error": 0,
"txHash": "2053d0aad075f3af0574d3883cecff298c72a2d6b1cbcdb60baaeb0cd70cb0f9"
}
Was this helpful?