Skip to content

API Endpoints

Jesús Alvarado Garzón edited this page Sep 25, 2019 · 16 revisions

Create a Transaction

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 publick 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 publick key

Search blocks

You can navigate throught 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

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: POST
# 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, 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 publick key

Ask for a Wallet Address

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

Payload

# METHOD: POST, URL: 
# Payload

Response

# This is the response

Clone this wiki locally