NAV Navigation
HTTP

Hancock dlt adapter API v7.0.4

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

DLT Adapter is a web service that abstracts user interactions with DLT networks on a high-level common HTTP REST interface that conveniently provides the user with the specific DLT type adapted transaction that can be easily inspected, signed and personally sent to a DLT network trusted node of the choice of the user.

Current blockchains supported {dlt} ethereum

Base URLs:

Web: BBVA Hancock License: Apache 2.0

{dlt}/smartcontracts

All operations about smartcontracts registered in Hancock, as well as operations with smartcontract with abi attached.

Find out more

List of smartcontracts

Code samples

GET https://host/{version}/dlt-adapter/{dlt}/smartcontracts HTTP/1.1
Host: host
Accept: application/json

GET /{dlt}/smartcontracts

Retrieve the list of all smart contracts registered in Hancock.

Parameters

Name In Type Required Description
dlt path string true Dlt to work with

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "list": {
      "address": "0xcffffffffffffff000000000000000000000000",
      "alias": "smartcontract",
      "abi": [
        {
          "abi": []
        }
      ],
      "abiname": "alias"
    }
  }
}

Responses

Status Meaning Description Schema
200 OK List of smartcontracts registered smartContractListResponse
500 Internal Server Error Unexpected error genericError

Abi of a smartcontract

Code samples

GET https://host/{version}/dlt-adapter/{dlt}/smartcontracts/{addressAlias} HTTP/1.1
Host: host
Accept: application/json

GET /{dlt}/smartcontracts/{addressAlias}

Retrieve ABI from registered Smart Contract in Hancock.

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the smartcontract

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "address": "0xcffffffffffffff000000000000000000000000",
    "alias": "smartcontract",
    "abi": [
      {
        "abi": []
      }
    ],
    "abiname": "alias"
  }
}

Responses

Status Meaning Description Schema
200 OK Properties of registered smartcontract smartContractResponse
404 Not Found Bad request genericError
500 Internal Server Error Unexpected error genericError

Delete a registered smartcontract

Code samples

DELETE https://host/{version}/dlt-adapter/{dlt}/smartcontracts/{addressAlias} HTTP/1.1
Host: host
Accept: application/json

DELETE /{dlt}/smartcontracts/{addressAlias}

Delete a registered Smart Contract in Hancock.

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the smartcontract

Example responses

204 Response

{
  "result": {
    "code": "20X",
    "description": "DLT - Operation successfully requested"
  }
}

Responses

Status Meaning Description Schema
204 No Content Smartcontract registration deleted genericResponse
500 Internal Server Error Unexpected error genericError

Adapt deploy smartcontract

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/smartcontracts/deploy HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/smartcontracts/deploy

Adapt a Smart Contract deployment transaction. Give a binary data to deploy the smartcontract in a dlt network.

Body parameter

{
  "method": "constructor",
  "params": [
    "0xcffffffffffffff000000000000000000000000",
    "2"
  ],
  "urlBase": "http://storage/smartcontract",
  "from": "0xcffffffffffffff000000000000000000000000"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
body body transactionDeployRequest true Deploy request schema to adapt the deploy order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "0x606060405260a060405190810160405280604060405190810160405280600781526020017f637265617465640000000000000000000000000000000000000000000000000081",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Deploy success transactionDeployResponse
400 Bad Request Bad request genericError
500 Internal Server Error Unexpected error genericError

Adapt invocation smartcontract

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/smartcontracts/invoke HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/smartcontracts/invoke

Adapt a Smart Contract invocation transaction.

Body parameter

{
  "method": "attest",
  "params": [
    "2"
  ],
  "urlBase": "http://storage/smartcontract",
  "from": "0xcffffffffffffff000000000000000000000000",
  "to": "0xcffffffffffffff000000000000000000000001"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
body body transactionInvokeRequest true Invoke request schema to adapt the invoke order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "transaction",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Action send to DLT network transactionInvokeResponse
400 Bad Request Bad request genericError
500 Internal Server Error Unexpected error genericError

Adapt invocation method of smartcontract

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/smartcontracts/invoke/{addressAlias} HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/smartcontracts/invoke/{addressAlias}

Adapt transaction that will invoke a method in the registered Smart Contract

Body parameter

{
  "method": "attest",
  "params": [
    "2"
  ],
  "from": "0xcffffffffffffff000000000000000000000000"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias registered in Hancock of the smartcontract
body body transactionInvokeRegisterRequest true Invoke request schema to adapt the invoke order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "transaction",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Action send to DLT network transactionInvokeResponse
400 Bad Request Bad request genericError
404 Not Found Not found genericError
500 Internal Server Error Unexpected error genericError

Adapt invocation method with abi

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/smartcontracts/invoke/abi HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/smartcontracts/invoke/abi

Adapt transaction that will invoke a method in the registered Smart Contract with abi in params

Body parameter

{
  "method": "attest",
  "action": "call",
  "params": [
    "2"
  ],
  "abi": [
    {
      "abi": []
    }
  ],
  "from": "0xcffffffffffffff000000000000000000000000",
  "to": "0xcffffffffffffff000000000000000000000001"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
body body transactionInvokeAbiRequest true Invoke request schema to adapt the invoke order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "transaction",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Action send to DLT network transactionInvokeResponse
400 Bad Request Bad request genericError
404 Not Found Not found genericError
500 Internal Server Error Unexpected error genericError

Register smartcontract

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/smartcontracts/register HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/smartcontracts/register

Register a deployed Smart Contract.

Body parameter

{
  "abi": [
    {
      "abi": []
    }
  ],
  "alias": "name",
  "adddres": "0xcffffffffffffff000000000000000000000000"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
body body transactionRegisterRequest true Invoke request schema to adapt the invoke order

Example responses

201 Response

{
  "result": {
    "code": "20X",
    "description": "DLT - Operation successfully requested"
  }
}

Responses

Status Meaning Description Schema
201 Created Successful registration action genericResponse
400 Bad Request Bad request genericError
409 Conflict Bad request genericResponse
500 Internal Server Error Unexpected error genericError

{dlt}/transfers

Adapt a transfer call to the DLT between two addresses.

Find out more

Adapt transfer

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/transfers HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/transfers

Adapt a transfer call to the DLT between two addresses.

Body parameter

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "from": "0xcffffffffffffff000000000000000000000001",
  "data": "transaction",
  "value": "2"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
body body transferRequest true Transfer request schema to adapt the transfer order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "transaction",
    "value": "2",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Transfer send to mine on DLT network transferResponse
400 Bad Request Bad request genericError
500 Internal Server Error Unexpected error genericError

{dlt}/balance

Obtain the native cryptocurrency balance of an address.

Find out more

Balance

Code samples

GET https://host/{version}/dlt-adapter/{dlt}/balance/{address} HTTP/1.1
Host: host
Accept: application/json

GET /{dlt}/balance/{address}

Obtain the native cryptocurrency balance of an address.

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
address path string true Address of the user

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "balance": "2"
  }
}

Responses

Status Meaning Description Schema
200 OK The native cryptocurrency balance of an address balanceResponse
500 Internal Server Error Unexpected error genericError

{dlt}/token

All operations about ERC20 tokens, a facility to operate with tokens of ethereum.

All token`s operations about ERC20 tokens can be invoked without {addressAlias} parameter in path, and with smartcontract address in request form ('smartContractAddress':'') on post calls, or with queryparam (contractAddress='') on get calls.

Find out more

Token list

Code samples

GET https://host/{version}/dlt-adapter/{dlt}/token HTTP/1.1
Host: host
Accept: application/json

GET /{dlt}/token

Retrieve the list of all ERC20 tokens of Ethereum environment registered in Hancock.

Parameters

Name In Type Required Description
dlt path string true Dlt to work with

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "list": {
      "address": "0xcffffffffffffff000000000000000000000000",
      "alias": "smartcontract",
      "abi": [
        {
          "abi": []
        }
      ],
      "abiname": "alias"
    }
  }
}

Responses

Status Meaning Description Schema
200 OK The list of all token registered in Hancock smartContractListResponse
500 Internal Server Error Unexpected error genericError

Token register

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/token/register HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/token/register

Register a ERC20 token contract of Ethereum environment in Hancock.

Body parameter

{
  "address": "0xcffffffffffffff000000000000000000000000",
  "alias": "TKN"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
body body transferTokenRegister true Transfer token request schema to register

Example responses

200 Response

{
  "result": {
    "code": "20X",
    "description": "DLT - Operation successfully requested"
  }
}

Responses

Status Meaning Description Schema
200 OK Successful registration action genericResponse
500 Internal Server Error Unexpected error genericError

Delete a registered token

Code samples

DELETE https://host/{version}/dlt-adapter/{dlt}/token/{addressAlias} HTTP/1.1
Host: host
Accept: application/json

DELETE /{dlt}/token/{addressAlias}

Unregister the token in Hancock.

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the token smartcontract

Example responses

204 Response

{
  "result": {
    "code": "20X",
    "description": "DLT - Operation successfully requested"
  }
}

Responses

Status Meaning Description Schema
204 No Content Token registration deleted genericResponse
500 Internal Server Error Unexpected error genericError

Token balance

Code samples

GET https://host/{version}/dlt-adapter/{dlt}/token/{addressAlias}/balanceOf/{address} HTTP/1.1
Host: host
Accept: application/json

GET /{dlt}/token/{addressAlias}/balanceOf/{address}

Obtain the native ERC20 token currency balance of an address.

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the token smartcontract
address path string true Address of the user

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "balance": "2"
  }
}

Responses

Status Meaning Description Schema
200 OK Get token balance operation success. balancetokenResponse
500 Internal Server Error Unexpected error genericError

Token metadata

Code samples

GET https://host/{version}/dlt-adapter/{dlt}/token/{addressAlias}/metadata HTTP/1.1
Host: host
Accept: application/json

GET /{dlt}/token/{addressAlias}/metadata

Obtain the info associated to the ERC20 Token (name, symbol, decimals and totalSupply).

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the token smartcontract

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "name": "Token name",
    "symbol": "TKN",
    "decimals": "0",
    "totalSupply": "1000"
  }
}

Responses

Status Meaning Description Schema
200 OK Info associated to the ERC20 Token. metadataResponse
404 Not Found Not found genericError
500 Internal Server Error Unexpected error genericError

Adapt token transfer

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/token/{addressAlias}/transfer HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/token/{addressAlias}/transfer

Adapt a token ERC20 transfer call to the DLT between two addresses.

Body parameter

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "from": "0xcffffffffffffff000000000000000000000001",
  "value": "2"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the token smartcontract
body body transferTokenRequest true Transfer token request schema to adapt the order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "0xa9059cbb000000000000000000000000de8e772f0350e992ddef81bf8f51d94a8ea9216d0000000000000000000000000000000000000000000000000000000000000001",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Token transfer adapted to send transferTokenResponse
400 Bad Request Bad request genericError
500 Internal Server Error Unexpected error genericError

Adapt token transferFrom

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/token/{addressAlias}/transferFrom HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/token/{addressAlias}/transferFrom

Adapt a token ERC20 transferFrom call to the DLT between two addresses.

Body parameter

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "from": "0xcffffffffffffff000000000000000000000001",
  "sender": "0xcffffffffffffff000000000000000000000002",
  "value": "2"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the token smartcontract
body body transferfromTokenRequest true Transferfrom token request schema to adapt the order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "0xa9059cbb000000000000000000000000de8e772f0350e992ddef81bf8f51d94a8ea9216d0000000000000000000000000000000000000000000000000000000000000001",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Token transfer adapted to send transferTokenResponse
400 Bad Request Bad request genericError
500 Internal Server Error Unexpected error genericError

Adapt token approve

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/token/{addressAlias}/approve HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/token/{addressAlias}/approve

Token ERC20 owner can approve for spender to transfer tokens from the token owner's account.

Body parameter

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "spender": "0xcffffffffffffff000000000000000000000001",
  "value": "2"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the token smartcontract
body body approveTokenRequest true Approve token request schema to adapt the order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "0xa9059cbb000000000000000000000000de8e772f0350e992ddef81bf8f51d94a8ea9216d0000000000000000000000000000000000000000000000000000000000000001",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Responses

Status Meaning Description Schema
200 OK Token approve order adapted to send transferTokenResponse
400 Bad Request Bad request genericError
500 Internal Server Error Unexpected error genericError

Token allowance

Code samples

POST https://host/{version}/dlt-adapter/{dlt}/token/{addressAlias}/allowance HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /{dlt}/token/{addressAlias}/allowance

Provides the number of tokens allowed to be transferred from a given address by another given address.

Body parameter

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "spender": "0xcffffffffffffff000000000000000000000001",
  "tokenOwner": "0xcffffffffffffff000000000000000000000002"
}

Parameters

Name In Type Required Description
dlt path string true Dlt to work with
addressAlias path string true Address or alias of the token smartcontract
body body allowanceTokenRequest true Allowance token request schema to adapt the order

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "data": "2"
  }
}

Responses

Status Meaning Description Schema
200 OK Token approve order adapted to send allowanceTokenResponse
400 Bad Request Bad request genericError
500 Internal Server Error Unexpected error genericError

Protocol

API to adapt operations to Hancock Protocol, transform de data operations to a encode protocol to work with qr code.

Encode

Code samples

POST https://host/{version}/dlt-adapter/protocol/encode HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /protocol/encode

Encode operation data to Hancock Protocol. Give us a code with all info to generate a qr.

Body parameter

{
  "action": "transfer",
  "body": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "value": "2",
    "data": "concept"
  },
  "dlt": "Ethereum"
}

Parameters

Name In Type Required Description
body body encodeRequest true Encode request schema

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "qrEncode": "hancock://qr?code=%7B%22action%22%3A%22transfer%22%2C%22body%22%3A%7B%22to%22%3A%22006c0a14f7561898b9ddc0c57652a53b2c6665443e%22%2C%22value%22%3A%221%22%2C%22data%22%3A%22concept%22%7D%2C%22dlt%22%3A%22ethereum%22%7D"
  }
}

Responses

Status Meaning Description Schema
200 OK Encode operation encodeResponse
400 Bad Request Bad request genericError

Decode

Code samples

POST https://host/{version}/dlt-adapter/protocol/decode HTTP/1.1
Host: host
Content-Type: application/json
Accept: application/json

POST /protocol/decode

Obtain all data about an operation from an encoded string.

Body parameter

{
  "code": "hancock://qr?code=%7B%22action%22%3A%22transfer%22%2C%22body%22%3A%7B%22to%22%3A%22006c0a14f7561898b9ddc0c57652a53b2c6665443e%22%2C%22value%22%3A%221%22%2C%22data%22%3A%22concept%22%7D%2C%22dlt%22%3A%22ethereum%22%7D"
}

Parameters

Name In Type Required Description
body body decodeRequest true Decode request schema

Example responses

200 Response

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "action": "transfer",
    "body": {
      "to": "0xcffffffffffffff000000000000000000000000",
      "value": "2",
      "data": "concept"
    },
    "dlt": "Ethereum"
  }
}

Responses

Status Meaning Description Schema
200 OK Decode operation decodeResponse
400 Bad Request Bad request genericError

Schemas

genericResponse

{
  "result": {
    "code": "20X",
    "description": "DLT - Operation successfully requested"
  }
}

Generic Response Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code

genericError

{
  "error": "400 - 500",
  "internalError": "HKAD5000X",
  "message": "Call Error",
  "extendedMessage": "Error: Description"
}

Generic Response Schema

Properties

Name Type Required Restrictions Description
error string true none Identification error code
internalError string true none Hancock error code
message string false none Hancock message
extendedMessage string false none Detailed message

smartContractListResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "list": {
      "address": "0xcffffffffffffff000000000000000000000000",
      "alias": "smartcontract",
      "abi": [
        {
          "abi": []
        }
      ],
      "abiname": "alias"
    }
  }
}

Registered Smart Contract Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data [object] false none none
» address string true none smartcontract address
» alias string true none alias of smartcontract registered
» abi array true none abi of the smartcontract
» abiname string false none alias of the abi

smartContractResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "address": "0xcffffffffffffff000000000000000000000000",
    "alias": "smartcontract",
    "abi": [
      {
        "abi": []
      }
    ],
    "abiname": "alias"
  }
}

Registered Smart Contract Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object false none none

transactionDeployRequest

{
  "method": "constructor",
  "params": [
    "0xcffffffffffffff000000000000000000000000",
    "2"
  ],
  "urlBase": "http://storage/smartcontract",
  "from": "0xcffffffffffffff000000000000000000000000"
}

Deploy request schema to adapt the deploy order

Properties

Name Type Required Restrictions Description
method any true none Name of the constructor method of the smartcontract
params any false none Params to pass to the constructor of the smartcontract
urlBase string true none Url where are stored the abi and the bin of the smart contract to invoke
from string true none Address of the owner

transactionDeployResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "0x606060405260a060405190810160405280604060405190810160405280600781526020017f637265617465640000000000000000000000000000000000000000000000000081",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Created Smart Contract Response Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object true none none
» nonce string false none Counter assigned to transaction
» from string false none address of the owner
» data string false none Smartcontract data encoded
» gas string false none Gas limit assigned
» gasPrice string false none Gas estimated assigned

transactionInvokeRequest

{
  "method": "attest",
  "params": [
    "2"
  ],
  "urlBase": "http://storage/smartcontract",
  "from": "0xcffffffffffffff000000000000000000000000",
  "to": "0xcffffffffffffff000000000000000000000001"
}

Invoke request schema to adapt the invoke order

Properties

Name Type Required Restrictions Description
method object false none Method to invoke in the smart contract
params object false none Params to pass to the method
urlBase string false none Url where are stored the abi and the bin of the smart contract to invoke
from string false none Address of the owner
to string false none Address of the smart contract to invoke

transactionInvokeResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "transaction",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Invoked Smart Contract Response Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object true none none
» nonce string false none Counter assigned to transaction
» from string false none address of the owner
» data string false none Smartcontract data encoded
» gas string false none Gas limit assigned
» gasPrice string false none Gas estimated assigned
» to string false none address of the smartcontract

transactionInvokeRegisterRequest

{
  "method": "attest",
  "params": [
    "2"
  ],
  "from": "0xcffffffffffffff000000000000000000000000"
}

Invoke request schema to adapt the invoke order

Properties

Name Type Required Restrictions Description
method object false none Method to invoke in the smart contract
params object false none Params to pass to the method
from string false none Address of the owner

transactionInvokeAbiRequest

{
  "method": "attest",
  "action": "call",
  "params": [
    "2"
  ],
  "abi": [
    {
      "abi": []
    }
  ],
  "from": "0xcffffffffffffff000000000000000000000000",
  "to": "0xcffffffffffffff000000000000000000000001"
}

Invoke request schema to adapt the invoke order

Properties

Name Type Required Restrictions Description
method object false none Method to invoke in the smart contract
action object false none Kind of action (send , call)
params object false none Params to pass to the method
abi object false none Abi of the smartcontract
from string false none Address of the owner
to string false none Address of the smart contract to invoke

transactionRegisterRequest

{
  "abi": [
    {
      "abi": []
    }
  ],
  "alias": "name",
  "adddres": "0xcffffffffffffff000000000000000000000000"
}

Invoke request schema to adapt the invoke order

Properties

Name Type Required Restrictions Description
abi any true none Abi of the smartcontract
alias string true none Alias of the smartcontract
adddres string true none Address of the smartcontract

transferRequest

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "from": "0xcffffffffffffff000000000000000000000001",
  "data": "transaction",
  "value": "2"
}

Transfer request schema

Properties

Name Type Required Restrictions Description
from any true none Address of the sender in the DLT
to any true none Address of the receiver in the DLT
value any true none Value of Weis to be transferred
data object false none Information about the transfer

transferResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "transaction",
    "value": "2",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Transfer response schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object true none none
» nonce string false none Nonce assigned to transaction
» from string false none Address of the sender in the DLT
» gas string false none Gas value of transaction
» to string false none Address of the receiver in the DLT
» gasPrice string false none Gas estimated
» value string false none Value of Weis to be transferred
» data string false none Information about the transfer

balanceResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "balance": "2"
  }
}

Get balance Response Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data any true none none

balancetokenResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "balance": "2"
  }
}

Get balance token Response Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data any true none none

metadataResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "name": "Token name",
    "symbol": "TKN",
    "decimals": "0",
    "totalSupply": "1000"
  }
}

Metadata info Schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object true none none
» name string false none Token name
» symbol string false none Symbol of token
» decimals string false none Decimals defined in smartcontract
» totalSupply string false none Supply total defined in smartcontract

transferTokenRegister

{
  "address": "0xcffffffffffffff000000000000000000000000",
  "alias": "TKN"
}

Token request schema

Properties

Name Type Required Restrictions Description
address any true none Address of the contract
alias any true none Alias of the contract

transferTokenRequest

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "from": "0xcffffffffffffff000000000000000000000001",
  "value": "2"
}

Token request schema

Properties

Name Type Required Restrictions Description
from any true none Address of the sender in the DLT
to any true none Address of the receiver in the DLT
value any true none Value of token to be transfered

transferTokenResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "from": "0xcffffffffffffff000000000000000000000001",
    "data": "0xa9059cbb000000000000000000000000de8e772f0350e992ddef81bf8f51d94a8ea9216d0000000000000000000000000000000000000000000000000000000000000001",
    "gasPrice": "0x3b9aca00",
    "nonce": "0x642",
    "gas": "0x5208"
  }
}

Token response schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object true none none
» nonce string false none Nonce assigned to transaction
» from string false none Address of the sender in the DLT
» gas string false none Gas value of transaction
» to string false none Address of the receiver in the DLT
» gasPrice string false none Gas estimated
» data string false none Information about the transfer

transferfromTokenRequest

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "from": "0xcffffffffffffff000000000000000000000001",
  "sender": "0xcffffffffffffff000000000000000000000002",
  "value": "2"
}

Token transferFrom request schema

Properties

Name Type Required Restrictions Description
from any true none Address of the sender in the DLT
sender any true none Address with enough allowance in the DLT
to any true none Address of the receiver in the DLT
value any true none Value of token to be transfered

approveTokenRequest

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "spender": "0xcffffffffffffff000000000000000000000001",
  "value": "2"
}

Allowance request schema

Properties

Name Type Required Restrictions Description
from any true none Address of the receiver in the DLT
spender any true none Address of the spender in the DLT
value any true none Value of token to be transfered

allowanceTokenRequest

{
  "to": "0xcffffffffffffff000000000000000000000000",
  "spender": "0xcffffffffffffff000000000000000000000001",
  "tokenOwner": "0xcffffffffffffff000000000000000000000002"
}

Allowance request schema

Properties

Name Type Required Restrictions Description
from any true none Address of the receiver in the DLT
spender any true none Address of the spender in the DLT
tokenOwner any true none Address of the owner in the DLT

allowanceTokenResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "data": "2"
  }
}

Allowance response schema

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data string true none Amount of tokens approved

decodeRequest

{
  "code": "hancock://qr?code=%7B%22action%22%3A%22transfer%22%2C%22body%22%3A%7B%22to%22%3A%22006c0a14f7561898b9ddc0c57652a53b2c6665443e%22%2C%22value%22%3A%221%22%2C%22data%22%3A%22concept%22%7D%2C%22dlt%22%3A%22ethereum%22%7D"
}

Protocol Decode Param Model Request

Properties

Name Type Required Restrictions Description
code string true none Encode string with data

encodeResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "qrEncode": "hancock://qr?code=%7B%22action%22%3A%22transfer%22%2C%22body%22%3A%7B%22to%22%3A%22006c0a14f7561898b9ddc0c57652a53b2c6665443e%22%2C%22value%22%3A%221%22%2C%22data%22%3A%22concept%22%7D%2C%22dlt%22%3A%22ethereum%22%7D"
  }
}

Protocol Encode Param Model Response

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object false none none
» qrEncode string true none Encode string with data

encodeRequest

{
  "action": "transfer",
  "body": {
    "to": "0xcffffffffffffff000000000000000000000000",
    "value": "2",
    "data": "concept"
  },
  "dlt": "Ethereum"
}

Protocol Encode Param Model Request

Properties

Name Type Required Restrictions Description
action string true none Action encoded
body object true none none
» to string false none address
» value string false none value
» data string false none data about transfer
dlt string true none dlt

Enumerated Values

Property Value
action transfer
dlt ethereum

decodeResponse

{
  "result": {
    "code": 200,
    "description": "DLT - Operation successfully requested"
  },
  "data": {
    "action": "transfer",
    "body": {
      "to": "0xcffffffffffffff000000000000000000000000",
      "value": "2",
      "data": "concept"
    },
    "dlt": "Ethereum"
  }
}

Protocol Decode Param Model Response

Properties

Name Type Required Restrictions Description
result object true none none
» code string true none Api code
» description string true none Description about the api code
data object false none none
» action string true none Action encoded
» body object true none none
»» to string false none address
»» value string false none value
»» data string false none data about transfer
» dlt string true none dlt

Enumerated Values

Property Value
action transfer
dlt ethereum