Create Transaction or Transfer - Prescrypto/RexChain GitHub Wiki
Create a Transaction POST /api/v1/rx-endpoint/
You can create transactions with the following data explained and finally look at the response
A brief explanation of the request fields
Param | Type | Description |
---|---|---|
data | object | A json object, we return the same data that the request. In order to decrypt the encrypted fields you need to use the private key! |
signature | string | A signature who is verified with public key |
public_key | string | A hexadecimal string representation of the public key |
REQUEST
# METHOD: POST
# URL: /api/v1/rx-endpoint/
# Payload :
{
"data": {
// A key with encrypted value
"somekey": "2c43388432c93....",
// A key with raw value
"location": "N/A",
// Optional to add your own timestamp
"timestamp": "2019-06-24T17:37:50.132243+00:00"
},
"public_key": "2d2d2d2d2d424547494e205055424c49432....",
"signature": "SuJN1mxg4ZEXmZev5cdizavkdHowf25vngtKtBjNwio7/JX12E1aT4+aWI8xnd5A0xa+1XKvxLKdik4zugE7ps5X67WRRs50QxUCsijIH4v7TfY/GwiaqpgBMOIkVs6S77AfF27QIDfpC2B2u3SnIzJofJ9iHbG3uRXKbG0VxDISurydjk5gSLI6JrNylnPp7e+KO46fck/rEJDC6uZmSTXNB8GI3PR48b+vh5U4gDx8OkPBbPJ7EyIiM58y+FZBTmS3ef3ly+9wJcxLzpl7ClbQr7L53sRkHlXoHCOLmZ2SuaH9OofJ1uy8yjtw+CqjANeKafhYHQhhn64TlEvhLIoVCBONq4OuZpFGuxF0gqMeuZX+yp8XEEzU/VEPLXvjFzOv57xq4ZEJt6qCqm/QWb6+BZAf1MbWr02iiNZDf4zaCAJJOCFfTCmZMZOhiPXlQpYIxfIlAVhK0XOTQcHFvMHbOTRtyDJLvvWqyEsJVVKLiWRa5L2IeoGNy9JYzHTlg29CK1jabUU="
}
RESPONSE
{
"data": {
// A key with encrypted value
"somekey": "2c43388432c93....",
// A key with raw value
"location": "N/A",
// Optional to add your own timestamp
"timestamp": "2019-06-24T17:37:50.132243+00:00"
},
"signature": "SuJN1mxg4ZEXmZev5cdizavkdHowf25vngtKtBjNwio7/JX12E1aT4+aWI8xnd5A0xa+1XKvxLKdik4zugE7ps5X67WRRs50QxUCsijIH4v7TfY/GwiaqpgBMOIkVs6S77AfF27QIDfpC2B2u3SnIzJofJ9iHbG3uRXKbG0VxDISurydjk5gSLI6JrNylnPp7e+KO46fck/rEJDC6uZmSTXNB8GI3PR48b+vh5U4gDx8OkPBbPJ7EyIiM58y+FZBTmS3ef3ly+9wJcxLzpl7ClbQr7L53sRkHlXoHCOLmZ2SuaH9OofJ1uy8yjtw+CqjANeKafhYHQhhn64TlEvhLIoVCBONq4OuZpFGuxF0gqMeuZX+yp8XEEzU/VEPLXvjFzOv57xq4ZEJt6qCqm/QWb6+BZAf1MbWr02iiNZDf4zaCAJJOCFfTCmZMZOhiPXlQpYIxfIlAVhK0XOTQcHFvMHbOTRtyDJLvvWqyEsJVVKLiWRa5L2IeoGNy9JYzHTlg29CK1jabUU=",
"previous_hash": "0",
"hash_id": "6b300b2b3c126ede90a214206d42da1d1ae69790c76496bb530e60ea0890015b",
"is_valid": true,
"transaction": 2472,
"readable": true,
"public_key": "2d2d2d2d2d424547494e205055424c49432....",
}
A brief explanation of the response fields
Param | type | description |
---|---|---|
data | object | A json object, we return the same data that the request. In order to decrypt the encrypted fields you need to use the private key! |
signature | string | The signature in base64 format of the data with the private key made by the client |
previous_hash | string | If the transaction has a previous transfer transaction |
hash_id | string | The hash ID of the transaction |
is_valid | boolean | If the signature is valid, we check this with the public key and data dictionary |
transaction | int | An internal ID for transaction |
readable | boolean | Refer to the bitcoin spent value, if the owner of the transaction has the rights, otherwise was transfer |
public_key | string | A hexadecimal string representation of the public key |
Create a Transfer Transaction POST /api/v1/rx-endpoint/
In order to transfer a transaction data to other owner, you have to ask for the public key of the new owner, then sign the new data(decrypt[with your key] and encrypt[with the new key] if necessary), the payload is the same as new transaction with the difference that the additional field "previous_hash" which make reference to the current "hash_id" of the transaction
A brief explanation of the request fields
Param | Type | Description |
---|---|---|
data | object | A json object, we return the same data that the request. In order to decrypt the encrypted fields you need to use the private key! |
signature | string | A signature who is verified with public key |
public_key | string | A hexadecimal string representation of the public key or base64 public key |
previous_hash | string | The hash id of the current transaction to be tranfered |
REQUEST
# METHOD: POST
# URL: /api/v1/rx-endpoint/
# Payload :
{
"data": {
// A key with encrypted value
"somekey": "2c43388432c93....",
// A key with raw value
"location": "N/A",
// Optional to add your own timestamp
"timestamp": "2019-06-24T17:37:50.132243+00:00"
},
"public_key": "2d2d2d2d2d424547494e205055424c49432....",
// This field previous hash is the diffence between normal transaction and a transfer!
"previous_hash": "6b300b2b3c126ede90a214206d42da1d1ae69790c76496bb530e60ea0890015b",
"signature": "SuJN1mxg4ZEXmZev5cdizavkdHowf25vngtKtBjNwio7/JX12E1aT4+aWI8xnd5A0xa+1XKvxLKdik4zugE7ps5X67WRRs50QxUCsijIH4v7TfY/GwiaqpgBMOIkVs6S77AfF27QIDfpC2B2u3SnIzJofJ9iHbG3uRXKbG0VxDISurydjk5gSLI6JrNylnPp7e+KO46fck/rEJDC6uZmSTXNB8GI3PR48b+vh5U4gDx8OkPBbPJ7EyIiM58y+FZBTmS3ef3ly+9wJcxLzpl7ClbQr7L53sRkHlXoHCOLmZ2SuaH9OofJ1uy8yjtw+CqjANeKafhYHQhhn64TlEvhLIoVCBONq4OuZpFGuxF0gqMeuZX+yp8XEEzU/VEPLXvjFzOv57xq4ZEJt6qCqm/QWb6+BZAf1MbWr02iiNZDf4zaCAJJOCFfTCmZMZOhiPXlQpYIxfIlAVhK0XOTQcHFvMHbOTRtyDJLvvWqyEsJVVKLiWRa5L2IeoGNy9JYzHTlg29CK1jabUU="
}
RESPONSE
# Is the same as create Transaction