Prerequisites
All API requests shall go through the DaGuard Station that runs as a service at your own data center. After the organization and user permissions are set up at DaGuard site, wallets can ONLY be created through DaGuard Station to ensure you have ultimate control of two private keys and keep them within your network. The DaGuard Station also handles all the client-side operations before submitting them to DaGuard through secured API.
Before using DaGuard Station, please make sure you have done the following things:
- Create an API key
- Install Java Runtime Environment
- Install and Start DaGuard Station
Create an API key
API Key
Before being able to send any requests, you must create API key via the DaGuard website. Upon creation, you will be provided 3 pieces of information that you must remember:
- API-KEY (Generated by daguard)
- API-KEY-SECRET (Generated by daguard)
- API-KEY-PASSPHRASE (Provided by user and daguard stores the salted hash of the passphrase to further secure the api access)
API Key Permissions
You can restrict the following access levels of API keys under coin level
- VIEW
- SPEND
- ADMIN
- CREATE_WALLET
- WEBHOOK_NOTIFICATION
Install Java Runtime Environment
You can check the version of JRE you have installed with the follwing command from a terminal prompt:
java -version
Download and Install Java Runtime Environment
Click download to download JRE .
Install and Start DaGuard Station
- Click Download to get DaGuard Station
- Unzip DaGuard-Station.zip there are three applications that we need to start
Start on Windows
First step : enter "daguard-station/bin" directory start DaGuard Station
$ start-daguard.bat
Second step : enter "key-service/bin" directory start key service
$ start-key-service.bat
Third step : enter "signer/bin" directory start signer service
$ start-signer.bat
Start on Linux
First step : enter "daguard-station/bin" directory start DaGuard Station
$ ./start-daguard.sh
Second step : enter "key-service/bin" directory start key service
$ ./start-key-service.sh
Third step : enter "signer/bin" directory start signer service
$ ./start-signer.sh
DaGuard Station
After DaGuard Station is started, you can start creating wallets via DaGuard Station UI. The Station UI can be accessed through http://localhost:8657 or http://{box ip}:8657 if you access through the network.
Currently, all wallets can only be created through DaGuard Station located in your data center to ensure you have ultimate control of two private keys and keep them within your network. Once created, these wallets can be accessed after logging into the DaGuard platform.
DaGuard API Swagger(Optional)
DaGuard API Swagger is a helpful development tool that helps developers to visualize and interact with all Station REST APIs. The API DaGuard Swagger UI can be accessed through http://localhost:8657/swagger-ui.html or http://{box ip}:8657/swagger-ui.html if you access through the network.
API General
All API requests and responses use application/json content type. Responses follow HTTP response status codes to indicate the success and the failure.
API Base Url
http://localhost:8657/api
API Request
API Request Headers
All API requests must contain the following headers:
- API-KEY
- API-KEY-SECRET
- API-KEY-PASSPHRASE
API Response
Successful http response contains HTTP status code 200 and an optional body. If the response contains the body, the fields within the body are documented in each related API sections. Failed http response contains non 200 HTTP status code and the body with an errorCode field to indicate the cause of the failures.
Error Response Fields
Name | Type | Mandatory | Description |
---|---|---|---|
errorCode | String | M | Error code. e.g.INVALID_PASSWORD |
errorData | String | O | Additional information on the user data that may cause the error. Data is provided in json format. |
API Message Format
All messages are in json format.
API Message Field Types
Type | Description |
---|---|
Integer | Integer numbers |
Long | Long numbers |
Boolean | True/False |
DoubleString | Decimal numbers are returned as strings to preserve full precision across platforms |
Enum | Enum definition. Passing invalid enum values will result in API_BAD_REQUEST error |
String | Text |
API Message Mandatory Field Indicators
Indicator | Description |
---|---|
M | Mandatory field |
(M) | Mandatory field under certain conditions |
O | Optional field |
Pagination
Pagination is supported for all REST calls that return arrays. The newest items are returned by default.
Name | Type(value) | Mandatory | Description |
---|---|---|---|
pageNumber | Integer | O | Default to 1 |
pageSize | Integer | O | Default to 100 |
Example: GET transfers?pageNumber=1&pageSize=100
Timestamp
Unless otherwise specified, all timestamps returned from API are milliseconds since UNIX Epoch.
Wallets
Get Coins
curl "http://localhost:8657/api/coins"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"coinResponses": [
{
"coin": "BTC",
"decimals": 8
},
{
"coin": "BSV",
"decimals": 8
},
{
"coin": "BCH",
"decimals": 8
},
{
"coin": "ETH",
"decimals": 8
},
{
"coin": "XRP",
"decimals": 8
},
{
"coin": "XLM",
"decimals": 8
},
{
"coin": "ZEC",
"decimals": 8
},
{
"coin": "TRX",
"decimals": 8
},
{
"coin": "LTC",
"decimals": 8
},
{
"coin": "NEO",
"decimals": 8
},
{
"coin": "EOS",
"decimals": 8
}
]
}
Returns CoinObject.
Supported Coins
DaGuard supports the following digital assets:
Id | Digital Asset |
---|---|
BTC | Bitcoin |
BSV | Bitcoin SV |
BCH | Bitcoin Cash |
ETH | Ethereum |
XRP | Ripple |
XLM | Stellar |
ZEC | Zcash |
TRX | Tron |
LTC | Litecoin |
NEO | Neo |
EOS | Eos |
HTTP Request
GET /coins
CoinObject
Name | Type(value) | Mandatory | Description |
---|---|---|---|
coin | String | M | |
decimals | Number | M | |
contractAddress | String | O |
Get Coin
curl "http://localhost:8657/api/coins/ETH"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"coin": "ETH",
"decimals": 18
}
Returns CoinObject.
HTTP Request
GET /coins/{coin}
Create Wallet
curl "http://localhost:8657/api/wallets"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "POST"
-H "Content-Type:application/json"
-d "{\"label\" : \"XRPACS\",\"coin\" : \"XRP\",\"walletPassphrase\" : \"Xwings2019\",\"backupPublicKey\":\"r4RTwsWi9MWMibc8HZ1gHYAt7jvz8SnUVm\"}"
Sample response:
{
"walletId": "8ebc7ad9658d4941b2fdddcccf539371",
"coin": "XRP",
"label": "XRPACS",
"userKey": "{\"version\":1,\"id\":\"49a2f4a828e771ccb4dee06a09b2c5d8\",\"crypto\":{\"cipher\":\"aes-128-ctr\",\"kdf\":\"scrypt\",\"ciphertext\":\"0R1jFXIa3mIGbWmPWn2ACDzjcqXz027hAN+jm5o=\",\"cipherparams\":{\"iv\":\"MqqjG7JTeVezty0YMDTYJA==\"},\"kdfparams\":{\"dklen\":32,\"n\":16384,\"p\":1,\"r\":8,\"salt\":\"RU1GiUr3PG0=\"}},\"pub\":\"rBZyi26m6MrmWfDECXBEW9pTaAKzVtdq7r\"}",
"backupKey": "r4RTwsWi9MWMibc8HZ1gHYAt7jvz8SnUVm",
"encryptedWalletPassword": "{\"cipher\":\"aes-128-ctr\",\"kdf\":\"scrypt\",\"ciphertext\":\"O4NoAOMcOFnISA==\",\"cipherparams\":{\"iv\":\"SHQreRcl/nLr9IKf1NyS9A==\"},\"kdfparams\":{\"dklen\":32,\"n\":16384,\"p\":1,\"r\":8,\"salt\":\"jh2wRWLZGso=\"}}"
}
Creates a coin Wallet object.
HTTP Request
POST /wallets
Body Parameters
Name | Type(value) | Mandatory | Description |
---|---|---|---|
label | String | M | The label of this keycard |
coin | String | M | The digital coin |
walletPassphrase | String | M | Encryption code for wallet passphrase (used for lost passphrase recovery) |
backupPublicKey | String | O | Backup Public Key |
Response
Name | Type(value) | Mandatory | Description |
---|---|---|---|
walletId | String | M | Wallet id |
label | String | M | Wallet label |
coin | String | M | Coin id |
userKey | String | M | User Key, encrypted with provide passcode |
backupKey | String | M | Backup Key, encrypted with provide passcode |
encryptedWalletPassword | String | M | wallet password, encrypted with a key held by Daguard |
Those information which can be used to recover your wallet in several situations, please save it safely.
Get Wallet
curl "http://localhost:8657/api/BTC/wallets/38a67030909143da94a25f76ad3ac60c"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"walletId": "38a67030909143da94a25f76ad3ac60c",
"coin": "BTC",
"label": "BTC_W1",
"balance": "0",
"availableBalance": "0",
"keys": [
"805d50bd5ffb13a5104deb68a8dd7166",
"7ed3add5b0169bd82d8fac60b951f6eb",
"25546cfe200cd7a956d3b484002054e0"
]
}
Returns a wallet object.
HTTP Request
GET /:coin/wallets/:walletId
Response
Name | Type(value) | Mandatory | Description |
---|---|---|---|
walletId | String | M | Wallet id |
label | String | M | Wallet label |
coin | String | M | Coin id |
balance | DoubleString | M | Wallet balance on blockchain |
availableBalance | DoubleString | M | Available balance for spending |
keys | Array of String | M | Array of keyIds |
Get All Wallets
curl "http://localhost:8657/api/BTC/wallets"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"wallets": [
{
"walletId": "38a67030909143da94a25f76ad3ac60c",
"coin": "BTC",
"label": "BTC_W1",
"balance": "0",
"availableBalance": "0",
"keys": [
"805d50bd5ffb13a5104deb68a8dd7166",
"7ed3add5b0169bd82d8fac60b951f6eb",
"25546cfe200cd7a956d3b484002054e0"
]
},
{
"walletId": "1e7101e060b740c793570b071562f99f",
"coin": "BTC",
"label": "BTC_W2",
"balance": "0",
"availableBalance": "0",
"keys": [
"89ad89e4ccf267e719014b9b7d075eff",
"aa0479974a3fae3bf767870eb2b6e6b9",
"be41f020ca5f28f7da929d6544f444e7"
]
}
]
}
Returns an array of Wallet objects.
HTTP Request
GET /:coin/wallets
Response
Returns an array of Wallet objects. See Get Wallet for the wallet object.
Create Wallet Address
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/addresses"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "POST"
-H "Content-Type:application/json"
-d '{"label":"address2"}'
Sample response:
{
"address": "2NFstjMfj5EhDBUaKSFhjLZJ4PazqUZzqZ4",
"coin": "BTC",
"createdTime": 1546853432345635
}
HTTP Request
POST /:coin/wallets/:walletId/addresses
Body Parameters
Name | Type(value) | Mandatory | Description |
---|---|---|---|
label | String | M | The label of this Address |
Return the created Address object.
Get Wallet All Addresses
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/addresses"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"addresses": [
{
"label": "Address 0",
"address": "2N7RYJawMLhhJ79q2ERTrb75MhGgofWXfQx",
"coin": "BTC",
"walletId": "b2993a9eb932437a9b742fa9f5267086",
"balance": "100.1",
"createdTime": 1546833591910640
},
{
"label": "address1",
"address": "2NBwC2aLtXDAnHiEq7wSKfqGSGThdXhJwfu",
"coin": "BTC",
"walletId": "b2993a9eb932437a9b742fa9f5267086",
"balance": "100",
"createdTime": 1546852394339506
}
]
}
HTTP Request
GET /:coin/wallets/:walletId/addresses
Response
Returns an array of Address object. See Get Wallet Address for the wallet address object.
Get Wallet Address
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/addresses/2N7RYJawMLhhJ79q2ERTrb75MhGgofWXfQx"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"label": "Address 0",
"address": "2N7RYJawMLhhJ79q2ERTrb75MhGgofWXfQx",
"coin": "BTC",
"walletId": "b2993a9eb932437a9b742fa9f5267086",
"balance": "100.1",
"createdTime": 1546833591910640
}
HTTP Request
GET /:coin/wallets/:walletId/addresses/:address
Response
Name | Type(value) | Mandatory | Description |
---|---|---|---|
label | String | M | Address label |
address | String | M | Coin address |
coin | String | M | Coin id |
walletId | String | M | Wallet id |
balance | String | M | Address balance for the coin |
createdTime | Long | M | Time the address was created |
Returns wallet Address object.
Transfers
Create Transfer Request
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/transferRequests/withdraw"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "POST"
-H "Content-Type:application/json"
-d '{"amount":"0.00002","walletPassPhrase":"123456","toAddress":"2MsYKTgDCqy5HqrJxJFo3w9fpG63kGxRwFC"}'
Sample response:
{
"transferRequestId": "4c9c8e67981244f7ad81d7f04402bf41",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"toAddress": "2MsYKTgDCqy5HqrJxJFo3w9fpG63kGxRwFC",
"amount": "0.00002",
"transferState": "IN_PROGRESS",
"approvalsRequired": 0,
"createdTime": 1546862366781588,
"createdBy": "8f1d99de6db74f948e22603bced34386",
"txData": "eyJoZXgiOiIwMTAwMDAwMDAxNzcwOWYwZmQyOWU3NmI3ZjlkMDJmZTBkNzZmNmE2Y2RkZTA2YWZmOWUyMjA5ZjNkZDE3YmVjY2Y1YjQzNDVkMTAxMDAwMDAwMDBmZmZmZmZmZjAyZDAwNzAwMDAwMDAwMDAwMDE3YTkxNDAzM2JhM2FmMDQ3MjQyYWRhZjM4ZmQ2NjYwYTRlMWZkMjE1ZGQ0OWU4N2I0MzYwMDAwMDAwMDAwMDAxN2E5MTQ4OWVhNmI5NmZiZGY3NDkzNzcwNGMyYTIxOTQ0ZWViOTIzNGJjZjE5ODcwMDAwMDAwMCIsInZpbiI6W3siYWRkcmVzcyI6IjJONXBUUE5UZG9mRXhuenpyZDZSNkNlTUJuZVpLV0V4SjRWIiwidHhpZCI6ImQxNDU0MzViY2ZlYzdiZDEzZDlmMjBlMmY5YWYwNmRlY2RhNmY2NzYwZGZlMDI5ZDdmNmJlNzI5ZmRmMDA5NzciLCJ2b3V0IjoxLCJhbW91bnQiOjE2NDQ4LCJyZWRlZW1TY3JpcHQiOiI1MjIxMDM1OGYzYTc0M2IwNTM5MDMzZGFkY2RmNTYxNDhiZGIxZTc4OTAxZmY0OTdkODRiMzE1NjI2MjRkNWZjNGU0YjYxMjEwMzZlM2EyZWU1ZmU1YWY5Y2MzMDExMzEyMDRmYTQ3YThkZTNjN2UyNjkzNjdlYWMxMTI0NmNmMjczNWIwZmNiNzQyMTAzZTU4ZTU2MWFjYzJjYTUyMWY0MGJmNzFjYTVjYzFmZDdiMWFhMzJkNmM3MTlkMjY4YzZmYTAwZWEwNTJhYjk3YjUzYWUiLCJ0YW5rIjpmYWxzZSwic2VxdWVuY2UiOjB9XSwidjEiOm51bGwsInIxIjpudWxsLCJzMSI6bnVsbCwidjIiOm51bGwsInIyIjpudWxsLCJzMiI6bnVsbCwiZnJvbUFkZHJlc3NlcyI6WyIyTjVwVFBOVGRvZkV4bnp6cmQ2UjZDZU1CbmVaS1dFeEo0ViJdLCJ0b0FkZHJlc3MiOiIyTXNZS1RnRENxeTVIcXJKeEpGbzN3OWZwRzYza0d4UndGQyIsImFtb3VudCI6IjAuMDAwMDIiLCJmZWUiOiIwLjAwMDAwNDQ0In0="
}
HTTP Request
POST /:coin/wallets/:walletId/transferRequests/withdraw
Body Parameters
Name | Type(value) | Mandatory | Description |
---|---|---|---|
walletPassphrase | String | M | Wallet pass phrase |
amount | DoubleString | M | The amount to be sent |
toAddress | String | M | The address to send to |
comment | String | O | Notes for the transfer |
Response
Returns the created transfer request object. See Get Transfer Request for the transfer request object.
Send Approved Transfer Request
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/transferRequests/2d234363b53042d494010850f0a7c7fa/withdraw"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "POST"
-H "Content-Type:application/json"
-d '{"walletPassPhrase":"123456"}'
Sample response:
{
"transferRequestId": "4c9c8e67981244f7ad81d7f04402bf41",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"toAddress": "2MsYKTgDCqy5HqrJxJFo3w9fpG63kGxRwFC",
"amount": "0.00002",
"transferState": "IN_PROGRESS",
"approvalsRequired": 0,
"createdTime": 1546862366781588,
"createdBy": "8f1d99de6db74f948e22603bced34386",
"txData": "eyJoZXgiOiIwMTAwMDAwMDAxNzcwOWYwZmQyOWU3NmI3ZjlkMDJmZTBkNzZmNmE2Y2RkZTA2YWZmOWUyMjA5ZjNkZDE3YmVjY2Y1YjQzNDVkMTAxMDAwMDAwMDBmZmZmZmZmZjAyZDAwNzAwMDAwMDAwMDAwMDE3YTkxNDAzM2JhM2FmMDQ3MjQyYWRhZjM4ZmQ2NjYwYTRlMWZkMjE1ZGQ0OWU4N2I0MzYwMDAwMDAwMDAwMDAxN2E5MTQ4OWVhNmI5NmZiZGY3NDkzNzcwNGMyYTIxOTQ0ZWViOTIzNGJjZjE5ODcwMDAwMDAwMCIsInZpbiI6W3siYWRkcmVzcyI6IjJONXBUUE5UZG9mRXhuenpyZDZSNkNlTUJuZVpLV0V4SjRWIiwidHhpZCI6ImQxNDU0MzViY2ZlYzdiZDEzZDlmMjBlMmY5YWYwNmRlY2RhNmY2NzYwZGZlMDI5ZDdmNmJlNzI5ZmRmMDA5NzciLCJ2b3V0IjoxLCJhbW91bnQiOjE2NDQ4LCJyZWRlZW1TY3JpcHQiOiI1MjIxMDM1OGYzYTc0M2IwNTM5MDMzZGFkY2RmNTYxNDhiZGIxZTc4OTAxZmY0OTdkODRiMzE1NjI2MjRkNWZjNGU0YjYxMjEwMzZlM2EyZWU1ZmU1YWY5Y2MzMDExMzEyMDRmYTQ3YThkZTNjN2UyNjkzNjdlYWMxMTI0NmNmMjczNWIwZmNiNzQyMTAzZTU4ZTU2MWFjYzJjYTUyMWY0MGJmNzFjYTVjYzFmZDdiMWFhMzJkNmM3MTlkMjY4YzZmYTAwZWEwNTJhYjk3YjUzYWUiLCJ0YW5rIjpmYWxzZSwic2VxdWVuY2UiOjB9XSwidjEiOm51bGwsInIxIjpudWxsLCJzMSI6bnVsbCwidjIiOm51bGwsInIyIjpudWxsLCJzMiI6bnVsbCwiZnJvbUFkZHJlc3NlcyI6WyIyTjVwVFBOVGRvZkV4bnp6cmQ2UjZDZU1CbmVaS1dFeEo0ViJdLCJ0b0FkZHJlc3MiOiIyTXNZS1RnRENxeTVIcXJKeEpGbzN3OWZwRzYza0d4UndGQyIsImFtb3VudCI6IjAuMDAwMDIiLCJmZWUiOiIwLjAwMDAwNDQ0In0="
}
HTTP Request
POST /:coin/wallets/:walletId/transferRequests/:transferRequestId/withdraw
Body Parameters
Name | Type(value) | Mandatory | Description |
---|---|---|---|
walletPassphrase | String | M | Wallet pass phrase |
Response
Returns the sent transfer request object. See Get Transfer Request for the transfer request object.
Get Transfer Request
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/transferRequests/4c9c8e67981244f7ad81d7f04402bf41"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"transferRequestId": "4c9c8e67981244f7ad81d7f04402bf41",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"toAddress": "2MsYKTgDCqy5HqrJxJFo3w9fpG63kGxRwFC",
"amount": "0.00002",
"transferState": "IN_PROGRESS",
"approvalsRequired": 0,
"createdTime": 1546862366781588,
"createdBy": "8f1d99de6db74f948e22603bced34386",
"txData": "eyJoZXgiOiIwMTAwMDAwMDAxNzcwOWYwZmQyOWU3NmI3ZjlkMDJmZTBkNzZmNmE2Y2RkZTA2YWZmOWUyMjA5ZjNkZDE3YmVjY2Y1YjQzNDVkMTAxMDAwMDAwMDBmZmZmZmZmZjA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:coin/wallets/:walletId/transferRequests/:transferRequestId
Response
Name | Type(value) | Mandatory | Description |
---|---|---|---|
transferRequestId | String | M | Transfer request id |
coin | String | M | Coin Id |
walletId | String | M | Wallet Id |
toAddress | String | M | Send to address |
amount | DoubleString | M | The amount to be sent |
comment | String | O | Notes for the transfer |
transferState | Enum | M | Please refer to transferState in enums |
approvalsRequired | Integer | M | Number of approvals required |
createdTime | Long | M | Created time |
createdBy | String | M | User id that is used to create the transfer request |
apiKey | String | O | Exists if the request is sent through api |
transferId | String | O | Transfer id |
txid | String | O | Txid on blockchain |
Get Pending Approval Transfer Requests
curl "http://localhost:8657/api/BTC/wallets/773988afc53347e48aa9100ac0c24d48/transferRequests?transferState=PENDING_APPROVAL"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"transferRequestResponses": [
{
"transferRequestId": "5b47858edce04ac2a81613c4d349cf37",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"toAddress": "2MsYKTgDCqy5HqrJxJFo3w9fpG63kGxRwFC",
"amount": "0.0003",
"transferState": "PENDING_APPROVAL",
"approvalsRequired": 1,
"createdTime": 1546927220768907,
"createdBy": "8f1d99de6db74f948e22603bced34386",
"txData": "eyJoZXgiOiIwMTAwMDAwMDAxMmViYTQ0N2RjM2Q1NWQ0MDM4MzBmNDQ5MDBmMmJjMWEzNTEzZmExNTU2ZGUxYmE4YjNmOWFlNGUxOGMxMTE1ZDAxMDAwMDAwYjQwMDQ3MzA0NDAyMjAyMzcxOTQ4NzM1YjQ1OWM5ZjkzYWE5ZWM4NWU5ZDBhMGVhZjE1MzRjNTYyMDA5ZDJiNTg0NDM1N2Y1OTdiNWI1MDIyMDM0NDU5YWI1ZjQ0ZjFlNmFkMzI0N2RlYjcwYzM4MjY1MmY1M2Q5NjR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jpmYWxzZSwic2VxdWVuY2UiOjF9XSwianNvbiI6bnVsbCwiYWRkcmVzcyI6bnVsbCwib3V0cHV0cyI6bnVsbCwia2V5SW1hZ2VzIjpudWxsLCJ2MSI6bnVsbCwicjEiOm51bGwsInMxIjpudWxsLCJ2MiI6bnVsbCwicjIiOm51bGwsInMyIjpudWxsfQ=="
}
]
}
HTTP Request
GET /:coin/wallets/:walletId/transferRequests?transferState=PENDING_APPROVAL
Response
Returns an array of Transfer Request Objects with transfer state of PENDING_APPROVAL. See Get Transfer Request for the transfer request object.
Approve Pending Approval
curl "http://localhost:8657/api/pendingApprovals/5b47858edce04ac2a81613c4d349cf37/approve"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "POST"
Sample response:
{
"transferRequestId": "5b47858edce04ac2a81613c4d349cf37",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"toAddress": "2MsYKTgDCqy5HqrJxJFo3w9fpG63kGxRwFC",
"amount": "0.0003",
"transferState": "APPROVED",
"approvalsRequired": 1,
"createdTime": 1546927220768907,
"createdBy": "8f1d99de6db74f948e22603bced34386"
}
Approve transfer request.
HTTP Request
POST /pendingApprovals/:transferRequestId/approve
Response
Returns the transfer request just approved. See Get Transfer Request for the transfer request object.
Reject Pending Approval Transfer Request
curl "http://localhost:8657/api/pendingApprovals/35ec9d4e347745dfbf0e7ccec03679a8/reject"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "POST"
Sample response:
{
"transferRequestId": "35ec9d4e347745dfbf0e7ccec03679a8",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"toAddress": "2MsYKTgDCqy5HqrJxJFo3w9fpG63kGxRwFC",
"amount": "0.0003",
"transferState": "REJECTED",
"approvalsRequired": 1,
"createdTime": 1546939576505091,
"createdBy": "8f1d99de6db74f948e22603bced34386"
}
Reject transfer request.
HTTP Request
POST /pendingApprovals/:transferRequestId/reject
Response
Returns the rejected transfer request. See Get Transfer Request for the transfer request object.
Get Transfer By TransferId
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/transfers/17c7d62781be4e0897ae0641b81d5a61"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"transferId": "17c7d62781be4e0897ae0641b81d5a61",
"transferRequestId": "27c7d62781be4e0897ae0641b81d5a61",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"txid": "68d1b0d7e859695f369ff0650fd1c3ecb05f1a936850766bb89ecf6dfbf96111",
"createdTime": 1546064458756020,
"lastModifiedTime": 1546064458756020,
"confirmations": 1358,
"transferState": "CONFIRMED",
"confirmedTime": 1546064458756001,
"transferType": "SEND",
"amount": "0.001",
"fee": "0.00000444",
"destinationAddress": "2N5pTPNTdofExnzzrd6R6CeMBneZKWExJ4V",
"sourceAddress": "2N5pTPNTdofExnzzrd6R6CeMBneZKWExJ4V"
}
Returns wallet Transfer object.
HTTP Request
GET /:coin/wallets/:walletId/transfers/:transferId
Response
Name | Type(value) | Mandatory | Description |
---|---|---|---|
transferId | String | M | Transfer id |
transferRequestId | String | M | Transfer Request Id |
coin | String | M | Coin id |
walletId | String | M | Wallet id |
txid | String | M | Txid on blockchain |
transferType | String | M | SEND/RECEIVE/FORWARD |
amount | String | M | Withdraw amount |
fee | String | M | Withdraw blockchain fee, will be 0 if it is a deposit transfer |
sourceAddress | String | O | Transfer from Address |
destinationAddress | String | O | Transfer To Address |
confirmations | Integer | M | Number of confirmations |
transferState | Enum | M | Please refer to transferState in enums file |
confirmedTime | Long | M | Time the transfer was confirmed |
createdTime | Long | M | Time the transfer was created |
lastModifiedTime | Long | M | Time the transfer was last updated |
Get Transfer By Txid
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/transfers?txid=68d1b0d7e859695f369ff0650fd1c3ecb05f1a936850766bb89ecf6dfbf96111"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"transferResponses": [
{
"transferId": "17c7d62781be4e0897ae0641b81d5a61",
"transferRequestId": "27c7d62781be4e0897ae0641b81d5a61",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"txid": "68d1b0d7e859695f369ff0650fd1c3ecb05f1a936850766bb89ecf6dfbf96111",
"createdTime": 1546064458756020,
"lastModifiedTime": 1546064458756020,
"confirmations": 1358,
"transferState": "CONFIRMED",
"confirmedTime": 1546064458756001,
"transferType": "SEND",
"amount": "0.001",
"fee": "0.00000444",
"destinationAddress": "2N5pTPNTdofExnzzrd6R6CeMBneZKWExJ4V",
"sourceAddress": "2N5pTPNTdofExnzzrd6R6CeMBneZKWExJ4V"
}
]
}
HTTP Request
GET /:coin/wallets/:walletId/transfers?txid=:txid
Response
Returns an array of Transfer objects. See Get Transfer By TransferId for the Transfer Object.
Get All Transfers
curl "http://localhost:8657/api/BTC/wallets/b2993a9eb932437a9b742fa9f5267086/transfers"
-H "API-KEY: 359c26a316f97e17bf6b17169e6bd816"
-H "API-KEY-PASSPHRASE: Xwings2019"
-H "API-KEY-SECRET: x6NzNCWvCNSNnM/60QxKyRBqR/cl9gVQoDSv3ssn9ZM="
-X "GET"
Sample response:
{
"transferResponses": [
{
"transferId": "17c7d62781be4e0897ae0641b81d5a61",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"txid": "68d1b0d7e859695f369ff0650fd1c3ecb05f1a936850766bb89ecf6dfbf96111",
"createdTime": 1546064458756020,
"lastModifiedTime": 1546064458756020,
"confirmations": 1358,
"transferState": "CONFIRMED",
"confirmedTime": 1546064458756001,
"transferType": "SEND",
"amount": "0.001",
"fee": "0.00000444",
"destinationAddress": "2N5pTPNTdofExnzzrd6R6CeMBneZKWExJ4V",
"sourceAddress": "2N5pTPNTdofExnzzrd6R6CeMBneZKWExJ4V"
},
{
"transferId": "8a52d81790b746c7a1cab2069d44471d",
"coin": "BTC",
"walletId": "773988afc53347e48aa9100ac0c24d48",
"txid": "d145435bcfec7bd13d9f20e2f9af06decda6f6760dfe029d7f6be729fdf00977",
"createdTime": 1546612279000941,
"lastModifiedTime": 1546612279000941,
"confirmations": 420,
"transferState": "CONFIRMED",
"confirmedTime": 1546612279000931,
"transferType": "SEND",
"amount": "0.01",
"fee": "0.00000444",
"destinationAddress": "2N7wgViXpGoVF19cfwEjNyJYTfCda9L7ccT",
"sourceAddress": "2N5pTPNTdofExnzzrd6R6CeMBneZKWExJ4V"
}
]
}
HTTP Request
GET /:coin/wallets/:walletId/transfers
Response
Returns an array of Transfer objects. See Get Transfer By TransferId for the Transfer Object.
Webhook Notifications
Webhooks shall be set up to receive callbacks from DaGuard programmatically. They are attached to wallets and are triggered when an wallet event occurs.
DaGuard will make a POST http request to the URL defined in the webhook with a JSON payload, and expect a HTTP 200 OK. If a successful response is not received, DaGuard will attempt to retry the webhook with an increasing delay between each retry.
Since anyone on the Internet can send HTTP requests to the Webhook URL, the request body payload should not be trusted. Please verify any information sent in the webhook by fetching the transfer/block data from DaGuard before processing the notification.
Developers should take care to ensure that their application succeeds even in the cases of transient network error, or if receive the same webhook twice due to an improper acknowledgement.
WebHook Types
Type | Description |
---|---|
TRANSFER | Activates when a transaction is seen/confirmed on block chain |
PENDING_APPROVAL | Activates when a pending approval on the user's wallet is created, approved, or rejected |
BLOCK | Activates when a block generated by a blockchain |
Transfer Webhook
DaGuard will look over digital coin block chain, when DaGuard detected a transactions, DaGuard will give a callback according to your webhook configuration.
Transfer Webhook Object
Name | Type(value) | Mandatory | Description |
---|---|---|---|
walletId | String | M | ID of the wallet associated with the webhook event, if this is a wallet webhook |
transferId | String | M | Transfer Id, a DaGuard generated id of the transfer. This can be used to lookup more details about the transaction. |
txid | String | M | Txid, a Blockchain generated hash of the transaction. This can be used to lookup more details about the transaction on the blockchain. |
coin | String | M | Crypto Currency or Ethereum Token |
type | String | M | Type of Webhook(Can be transfer, pendingapproval) |
numConfirmations | String | O | Number of blockchain confirmations |
state | String | M | State of transfer. |
transferRequestId | String | O | Id of withdrawal transfer. |
webHookSequenceNum | String | M | Number of transfer hook. |
Pending Approval Webhook
DaGuard will send Pending Approval Webhook when transfer requests were approved or rejected, also DaGuard will send email to tell you status changes.
Pending Approval Webhook Object
Name | Type(value) | Mandatory | Description |
---|---|---|---|
walletId | String | M | ID of the wallet associated with the webhook event, if this is a wallet webhook |
transferRequestId | String | M | Transfer Request Id, Transfer Request ID, a DaGuard generated id of the transfer Request. This can be used to lookup more details about the transfer request. |
coin | String | M | Crypto Currency or Ethereum Token |
type | String | M | Type of Webhook(Can be transfer, pendingapproval) |
state | String | M | APPROVED/REJECTED |
Block Webhook
DaGuard will send Block Webhook when a new block is generated.
Block Webhook Object
Name | Type(value) | Mandatory | Description |
---|---|---|---|
coin | String | M | Crypto Currency |
type | String | M | Type of Webhook(should be BLOCK) |
blockHeight | Long | M | The latest block number |
walletId | String | M | Wallet Id generated by DaGuard |
Sample webhook:
{
"coin": "ETH",
"type": "BLOCK",
"blockHeight": 5323515,
"walletId": "af48fed6897a4ca4a7422c4e5d6044fa"
}
Enums
Transfer State
Transfer State | Description |
---|---|
PENDING_APPROVAL | Transfer request is in pending subject to approval |
APPROVED | Transfer request has not been approved |
IN_PROGRESS | Transfer request is in progress |
UNCONFIRMED | Transfer has not been confirmed |
CONFIRMED | Transfer has been confirmed |
REJECTED | Transfer request is rejected |
FAILED | Transfer request is failed |
Transfer Type
Transfer Type | Description |
---|---|
SEND | A withdrawal transfer |
RECEIVE | A deposit transfer from blockchain |
FORWARD | A forward transfer from account address to main address, triggered by DaGuard |
Release Notes
Release Notes for DaGuard 0.0.2
Introduce Http Status to API responses.
Http Status 200
Client will get a success response as this document.
Error Responses
Error Code | Http Status | Description |
---|---|---|
INTERNAL_SERVER_ERROR | 500 | Internal server error |
INVALID_EMAIL_FORMAT | 400 | Invalid email format |
BAD_PASSWORD | 400 | Password doesn't meet requirement |
INVALID_CONTACT_NUMBER | 400 | Invalid contact phone number |
INVALID_AUTHENTICATION | 401 | Invalid username or password |
ORGANIZATION_IS_EXISTED | 400 | The organization name has been registered |
USER_EAMIL_IN_USE | 400 | The email has been registered |
USER_USERNAME_IN_USE | 400 | The username has been registered |
USER_NOT_FOUND | 400 | Invalid account |
USER_NOT_ACTIVATED | 400 | The account has been registered but activated |
USER_DISABLED | 400 | The account is disabled |
APIKEY_NICKNAME_EXISTED | 400 | Apikey nickname has exsited |
APIKEY_NOT_FOUND | 400 | Invalid apikey |
USER_WALLET_NOT_FOUND | 400 | Wallet not found under the account |
APIKEY_EXCEED_USER_WALLET_ACCESS_LEVEL | 400 | Apikey access level to wallet beyond user access level |
APIKEY_WALLET_EMPTY | 400 | Apikey creation should contain at least one wallet |
APIKEY_DISABLED | 400 | Apikey is disabled |
USER_IS_ACTIVATED | 400 | The account has already been activated |
INVALID_TRANSFER_REQUEST_ID | 400 | Could not find any transferRequest according to conditions |
TRANSFER_ALREADY_PROCESSED | 400 | The approval of transferRequest has already approved or rejected |
TRANSACTION_ALREADY_PROGRESSED | 400 | The transaction is progressing. |
INVALID_WALLET_PASSPHRASE | 400 | Wallet passphrase mismatch |
INVALID_AMOUNT | 400 | Wallet transferRequest amount Need to be numeric |
WALLET_NOT_FOUND | 400 | Could not find any available wallet |
INVALID_WALLET_ADDRESS | 400 | Illegal address for coin wallet |
INVALID_COIN | 400 | Illegal coin for wallet service |
TRANSFER_NOT_FOUND | 400 | Could not find any transfer according to conditions |
INVALID_PUBLIC_KEY | 400 | Illegal public key for coin wallet |
WALLET_EXIST | 400 | The wallet has already been created |
### Client retry with Http Status
Http Status | retry | Description |
---|---|---|
400 | false | Bad Request |
401 | false | Unauthorized |
429 | true | Too Many Requests |
500 | false | Internal server Error |
503 | true | Services not available |