Skip to content

Examples: transfers/create-signed

The following examples illustrate how the transfers/create-signed endpoint can be used for each of the three supported blockchains (BTC, ETH, DCT). They take the form of command line instructions that use the cURL tool to handle communications with the API.

Read this before using these Examples

Before using the examples please ensure you read Using the Endpoint Examples which will describe how the examples are organised together with some of the potential pitfalls and limitations that you should bear in mind.

Most notable of these potential issues are:

  • In all of these examples, you will need to substitute the x-api-key header value (denoted with the string, <your-api-key>) with your own API Key.

    See Obtaining an API Key for information on obtaining an API Key.

  • In some cases you will also have to ensure that the address fields are also correctly populated.

  • While a good tool for simple examples, cURL , as a command line tool has some limitations that you must be aware of, most notably requirements for command line quoting of JSON data being sent via the -d option.


Using the transfers/create-signed endpoint.

The following examples can be used as the basis for coding your own signed transaction object in the language of your choice.

More detailed information on the parameters and return objects can be found on transfers/create-signed

Example. Create Signed Bitcoin Transfer

curl -X POST "https://services-api.dcore.io/blockchain/transfers/create-signed?blockchain=Bitcoin" -H "accept: application/json" -H "x-api-key: <your-api-key>" -H "Content-Type: application/json" -d "{\"transfer\":{\"amount\":{\"value\":1,\"token\":\"BTC\"},\"from\":\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\",\"to\":\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"},\"key\":\"8a84a68861136993f69a2cd7d7066b6f88f90dcd7af5444c8710736c1a2ee545\"}"
1
2
3
4
5
6
curl -X POST
    "https://services-api.dcore.io/blockchain/transfers/create-signed?blockchain=Bitcoin"
    -H "accept: application/json"
    -H "x-api-key: <your-api-key>"
    -H "Content-Type: application/json"
    -d "{\"transfer\":{\"amount\":{\"value\":1,\"token\":\"BTC\"},\"from\":\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\",\"to\":\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"},\"key\":\"8a84a68861136993f69a2cd7d7066b6f88f90dcd7af5444c8710736c1a2ee545\"}"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "transactionSigned": {
    "extensions": [],
    "operations": [
      [
        39,
        {
          "extensions": [],
          "from": "1.2.15215",
          "to": "1.2.15215",
          "amount": {
            "amount": "1",
            "asset_id": "1.3.0"
          },
          "fee": {
            "amount": "100000",
            "asset_id": "1.3.0"
          }
        }
      ]
    ],
    "signatures": [
      "20755cb01298bd449e10092c24a55cb01e582259c32ce2c0a88a1fb2952389e90f027277fc298c89e184c724fedec6c30ebd938ebcf7f781ebd8dbef0d891eedf1"
    ],
    "expiration": "2019-05-31T12:02:11",
    "ref_block_num": 6708,
    "ref_block_prefix": 1302126469
  }
}
1
2
3
accept: application/json
x-api-key: <your-api-key>
Content-Type: application/json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "transfer": {
      "amount": {
          "value": 1,
          "token": "BTC"
      },
      "from": "CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw",
      "to": "CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw"
  },
  "key":"8a84a68861136993f69a2cd7d7066b6f88f90dcd7af5444c8710736c1a2ee545"
}

Example. Create Signed Ethereum Transfer

curl -X POST "https://services-api.dcore.io/blockchain/transfers/create-signed?blockchain=Ethereum" -H "accept: application/json" -H "x-api-key: <your-api-key>" -H "Content-Type: application/json" -d "{\"transfer\":{\"amount\":{\"value\":1,\"token\":\"ETH\"},\"from\":\"cf814a81c4518debdf6a093632d4de023fc29b45\",\"to\":\"de5aef5c97042fb8725554b05cde1c1fcf5614a5\"},\"key\":\"8a84a68861136993f69a2cd7d7066b6f88f90dcd7af5444c8710736c1a2ee545\"}"
1
2
3
4
5
6
curl -X POST
    "https://services-api.dcore.io/blockchain/transfers/create-signed?blockchain=Ethereum"
    -H "accept: application/json"
    -H "x-api-key: <your-api-key>"
    -H "Content-Type: application/json"
    -d "{\"transfer\":{\"amount\":{\"value\":1,\"token\":\"ETH\"},\"from\":\"cf814a81c4518debdf6a093632d4de023fc29b45\",\"to\":\"de5aef5c97042fb8725554b05cde1c1fcf5614a5\"},\"key\":\"8a84a68861136993f69a2cd7d7066b6f88f90dcd7af5444c8710736c1a2ee545\"}"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "transactionSigned": {
    "extensions": [],
    "operations": [
      [
        39,
        {
          "extensions": [],
          "from": "1.2.15215",
          "to": "1.2.15215",
          "amount": {
            "amount": "1",
            "asset_id": "1.3.0"
          },
          "fee": {
            "amount": "100000",
            "asset_id": "1.3.0"
          }
        }
      ]
    ],
    "signatures": [
      "20755cb01298bd449e10092c24a55cb01e582259c32ce2c0a88a1fb2952389e90f027277fc298c89e184c724fedec6c30ebd938ebcf7f781ebd8dbef0d891eedf1"
    ],
    "expiration": "2019-05-31T12:02:11",
    "ref_block_num": 6708,
    "ref_block_prefix": 1302126469
  }
}
1
2
3
accept: application/json
x-api-key: <your-api-key>
Content-Type: application/json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "transfer":{
      "amount": {
          "value": 1,
          "token": "ETH"
      },
      "from": "cf814a81c4518debdf6a093632d4de023fc29b45",
      "to": "de5aef5c97042fb8725554b05cde1c1fcf5614a5"
  },
  "key": "8a84a68861136993f69a2cd7d7066b6f88f90dcd7af5444c8710736c1a2ee545"
}

Example. Create Signed DCore Transfer

curl -X POST "https://services-api.dcore.io/blockchain/transfers/create-signed?blockchain=DCore" -H "accept: application/json" -H "x-api-key: <your-api-key>" -H "Content-Type: application/json" -d "{\"transfer\":{\"amount\":{\"value\":1,\"token\":\"DCT\"},\"from\":\"my-new-test-account\",\"to\":\"my-new-test-account\"},\"key\":\"5KcutRMa9YiqwMTbj5LtNBjHQYTSh7JQ889RGvRDrJkstnkYFR8\"}"
1
2
3
4
5
6
curl -X POST
    "https://services-api.dcore.io/blockchain/transfers/create-signed?blockchain=DCore"
    -H "accept: application/json"
    -H "x-api-key: <your-api-key>"
    -H "Content-Type: application/json"
    -d "{\"transfer\":{\"amount\":{\"value\":1,\"token\":\"DCT\"},\"from\":\"my-new-test-account\",\"to\":\"my-new-test-account\"},\"key\":\"5KcutRMa9YiqwMTbj5LtNBjHQYTSh7JQ889RGvRDrJkstnkYFR8\"}"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "transactionSigned": {
    "extensions": [],
    "operations": [
      [
        39,
        {
          "extensions": [],
          "from": "1.2.15215",
          "to": "1.2.15215",
          "amount": {
            "amount": "1",
            "asset_id": "1.3.0"
          },
          "fee": {
            "amount": "100000",
            "asset_id": "1.3.0"
          }
        }
      ]
    ],
    "signatures": [
      "20755cb01298bd449e10092c24a55cb01e582259c32ce2c0a88a1fb2952389e90f027277fc298c89e184c724fedec6c30ebd938ebcf7f781ebd8dbef0d891eedf1"
    ],
    "expiration": "2019-05-31T12:02:11",
    "ref_block_num": 6708,
    "ref_block_prefix": 1302126469
  }
}
1
2
3
accept: application/json
x-api-key: <your-api-key>
Content-Type: application/json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "transfer": {
    "amount": {
      "value": 1,
      "token": "DCT"
    },
    "from": "my-new-test-account",
    "to": "my-new-test-account"
  },
  "key": "5KcutRMa9YiqwMTbj5LtNBjHQYTSh7JQ889RGvRDrJkstnkYFR8"
}

Response Codes for transfers/create-signed

The following response codes could be returned following a call to the transfers/create-signed endpoint.

Click the description for more detailed information on why the error was raised, and potential fixes.

Success

  • 200 - Successful operation.