API Endpoints - Prescrypto/RexChain GitHub Wiki

Welcome to our API Documentation

Here you can find our Rexchain Api endpoints documentation, feel free to test any endpoint, all of them are public besides you could download our postman collection here

Transaction Details GET /api/v1/rx-endpoint/<hash_id>/

Besides of create a transaction, just save the hash_id and you could use it to look for details as follow:

REQUEST
# METHOD: GET
# URL: /api/v1/rx-endpoint/<hash_id>/
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, 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

List of Transactions GET /api/v1/rx-endpoint/

You can navigate through our transactions just with GET requests to our api, please following the next examples:

REQUEST

# METHOD: GET
# URL: /api/v1/rx-endpoint/

RESPONSE

The "count", "next", "previous" fields are for the paginator, the results are in the key "results" as follow:

{
    "count": 93681,
    "next": "https://www.rexchain.io/api/v1/rx-endpoint/?limit=15&offset=15",
    "previous": null,
    "results": [
        // Beging the list
        {
            "data": {
                "location": "N/A",
                "diagnosis": "32c4d05329d02...",
                "timestamp": "2019-09-30T14:12:35.935280+00:00",
                "medic_name": "3effefd5fd2f408a0481e24fe...",
                "medications": [
                    {
                        "instructions": "OJO IZQUIERDO\r\nAplicar 1 gota cada\r\n4 horas por 3 días. \r\n6 horas por 3 días. \r\n8 horas por 3 días. \r\n12 horas por 3 días.\r\ny suspender.",
                        "presentation": "Prednefrin SF (Prednisolona 1%, 5ml)"
                    },
                    {
                        "instructions": "Aplicar 1 gota cada 4 horas en ojo izquierdo por 5 días.",
                        "presentation": "Trazil Ofteno (Tobramicina 0.3%, 15ml)"
                    }
                ],
                "patient_age": "1aa9713e9c6...",
                "medic_cedula": "2610d603981eeb7...",
                "patient_name": "1b465d58cd7fa7d0...",
                "medic_hospital": "N/A"
            },
            "signature": "PX+gOnle7b8nml4yewDAJtOxcyCZ8MbvonEve+axVDd8h6MnkjJEvMv0Y0JY/mnxcxyXGgb2jlrXBNzc9ANx0Aflck8Pa/YIp26rfuawOeyr8xlHEU9JC25beWaIQySFTtdfwawUH0YkLFCb6bVSXIxScm7j0wPaGdtc975QW1E9eALYdcuJt5LfJu24xiT7tmL6eYWARxJdvqallQy+hLT28s33M+meOkQvn43kJENsZTno7FAluByvYpLr7oYiJ0gzrPa8XzaSGFUYxcjUF29vRysrqHREVu4OiBYgEeQdfkDDBj+W1hfKLHuJ3ihlD3wqfV6VeQ+snDXY3fBqAIMjiEN35GHdVKXmOnLUGWq+T1W1jNyIj2VBK6rwFs/MMFQitiLeY5VF2M4Hm3ReVPb8dRwEtGnnJzSEbQPIVpL5oOSBWUdU3RdEI+mE21iCHayQwuNXkU7MTkC1CAgChSoEE2P1O+3ndXR4KsgFub6dUekJDbXAIQHRc/Uf7maHLhaOM0uEPmzcu//OmpUinKg+q9CI8On33kiEbCvsJSHMOVCq/eKlJEXs1UluWAR0QdA=",
            "previous_hash": "0",
            "hash_id": "949a012cae798e0e1eb20cf8685e402d18b3110a3695a1f191944443be8e8cf5",
            "is_valid": true,
            "transaction": 93893,
            "readable": true,
            "public_key": "2d2d2d2d2d4245474..."
        },
        ...
}

List of blocks GET /api/v1/block/

You can navigate through our blocks just with GET requests to our api, please following the next examples:

REQUEST

# METHOD: GET
# URL: /api/v1/block/

RESPONSE

The "count", "next", "previous" fields are for the paginator, the results are in the key "results" as follow:

{
    "count": 363,
    "next": "https://www.rexchain.io/api/v1/block/?limit=15&offset=15",
    "previous": null,
    "results": [
        {
            "id": 491,
            "hash_block": "6d9bfc7a4f0f351c31a2d35162cb54ccfb4ac94bbcda9f7c8f5d220bc92e22a7",
            "previous_hash": "b75d882ca08f5cf8d8094b423d7004e9d8095f36afd306d6796aed17c5c01c7d",
            "raw_size": 159504,
            "data": {
                "hashes": [
                    "97c93e3a368d846b14ed490f1fbddfed320554430935d62a4ba49a7a5f66805f",
                    "43c789ac7956a2e8ddd9466d268fcb7f3dfe40413a4d9278ffccad1ce64e4890",
                    "bf0f9a0c2d796dd4280f4e9655301facd9e190c4fe0465c43d4098fd2dbedf64",
                    "5e5f470ef0e46f251cf997e415bb9c0e3cc3f1bba4548a09677a5b4c7c33e3de",
                    ...
                ]
            },
            "timestamp": "2019-09-25T01:09:41.691024Z",
            "merkleroot": "448f689409b120e7ba43a69fbed13bdee3a416aa083da36dd1dcf6a5cdcc72f7",
            "hashcash": "Prescrypto1.1*8*9.24.2019.16.54.51*RexChain*HxAXIAoa*122",
            "nonce": "290"
        },
        ...,

A brief explanation of the response fields

Param Type Description
id integer  The internal ID of the block
hash_block string  The hash of the block
previous_hash string  The hash of the previous block
data object  A object with list of transactions who entered in the block
timestamp string The creation block timestamp
merkleroot string  The hash of the merkleroot, in order to validate a Transaction belongs to a block
hashcash string  The string used to generate the valid hash in Proof of Work
nonce string  The integer validator among the hashcash string for Proof of Work

Look for transactions GET /api/v1/rx-endpoint/?public_key=<public_key>/

You can look for transactions made with a specific public key with the following data explained and finally look at the response

REQUEST

A brief explanation of the params:

Param Type Description
public_key Encode(string) A base64 public key but using encoding URI without headers nor footers nor line breaks

Next Update: Instead of public key we are working on bitcoin address filter in order to make this search easier!

# METHOD: GET
# URL: /api/v1/rx-endpoint/?public_key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1M3uHLbEEdh9UBYLyHir5JFp%2FRZcKNsRuN%2BKF0DB1Ee6V2zmixljKEIXddkCplLaz%2BwXNa6tSaZ%2BzwqGGI4Zwfi95pXBVg5srL8wsIG4n9pUkEhISLAHnLn6BgEQWWkIBGrb9k0L6WJGd0MKT86XgPXNPKYwPao%2FBSovmCY%2Fk2aF8%2FatMxpD0LM%2BQCvxdgj20jFmLocr5ccDDugMPA34BRJBwaneEyIGx4PMsSIskYlqYDybnNkNn1%2FERxe8pN7Ywy6WWeJFzBgpwf428kMQPiUteGSqMEuabyBpGYa%2B%2F2cgeE%2FEppyLSydKxHVxEp3vtHpkzj2FO0c7d6otlRrjJwIDAQAB

RESPONSE

Only return the transactions made by the owner of the public key, "count", "next", "previous" are made for the paginator use cases, the results are in the key "results" as follow:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "data": {
                "location": "N/A",
                "diagnosis": "27b592bdc35...",
                "timestamp": "2019-09-05T16:46:25.123921+00:00",
                "medications": [
                    {
                        "instructions": "aplicar ojo izquierdo \r\nc/6 hrs por 7 días \r\nc/8 hrs por 7 días \r\nc/12 hrs por 7 días y SUSPENDER",
                        "presentation": "Trazidex Ungena (Tobramicina y Dexametasona, 3.5g)"
                    }
                ]
            },
            "signature": "FVZVH1DxcUeI/Mzpbavqy6U72wtY32nRgIBDDAtutv3ZCpthqeSxZ8Dq/ojNbUth4lSiDN6Dmphlj9NAgkHjkM93OPvV1lT+tkfdTRR4LlPHf24mR6WazKTxow5hO4Usf0cjMf9GdlR7HUWwjMqp3eDQ4gtsvtravfTnL39brdQMfm0aqpOmk75AYLZ9xa6M1sVV+NWPJi2aMxrSSBSETbaKgS7md97PD2cD9nz29PWyC2VXiyZ2k9591SZa/LDp7LbQbtEdndZuGXCVPYeq4Q61V2kbrB26JJAbVElRHVCBhvIeXLtvBV6uOTJsXM9UpunH/5yYFfdZfKvV330EMlw6gihVjC2H2lfcZN0nLMMY4IjokE6rzxrNwDfHnp9WNqKgh3pgye/Xl/O4Sd4j31xBFO68p/93W06q4K/7oEuypxoJ5n+SyjcIuoZa0r19NccNvom5RP6sYrUxggcoK8HKjyxwDk6FGGJC3hAGYE6MMNpRRk2qIDeYIJEyL8fD",
            "previous_hash": "0",
            "hash_id": "4ad9cfd7a24197b5e3cd48dd64a1deaa9b784164b121ac1705644a0d5ab0da4d",
            "is_valid": true,
            "transaction": 2430,
            "readable": true,
            "public_key": "2d2d2d2d2d424547494e205055424c4..."
        }
    ]
}

A brief explanation of the params:

Param Type Description
data object  A json object, 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

Ask for a bitcoin address with a Public Key GET /api/v1/address/?public_key=<public_key>

You can ask for a bitcoin address, in order to share your account instead of the public key!

NOTE: We use this address in the QR in order to save heavy QR images.

REQUEST

A brief explanation of the params:

Param Type Description
public_key Encode(string) A base64 public key but using encoding URI without headers nor footers nor line breaks

Next Update: Instead of public key we are working on bitcoin address filter in order to make this search easier!

# METHOD: GET
# URL: /api/v1/address/?public_key=MIIBoTANBgkqhkiG9w0BAQEFAAOCAY4AMIIBiQKCAYBs5HruK3qVe3I2ZrSkYlwjcEZ9X7oTJkYu2SdTzVEifBUVfIrF8W7K01S9XZp0ywscjZg7a0mV9BQ5oyfGUt6XQa4QqNUHZdl%2BcXwhP21RlAn4HgZksJIuJfrYriu70RBcPPVHqNefX%2Bmx2NEofdToG40hW38WAIGPoTLKINagRPWA%2BV4Wpb0Veq3OojMI%2F%2FWP3KCh2TpeLHh0iKeh75UeRJPjIYNnCxy%2Fd0eqlEHKBagM5uTChAgui%2FWSQ1ScNVTvYKZTRZhz9f%2BvPiZT4ZpCAPZraqDqSe1IV0FvGi3d3OmrKAbNNtOarBw5H%2BRuNJgvsvaGaMr%2FOHUqMPoepK1TtAYCmk9YJYA4TS%2FLi6HB5mH8drtCvBCrlv8JbM7Id6n7%2FyAkRvprJSJiE4nuHQKoB1u%2FILJIApvoM6%2FU6JpGUzmPTvJ5CmUDuFsLmLxkly1TxKjlQJfHMb4tiVNCUvu2vsmurBMmCAJ7UhPNsS%2FTiV8mRdwnSMJs3uMUacXuAzsCAwEAAQ%3D%3D

#### RESPONSE

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "public_key_b64": "MIIBoTANBgkqhkiG9w0BAQEFAAOCAY4AMIIBiQKCAYBs5HruK3qVe3I2ZrSkYlwjcEZ9X7oTJkYu2SdTzVEifBUVfIrF8W7K01S9XZp0ywscjZg7a0mV9BQ5oyfGUt6XQa4QqNUHZdl+cXwhP21RlAn4HgZksJIuJfrYriu70RBcPPVHqNefX+mx2NEofdToG40hW38WAIGPoTLKINagRPWA+V4Wpb0Veq3OojMI//WP3KCh2TpeLHh0iKeh75UeRJPjIYNnCxy/d0eqlEHKBagM5uTChAgui/WSQ1ScNVTvYKZTRZhz9f+vPiZT4ZpCAPZraqDqSe1IV0FvGi3d3OmrKAbNNtOarBw5H+RuNJgvsvaGaMr/OHUqMPoepK1TtAYCmk9YJYA4TS/Li6HB5mH8drtCvBCrlv8JbM7Id6n7/yAkRvprJSJiE4nuHQKoB1u/ILJIApvoM6/U6JpGUzmPTvJ5CmUDuFsLmLxkly1TxKjlQJfHMb4tiVNCUvu2vsmurBMmCAJ7UhPNsS/TiV8mRdwnSMJs3uMUacXuAzsCAwEAAQ==",
            "address": "1RhQvyEVccUvcv9nxEiXGQ1bPuho2wG8w",
            "is_valid": true,
            "pub_key": "-----BEGIN PUBLIC KEY-----\nMIIBoTANBgkqhkiG9w0BAQEFAAOCAY4AMIIBiQKCAYBs5HruK3qVe3I2ZrSkYlwj\ncEZ9X7oTJkYu2SdTzVEifBUVfIrF8W7K01S9XZp0ywscjZg7a0mV9BQ5oyfGUt6X\nQa4QqNUHZdl+cXwhP21RlAn4HgZksJIuJfrYriu70RBcPPVHqNefX+mx2NEofdTo\nG40hW38WAIGPoTLKINagRPWA+V4Wpb0Veq3OojMI//WP3KCh2TpeLHh0iKeh75Ue\nRJPjIYNnCxy/d0eqlEHKBagM5uTChAgui/WSQ1ScNVTvYKZTRZhz9f+vPiZT4ZpC\nAPZraqDqSe1IV0FvGi3d3OmrKAbNNtOarBw5H+RuNJgvsvaGaMr/OHUqMPoepK1T\ntAYCmk9YJYA4TS/Li6HB5mH8drtCvBCrlv8JbM7Id6n7/yAkRvprJSJiE4nuHQKo\nB1u/ILJIApvoM6/U6JpGUzmPTvJ5CmUDuFsLmLxkly1TxKjlQJfHMb4tiVNCUvu2\nvsmurBMmCAJ7UhPNsS/TiV8mRdwnSMJs3uMUacXuAzsCAwEAAQ==\n-----END PUBLIC KEY-----"
        }
    ]
}

A brief explanation of the params:

Param Type Description
address string  The address for the public key requested
is_valid boolean  If the pub key is valid or not
pub_key boolean  The public key but in format PEM
public_key_b64 string  The one line public key in base64
⚠️ **GitHub.com Fallback** ⚠️