DiQi

Introduction

DiQi is a blockchain platform, and based on the blockchain we provide a simple and powerful REST API. We call it DiQi API. With the API, developers/enterprises can focus on developing their applications/businesses without knowing or maintaining the DiQi blockchain protocol.

Developers/enterprises can create their own accounts, addresses, and tokens that can represent any asset classes. In addition, authorized tokens allow users to send payments. The multi-signature addresses and payments enable diverse smart contracts on blockchain. The blockchain data is completely open data that users can access to perform analysis or mine insights. With these API’s, users can build their applications, services or business on blockchain conveniently and reliably.

The API Based URL: https://asset.diqi.us

Copyright © 2015 DiQi Inc. All rights reserved

Authentication

DiQi use authorization header to authenticate & authorize your requests. You should provide available header to access our API endpoints. We offer two kinds of authentication.

Oauth2

Sample Request

curl -X GET \
     -H "Authorization: Bearer <token>"\
     https://asset.diqi.us/api/v1/users/profile/

OAuth2 is recommended when you’re creating an application for others on top of DiQi platform. This authentication provides a secure and easy to use authentication flow for users.

OAuth2 requests must be authenticated with a valid access token passed as bearer token. To use the bearer token, construct a normal HTTPS request and include an Authorization header with the value of Bearer. Signing is not required.

To use oauth2 authorization, you have to create an oauth application in your setting first. Then the following two endpoints you may need to configure before implementation.

  • Authorize endpoint: https://asset.diqi.us/oauth2/authorize/
  • Access token endpoint: https://asset.diqi.us/oauth2/token/

To integrate your third-party web server application with DiQi, use the following flow:

Redirect users to request DiQi access

GET https://asset.diqi.us/oauth2/authorize/?client_id=YOUR_CLIENT_ID&scope=user:profile:read&state=SECURE_RANDOM&redirect_uri=YOUR_CALLBACK_URL&response_type=code

Notice that fleld scope should be one of Scope and should be split by , if more than one scope are required. And the parameters description are below.

  • client_id: Your application’s client id.
  • scope: Permission your application requests access to.
  • state: An unguessable random string.
  • redirect_uri: Your application’s redirect URL.
  • response_type: code

DiQi redirects back to your site

GET https://example.com/oauth/callback?code=SOME_CODE&state=SOME_STATE

If the user approves your application, DiQi will redirect them back to your redirect_uri with a temporary code parameter. If you specified a state parameter in previous step, it will be returned as well. The parameter will always match the value specified previous step. If the values do not match, the request should not be trusted.

Exchange code for an access token

After you have received the temporary code, you can exchange it for valid access and refresh tokens. This can be done by making a POST call.

POST https://asset.diqi.us/oauth2/token/

With the following parameters:

  • grant_type: authorization_code
  • code: Value from previous step
  • client_id: Your application’s client id.
  • client_secret: Your application’s client secret.
  • redirect_uri: Your application’s redirect URL.

Make an API call

Finally, you can make a DiQi API call with a valid access token now.

Authorization Errors

When access the API you should provide the token in the HTTP Authorization header. There are some possible authorization errors

  • token is not provided
  • token is invalid
  • token is expired

API Key

Sample Requests

curl -X GET \
     -H "DIQI-ACCESS-KEY: Bqe6DSkyUmOhl5ML"\
     -H "DIQI-ACCESS-TIMESTAMP: 1459936762"\
     -H "DIQI-ACCESS-SIGNATURE: f6d7dfc5addbbd62ded4909ed43d6ea49f6a1a6a56a8c5a0257a2be180badc36"\
     https://asset.diqi.us/api/v1/users/profile/

An API key can be used to access your own account. All requests using API key should be signed and include the following headers

  • DIQI-ACCESS-KEY: The api key as a string)
  • DIQI-ACCESS-SIGNATURE: The user generated message signature (see below)
  • DIQI-ACCESS-TIMESTAMP: A timestamp in UTC for your request

The DIQI-ACCESS-SIGN header is generated by creating a HMAC with hash function sha256 and your API secret key. The message should be the concatenation of the following strings

  • Request method (In upper case, e.g.: “GET”)
  • Request path (e.g.: “/api/v1/user/profile/”)
  • Request body
  • Timestamp (seconds since Unix Epoch)

The DIQI-ACCESS-TIMESTAMP should be the same as the timestamp in UTC used in DIQI-ACCESS-SIGNATURE header.

Python example code

import requests
import time
import hmac
import hashlib

DIQI_API_KEY = "4vwTatzYQan7z5ww"
DIQI_API_SECRET = "bc8oSFHdpjt3OnsXhSTjJLeSAOdm3EKw"

class DiQiAPIKeyAuth(requests.auth.AuthBase):

    def __init__(self, api_key, api_secret):
        self.api_key = api_key
        self.api_secret = api_secret

    def __call__(self, request):
        timestamp = str(int(time.time()))
        message = request.method + request.path_url + (request.body or '') + timestamp
        secret = self.api_secret

        if not isinstance(message, bytes):
          message = message.encode()
        if not isinstance(secret, bytes):
          secret = secret.encode()

        signature = hmac.new(secret, message, hashlib.sha256).hexdigest()
        request.headers.update({
            "DIQI-ACCESS-KEY": self.api_key,
            "DIQI-ACCESS-SIGNATURE": signature,
            "DIQI-ACCESS-TIMESTAMP": timestamp,
        })
        return request

diqi_auth = DiQiAPIKeyAuth(DIQI_API_KEY, DIQI_API_SECRET)
retrieve_profile_url = "https://asset.diqi.us/api/v1/users/profile/"
payments_url = "https://asset.diqi.us/api/v1/payments/"


# Retrieve user's profile (GET request)
response = requests.get(retrieve_profile_url, auth=diqi_auth)
print response.json()
# {u'user_type': u'normal', u'user_id': u'd025fb15d82848cda831f94e08c7f891', u'email': u'diqius@gmail.com', u'name': u'', u'mobile_number': None}

# Payments (POST request)
payments_body = {
    "from_address": "1GZqrQLYkjzDNpCiQEXq5wRVTJSX2Et53u",
    "to_address": "1MHA9eCbGPgEbUyCyYyaJn7uY1ZTM5btqz",
    "fee_address": "1HqNgRUa62q3KX6ybbTisnGQVp6Yupemrw",
    "color_id": 1,
    "amount": 100,
}
response = requests.post(payments_url, data=payments_body, auth=diqi_auth)
print response.json()
# {u'tx_hash': u'5c6e93735b33f2551d27e6980cd9662a09c5be0159fbf65929eac33c2da1cebb', u'message': u'success'}

Scope

Address related:

  • address:create
  • address:read
  • address:update
  • address:delete
  • address:payment:create
  • address:payment:read

User related:

  • user:password:update
  • user:pin:update
  • user:profile:read
  • user:profile:update

Transaction related:

  • transaction:read

Multisig related:

  • multisig:create
  • multisig:read
  • multisig:update
  • multisig:delete
  • multisig:payment:create
  • multisig:payment:read

Test Environment

On the test environment, your license do not needs to be checked by DiQi. It will produced automatically.

End point of test environment: https://asset.diqi.us

Errors

Error code

Parameter Error (status code: 400)

{
  "errors": [
    {
      "field": "<argument>",
      "message": "<error_message>",
      "code": 40001
    },
    {
      "field": "<argument>",
      "message": "<error_message>",
      "code": 40001
    }
  ]
}

Unauthorized (status code: 401)

{
  "errors": [
    {
      "message": "Unauthorized",
      "code": 1301
    }
  ]
}

Internal Server Error (status code: 500)

{
  "errors": [
    {
      "message": "Internal server error",
      "code": 500
    }
  ]
}
Code HTTP Status Code Description
1000 404 invalid
1100 400 The address is invalid
1101 403 the address doesn’t belong to the user
1102 400 the address/address hash doesn’t exist
1103 400 Insufficient amount of the assets for your payment
1104 400 The asset’s amount after you issue will exceed the max asset’s amount
1105 406 Other DiQi related errors
1106 400 duplicated_address
1107 404 The asset’s license doesn’t exist
1111 404 Insufficient transaction fees
1200 500 Connection error of API server
1201 500 Other gcoin rpc connection related errors
1300 403 The user’s permission is disabled
1301 401 Invalid authorization
1302 401 Token is expired
1400 404 block_not_found
1500 400 The user’s address amount is exceeded
1505 403 Invalid pin code for payment
1507 400 The address’s name is duplicated
1508 400 The user is already registered
1509 400 The user is not yet registered
1600 403 rate_limit_exceed
1802 404 The user doesn’t exist
1902 404 contact_id_not_found
2000 403 exceed_max_sms_semd_quota
2001 403 retry_qunduota_run_out
40001 400 Input error in the form
40100 400 the user already registered
40101 401 the verification code is not correct
40102 401 the verification code is no longer effective
40103 404 certification_not_found
40104 404 this url is invalid for resetting password
40105 404 this url is invalid for resetting pin
500 500 Internal server error
6001 404 page_not_found
7001 400 already_have_license
7002 400 license_applying
8001 403 already_recieved_bonus
9001 404 lock_not_found
9002 403 the owner of the lock is not the user
9003 400 invalid_lock

Users

Generic DiQi user information

Retrieve user’s profile

Sample Requests

curl -X GET \
     -H “Authorization: Bearer d5516db3696c6794aeea7a81b7fdf9cabf71e7b2”\
     https://asset.diqi.us/api/v1/users/profile/

Sample Response

{
  "user_id": "5d0bb754efc6414ba8e016bbfdd31535",
  "name": "",
  "user_type": "normal",
  "mobile_number": "+886-972878721",
  "email": null
}

Get user’s profile with Oauth2 token or API Key

HTTP Request

GET /api/v1/users/profile/

Retrieve user’s addresses

Sample Request

curl -X GET \
     -H "Authorization: Bearer d5516db3696c6794aeea7a81b7fdf9cabf71e7b2"\
     https://asset.diqi.us/api/v1/users/5d0bb754efc6414ba8e016bbfdd31535/addresses/

Sample Response

{
  "addresses": [
    {
      "address": "1QBfF87BZXWbSgyrvChoBfbjnU9RB87cec",
      "name": "My default account",
      "default": true
    },
    {
      "address": "1FLpmMqmb3M7nHzwvLrwSJGMtFhrSkPrvM",
      "name": "My backup account",
      "default": false
    }
  ]
}

Show all addresses belonging to the user

HTTP Request

GET /api/v1/users/<user_id>/addresses/

Create addresses

Sample Reqeust

curl -X POST \
     -H "Authorization: Bearer f26c4e465967e5b0e41ec879ba236c08e0ab2a2c" \
     -d "number=2" \
     https://asset.diqi.us/api/v1/users/5865494f8090478885fb9fc528cf8717/addresses/

Sample Response

{
  "addresses": [
    {
      "default": false,
      "name": "#2",
      "address": "1GDoR9GTwkMcdpwoeAqpMwK9GaFZBP7uzh"
    },
    {
      "default": false,
      "name": "#3",
      "address": "15ncgT9dJNuZvdo66fpgduqLukULGAtKfc"
    }
  ]
}

HTTP Request

POST /api/v1/users/<user_id>/addresses/

Provide user_id and Token to add addresses belonging to the user

Arguments

Field Type Required Description
number int required The amount of addresses you want to add (normal user can only own 5 addresses)

Retrieve user’s balance

Sample Request

curl -X GET \
     -H "Authorization: Bearer f26c4e465967e5b0e41ec879ba236c08e0ab2a2c" \
     https://asset.diqi.us/api/v1/users/5865494f8090478885fb9fc528cf8717/balance/

Sample Response

{
  "balance": {
    "1GmHE64M2FzXTUJUVbwQGavCkhLUTKGijq": {},
    "13ic124WEGZnM7W7ZEV4a5BLd5z4drs5Ty": {},
    "1E6Xd595ooNKCHb51uCynuCSXTztUntTEK": {
      "1": {
        "0": "17.72200000",
        "1": "17.72200000",
        "locked": "0.00000000"
      }
    },
    "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5": {
      "1": {
        "0": "961.17800000",
        "1": "961.17800000",
        "locked": "0.00000000"
      },
      "283099712": {
        "0": "11012.00000000",
        "1": "11012.00000000",
        "locked": "0.00000000"
      },
      "384059325": {
        "0": "1012900.00000000",
        "1": "1012900.00000000",
        "locked": "0.00000000"
      }
    }
  }
}

Return assets and corresponding balance of all addresses belonging to the user

HTTP Request

GET /api/v1/users/<user_id>/balance/

Retrieve user’s transactions

Sample Reqeust

curl -X GET \
     -H "Authorization: Bearer f26c4e465967e5b0e41ec879ba236c08e0ab2a2c" \
     https://asset.diqi.us/api/v1/users/5865494f8090478885fb9fc528cf8717/transactions/

Sample Response

{
  "total": 325,
  "transactions": [
    ...
    {
      "tx_hash": "018412eab116ffea5bef0582b11281a414e0fe04b9f11c81de24c59cfcf63565",
      "amount": "1.00000000",
      "confirmations": 12,
      "unix_timestamp": "1460115555",
      "from_address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
      "to_address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
      "vins": [
        {
          "color": 1,
          "tx_hash": "a2ba0e3787411f6b2d4524e9cdae5bb804b5e17983f64bf09c9a8d9b8c05ff00",
          "n": 0,
          "address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
          "amount": "1.00000000"
        },
        {
          "color": 1,
          "tx_hash": "468c9e7d849c695e36e3ed8eeaeb97c7880dcb13339d4a1819f3902604bb191f",
          "n": 0,
          "address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
          "amount": "1.00000000"
        }
      ],
      "vouts": [
        {
          "amount": "1.00000000",
          "color": 1,
          "n": 0,
          "address": [
            "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5"
          ]
        }
      ],
      "outputs_value": "1.00000000",
      "inputs_value": "2.00000000",
      "fee": "1.00000000",
      "is_coinbase": false,
      "tx_type": "NORMAL",
      "time": "2016-04-08T11:39:15"
    }
  ]
}

HTTP Request

GET /api/v1/users/<user_id>/transactions/

Show all related transactions for the user

Arguments

Field Type Required Description
limit int optional the limit of transactions number (default=50)
offset int optional the offset of the return list (default=0)
since int optional the transaction that created after the unix time (default=0)
until int optional the transaction that created before the unix time (default=now)

Addresses

Get the specific address’s balance and transactions

Retrieve address’s balance

Sample Request

curl -X GET
     -H  "Authorization: Bearer d5516db3696c6794aeea7a81b7fdf9cabf71e7b2" \
     https://asset.diqi.us/api/v1/addresses/1Cx97jmzuYbMxXPZTbvMVeiLXQHFEYSgTe/balance/

Sample Response

{
  "balance": {
    "1": {
      "0": "961.17800000",
      "1": "961.17800000",
      "locked": "0.00000000"
    },
    "283099712": {
      "0": "11012.00000000",
      "1": "11012.00000000",
      "locked": "0.00000000"
    },
    "384059325": {
      "0": "1012900.00000000",
      "1": "1012900.00000000",
      "locked": "0.00000000"
    }
  }
}

Show the assets and corresponding balance of a specific user’s address

HTTP Request

GET /api/v1/addresses/<address>/balance/

Retrieve address’s transactions

Sample Request

curl -X POST \
     -H "Authorization: Bearer 7fbbb27f76d0ea462144d730c607ee80a8c8b082" \
     https://asset.diqi.us/api/v1/addresses/1Cx97jmzuYbMxXPZTbvMVeiLXQHFEYSgTe/transactions/

Sample Response

{
  "total": 1,
  "transactions": [
    ...
    {
      "tx_hash": "018412eab116ffea5bef0582b11281a414e0fe04b9f11c81de24c59cfcf63565",
      "amount": "1.00000000",
      "confirmations": 12,
      "unix_timestamp": "1460115555",
      "from_address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
      "to_address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
      "vins": [
        {
          "color": 1,
          "tx_hash": "a2ba0e3787411f6b2d4524e9cdae5bb804b5e17983f64bf09c9a8d9b8c05ff00",
          "n": 0,
          "address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
          "amount": "1.00000000"
        },
        {
          "color": 1,
          "tx_hash": "468c9e7d849c695e36e3ed8eeaeb97c7880dcb13339d4a1819f3902604bb191f",
          "n": 0,
          "address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
          "amount": "1.00000000"
        }
      ],
      "vouts": [
        {
          "amount": "1.00000000",
          "color": 1,
          "n": 0,
          "address": [
            "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5"
          ]
        }
      ],
      "outputs_value": "1.00000000",
      "inputs_value": "2.00000000",
      "fee": "1.00000000",
      "is_coinbase": false,
      "tx_type": "NORMAL",
      "time": "2016-04-08T11:39:15"
    }
  ]
}

Show the transactions of a specific user’s address

HTTP Request

GET /api/v1/addresses/<address>/transactions/

Update address

Sample Reqeust

curl -X POST \
     -H "Authorization: Bearer f26c4e465967e5b0e41ec879ba236c08e0ab2a2c" \
     -d "name=NewName" \
     https://asset.diqi.us/api/v1/addresses/1Cx97jmzuYbMxXPZTbvMVeiLXQHFEYSgTe/

Sample Response

{ 
    "message": "success",
    "name": "NewName"
}

HTTP Request

POST /api/v1/addresses/<address>/

Provide address and Token to change the name of the address

Arguments

Field Type Required Description
name string required The name of the address

Payments

Make a transaction to send your assets

Create a payment

Sample Request

Sample Request
curl -X POST \
     -H "Authorization: Bearer 7fbbb27f76d0ea462144d730c607ee80a8c8b082" \
     -d "from_address=18MRturYFxnYf51wY2R6ka6N5KVD1SxsND" \
     -d "to_address=1CQiBiFeKX881M79kUuvaCTMBYyrBLppCH" \
     -d "fee_address=1CQiBiFeKX881M79kUuvaCTMBYyrBLppCH" \
     -d "color_id=1" \
     -d "amount=100" \
     https://asset.diqi.us/api/v1/payments/

Sample Response

{
    "tx_hash": "af1dd56d5ecd7ad33539b28754d7123eae1b613c03625aa5c97fc0265a0b9529",
    "message": "success"
}

Transfer any assets from one address to another address, the from_address will be charged with one DiQi point as a transaction fee. Else, developer can provide a fee_address to pay the transaction fee.

Note. Ensure the from_address or the fee_address has at least one DiQi point to valid the transaction.

HTTP Request

POST /api/v1/payments/

Arguments

Field Type Required Description
from_address string required the adderss going to send assets
to_address string required the address going to receive assets
fee_address string optional the address is charged by one DiQi point per transaction
color_id string required the color_id of your assets
amount int required the amount of the assets for this payment
pin_code int optional if user’s account has set up pin code, then this field is required to input

License

License is needed before issue your own assets. You can apply for the asset’s license https://asset.diqi.us

List licenses

Sample Request

curl -X GET \
     https://asset.diqi.us/api/v1/license/

Sample Response

{
  "license_list": [
    {
      "description": "",
      "issuer": "15HnX9SrXYraA9Gs46qr6Scnp1bPwDMVVS",
      "member_control": false,
      "fee_collector_address": null,
      "metadata_link": null,
      "metadata_hash": null,
      "fee_rate": 0,
      "color_id": 1,
      "divisibility": true,
      "mint_schedule": "free",
      "fee_type": "fix",
      "color_name": "土豆積分",
      "version": 1
    },
    {
      "description": "",
      "issuer": "15HnX9SrXYraA9Gs46qr6Scnp1bPwDMVVS",
      "member_control": false,
      "fee_collector_address": "Hi",
      "metadata_link": "",
      "metadata_hash": "Hi",
      "fee_rate": 0,
      "color_id": 720435549,
      "divisibility": false,
      "mint_schedule": "",
      "fee_type": "fixed",
      "color_name": "百強積分",
      "version": 1
    },
    ...
  ],
  "page_number": 1,
  "total_pages": 1
}

List all existing licenses on the DiQi blockchain

HTTP Request

GET /api/v1/license/

Arguments

Field Type Required Description
page int optional the pagination (default = 1)

Apply new License

Sample Request

curl -X POST
     -H "Authorization: Bearer d5516db3696c6794aeea7a81b7fdf9cabf71e7b2"
     -d "color_name=NewAsset&color_description=newasset"
     -d "metadata_link=http://diqi.us"
     -d "callback_url=http://diqi.us/api/v1/notification/"
     -d "address=1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5"
     https://asset.diqi.us/api/v1/license/

Sample Response

{
  "color_description": "newasset",
  "color_name": "NewAsset",
  "is_active": false,
  "address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
  "color_id": 302244107
}

Apply your own License

HTTP Request

POST /api/v1/license/

Argument

Field Type Required Description
color_name int required the asset’s name
color_description string optional the description of the asset
metadata_link URL required the url written in the license
callback_url URL optional Server will send a request to the url after the asset is confirmed 10 times

Issue assets

Sample Request

curl -X POST \
     -d "color_id=5" \
     -d "amount=100" \
     -H "Authorization: Bearer 2b8b0882c671c243403b35aafb38796e8df2310" \
     https://asset.diqi.us/api/v1/license/mint/

Sample Response

{
  "amount": "100.00000000",
  "color": "5",
  "tx_hash": "d52d2e7daacf69853c64047870fec6aac4ce033e52b4c27f40e33189049f3d93"
}

Issue more assets

HTTP Request

POST /api/v1/license/mint/

Argument

Field Type Required Description
amount int required the amount of assets that you want to issue
color_id int required the color_id of the assets

Blockchain

Show the DiQi blockchain informations

Retrive transaction detail

Sample Request

curl -X GET \
     -H "Authorization: Bearer 2b8b0882c671c243403b35aafb38796e8df2310" \
     https://asset.diqi.us/api/v1/blockchain/transactions/d53239080acc0c3fed5ddd8f82e2bb020a01f6a9605b7bbc000c1f7658b2b692/

Sample Response

{
  "transactions": [
    {
      "tx_hash": "018412eab116ffea5bef0582b11281a414e0fe04b9f11c81de24c59cfcf63565",
      "amount": "1.00000000",
      "confirmations": 12,
      "unix_timestamp": "1460115555",
      "from_address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
      "to_address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
      "vins": [
        {
          "color": 1,
          "tx_hash": "a2ba0e3787411f6b2d4524e9cdae5bb804b5e17983f64bf09c9a8d9b8c05ff00",
          "n": 0,
          "address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
          "amount": "1.00000000"
        },
        {
          "color": 1,
          "tx_hash": "468c9e7d849c695e36e3ed8eeaeb97c7880dcb13339d4a1819f3902604bb191f",
          "n": 0,
          "address": "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5",
          "amount": "1.00000000"
        }
      ],
      "vouts": [
        {
          "amount": "1.00000000",
          "color": 1,
          "n": 0,
          "address": [
            "1NVJsaybzieLECJm9iCxS6T3XMhzgoBzN5"
          ]
        }
      ],
      "outputs_value": "1.00000000",
      "inputs_value": "2.00000000",
      "fee": "1.00000000",
      "is_coinbase": false,
      "tx_type": "NORMAL",
      "time": "2016-04-08T11:39:15"
    }
  ]
}

Show the transaction detail

HTTP Request

GET /api/v1/blockchain/transactions/<tx_hash>/

Retrieve blocks’ information

Sample Request

curl -X GET \
     -H "Authorization: Bearer 2b8b0882c671c243403b35aafb38796e8df2310" \
     https://asset.diqi.us/api/v1/blockchain/

Sample Response

{
  "blocks": [
    {
      "hash": "0000000c8b922edf2c7b4c1dc768959a75b61d8f1372dddbce0ceaf6c378375e",
      "branch": "main",
      "previous_block_hash": "0000001cd4f792228067dcd39c35da5adeb783560ff7af5c26b8cfcf071bc870",
      "next_blocks": null,
      "height": 7518,
      "confirmations": 2,
      "merkle_root": "d53239080acc0c3fed5ddd8f82e2bb020a01f6a9605b7bbc000c1f7658b2b692",
      "time": "1448614683",
      "created_at": "1448614642",
      "nonce": "35881480",
      "bits": "491565301",
      "difficulty": 0.013,
      "reward": 0,
      "size": 256,
      "version": 1,
      "transactions": [
          "d53239080acc0c3fed5ddd8f82e2bb020a01f6a9605b7bbc000c1f7658b2b692"
      ]
    },
    ...
  ]
}

Show the latest 50 blocks of the DiQi blockchain

HTTP Request

GET /api/v1/blockchain/

Notification

Transactions Notification

Sample Request

curl -X POST
     -H "Authorization: Bearer d5516db3696c6794aeea7a81b7fdf9cabf71e7b2"
     -d "tx_hash=00000d6487458f8f5f7eca4d3edb62b63e44673062afb2b90235c7f1cf28f449"
     -d "confirmations=11"
     -d "callback_url=https://help.center.org/notification/j3igoe93ijt/" 
     https://asset.diqi.us/api/v1/notification/

Sample Response

{
  "id": 1,
  "tx_hash": "00000d6487458f8f5f7eca4d3edb62b63e44673062afb2b90235c7f1cf28f449",
  "confirmations": 11,
  "callback_url": "https://help.center.org/notification/j3igoe93ijt/",
  "is_sent": false
}

When the confirmation times of a transaction reaches the number user assign, DiQi server will notify the callback_url.

HTTP Request

POST /api/v1/notification/

Argument

Field Type Required Description
tx_hash string required Transaction hash
confirmations int required If it is a mint transaction, the number is 11. If it is a normal payment transaction, the number is 6.
callback_url URL required Server will send a request to the url after the asset is confirmed 10 times