Skip to content

Examples: transfers/submitTransfer

The following examples illustrate how the transfers/submitTransfer 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/submitTransfer endpoint.

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

A warning about using your own data

Be careful when substituting your own JSON payloads since they must be appropriately escaped for the CLI environment you are using. Not doing so will lead to unexpected results, errors and frustration.

Many problems can be avoided by submitting the POST payload to the cURL command through a file. As a bonus, this also makes using the output of transfers/create-signed](/endpoints/transfers/transfers_create-signed/#method_transferscreate-signed) much simpler.

Please read Using cURL with the Examples, and your system's documentation for more information.

More detailed information on the parameters and return objects can be found in transfers/submitTransfer

Example. Submit Bitcoin Transfer

curl -X POST "https://stage-services-api.dcore.io/blockchain/transfers/submit?blockchain=Bitcoin" -H "accept: application/json" -H "x-api-key: axVx5y5YF123h9cSRSLv8zD9jXGTPQh2vdUruS3a" -H "Content-Type: application/json" -d "{\"transactionSigned\":{\"block_height\":-1,\"block_index\":-1,\"hash\":\"0e07713ef8cb0e2e2880ccc4268046aaf4c52be8782e32f4a68ee3532f5cdf4a\",\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"total\":54600,\"fees\":45400,\"size\":119,\"preference\":\"high\",\"relayed_by\":\"34.254.113.211\",\"received\":\"2019-05-31T12:10:13.425988769Z\",\"ver\":1,\"double_spend\":false,\"vin_sz\":1,\"vout_sz\":2,\"confirmations\":0,\"inputs\":[{\"prev_hash\":\"80a66f9c1dc4bc36bba6f374d611d603cd740247e74d5117d1e9fb1f84d8a8f8\",\"output_index\":0,\"output_value\":100000,\"sequence\":4294967295,\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"script_type\":\"pay-to-pubkey-hash\",\"age\":2360248}],\"outputs\":[{\"value\":10,\"script\":\"76a914e5182bd696dd504f7a75c84123827f7af897a93e88ac\",\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"script_type\":\"pay-to-pubkey-hash\"},{\"value\":54590,\"script\":\"76a914e5182bd696dd504f7a75c84123827f7af897a93e88ac\",\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"script_type\":\"pay-to-pubkey-hash\"}],\"tosign\":[\"759a76fa504838845b1d39bcbf83037b523e96afa937ea9f2d8c2c8291397fae\"],\"signatures\":[\"3045022100a30feea7c9975726c2558f961df3c2c517eedac983e29ba6d5042369a35f1a15022007ca790a0fa79828cda61fc326f6445dbfe70f4c5826c109ee8fd3f92c51b0b3\"],\"pubkeys\":[\"0249201a3beeb29b430b62c6a88243d5d7cd28eb9fd628f8badc509bedf11de9d7\"]}}"
1
2
3
4
5
6
curl -X POST
    "https://stage-services-api.dcore.io/blockchain/transfers/submit?blockchain=Bitcoin"
    -H "accept: application/json"
    -H "x-api-key: axVx5y5YF123h9cSRSLv8zD9jXGTPQh2vdUruS3a"
    -H "Content-Type: application/json"
    -d "{\"transactionSigned\":{\"block_height\":-1,\"block_index\":-1,\"hash\":\"0e07713ef8cb0e2e2880ccc4268046aaf4c52be8782e32f4a68ee3532f5cdf4a\",\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"total\":54600,\"fees\":45400,\"size\":119,\"preference\":\"high\",\"relayed_by\":\"34.254.113.211\",\"received\":\"2019-05-31T12:10:13.425988769Z\",\"ver\":1,\"double_spend\":false,\"vin_sz\":1,\"vout_sz\":2,\"confirmations\":0,\"inputs\":[{\"prev_hash\":\"80a66f9c1dc4bc36bba6f374d611d603cd740247e74d5117d1e9fb1f84d8a8f8\",\"output_index\":0,\"output_value\":100000,\"sequence\":4294967295,\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"script_type\":\"pay-to-pubkey-hash\",\"age\":2360248}],\"outputs\":[{\"value\":10,\"script\":\"76a914e5182bd696dd504f7a75c84123827f7af897a93e88ac\",\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"script_type\":\"pay-to-pubkey-hash\"},{\"value\":54590,\"script\":\"76a914e5182bd696dd504f7a75c84123827f7af897a93e88ac\",\"addresses\":[\"CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw\"],\"script_type\":\"pay-to-pubkey-hash\"}],\"tosign\":[\"759a76fa504838845b1d39bcbf83037b523e96afa937ea9f2d8c2c8291397fae\"],\"signatures\":[\"3045022100a30feea7c9975726c2558f961df3c2c517eedac983e29ba6d5042369a35f1a15022007ca790a0fa79828cda61fc326f6445dbfe70f4c5826c109ee8fd3f92c51b0b3\"],\"pubkeys\":[\"0249201a3beeb29b430b62c6a88243d5d7cd28eb9fd628f8badc509bedf11de9d7\"]}}"
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
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
  "transactionSigned": {
    "block_height": -1,
    "block_index": -1,
    "hash": "0e07713ef8cb0e2e2880ccc4268046aaf4c52be8782e32f4a68ee3532f5cdf4a",
    "addresses": [
      "CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw"
    ],
    "total": 54600,
    "fees": 45400,
    "size": 119,
    "preference": "high",
    "relayed_by": "34.254.113.211",
    "received": "2019-05-31T12:10:13.425988769Z",
    "ver": 1,
    "double_spend": false,
    "vin_sz": 1,
    "vout_sz": 2,
    "confirmations": 0,
    "inputs":
    [
      {
        "prev_hash": "80a66f9c1dc4bc36bba6f374d611d603cd740247e74d5117d1e9fb1f84d8a8f8",
        "output_index": 0,
        "output_value": 100000,
        "sequence": 4294967295,
        "addresses":
        [
          "CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw"
        ],
        "script_type": "pay-to-pubkey-hash",
        "age": 2360248
      }
    ],
    "outputs": 
    [
      {
        "value": 10,
        "script": "76a914e5182bd696dd504f7a75c84123827f7af897a93e88ac",
        "addresses": 
        [
          "CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw"
        ], 
        "script_type": "pay-to-pubkey-hash"
      },
      {
        "value": 54590,
        "script": "76a914e5182bd696dd504f7a75c84123827f7af897a93e88ac",
        "addresses": 
        [
          "CE1dHJtbe25uLNwpyiJBz4WwmRaL3oAMuw"
        ],
        "script_type": "pay-to-pubkey-hash"
      }
    ],
    "tosign": 
    [
      "759a76fa504838845b1d39bcbf83037b523e96afa937ea9f2d8c2c8291397fae"
    ],
    "signatures":
    [   "3045022100a30feea7c9975726c2558f961df3c2c517eedac983e29ba6d5042369a35f1a15022007ca790a0fa79828cda61fc326f6445dbfe70f4c5826c109ee8fd3f92c51b0b3"
    ],
    "pubkeys": 
    [
      "0249201a3beeb29b430b62c6a88243d5d7cd28eb9fd628f8badc509bedf11de9d7"
    ]
  }
}

Example. Submit Ethereum Transfer

curl -X POST "https://stage-services-api.dcore.io/blockchain/transfers/submit?blockchain=Ethereum" -H "accept: application/json" -H "x-api-key: axVx5y5YF123h9cSRSLv8zD9jXGTPQh2vdUruS3a" -H "Content-Type: application/json" -d "{\"transactionSigned\":{\"block_height\":-1,\"block_index\":0,\"hash\":\"08b3e6006e9000b9ee6465365e212a57a7fd209b5957284ee4d768393f570c7d\",\"addresses\":[\"cf814a81c4518debdf6a093632d4de023fc29b45\"],\"total\":10,\"fees\":126000000000000,\"size\":37,\"gas_limit\":21000,\"gas_price\":6000000000,\"received\":\"2019-05-31T12:11:56.756017439Z\",\"ver\":0,\"double_spend\":false,\"vin_sz\":1,\"vout_sz\":1,\"inputs\":[{\"sequence\":16,\"addresses\":[\"cf814a81c4518debdf6a093632d4de023fc29b45\"]}],\"outputs\":[{\"value\":10,\"addresses\":[\"cf814a81c4518debdf6a093632d4de023fc29b45\"]}],\"tosign\":[\"68b1eab6aa71475a72527eab35fb5bd26032426cc8f95262dfdcb057146e6cb4\"],\"signatures\":[\"3045022100eeb491fcc2f9d03ed7653d7846eefdd842d13a4df8b81011ad96d7f61b8f1e060220401fe34bd114192340ead999a0c45fb4dde6e9ceb7ff4b2ea065dba310e51d0b\"]}}"
1
2
3
4
5
6
7
curl -X POST

    "https://stage-services-api.dcore.io/blockchain/transfers/submit?blockchain=Ethereum"
    -H "accept: application/json"
    -H "x-api-key: axVx5y5YF123h9cSRSLv8zD9jXGTPQh2vdUruS3a"
    -H "Content-Type: application/json"
    -d "{\"transactionSigned\":{\"block_height\":-1,\"block_index\":0,\"hash\":\"08b3e6006e9000b9ee6465365e212a57a7fd209b5957284ee4d768393f570c7d\",\"addresses\":[\"cf814a81c4518debdf6a093632d4de023fc29b45\"],\"total\":10,\"fees\":126000000000000,\"size\":37,\"gas_limit\":21000,\"gas_price\":6000000000,\"received\":\"2019-05-31T12:11:56.756017439Z\",\"ver\":0,\"double_spend\":false,\"vin_sz\":1,\"vout_sz\":1,\"inputs\":[{\"sequence\":16,\"addresses\":[\"cf814a81c4518debdf6a093632d4de023fc29b45\"]}],\"outputs\":[{\"value\":10,\"addresses\":[\"cf814a81c4518debdf6a093632d4de023fc29b45\"]}],\"tosign\":[\"68b1eab6aa71475a72527eab35fb5bd26032426cc8f95262dfdcb057146e6cb4\"],\"signatures\":[\"3045022100eeb491fcc2f9d03ed7653d7846eefdd842d13a4df8b81011ad96d7f61b8f1e060220401fe34bd114192340ead999a0c45fb4dde6e9ceb7ff4b2ea065dba310e51d0b\"]}}"
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
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
    "transactionSigned": {
        "block_height": -1,
        "block_index": 0,
        "hash": "08b3e6006e9000b9ee6465365e212a57a7fd209b5957284ee4d768393f570c7d",
        "addresses": [
            "cf814a81c4518debdf6a093632d4de023fc29b45"
        ],
        "total": 10,
        "fees": 126000000000000,
        "size": 37,
        "gas_limit": 21000,
        "gas_price": 6000000000,
        "received": "2019-05-31T12:11:56.756017439Z",
        "ver": 0,
        "double_spend": false,
        "vin_sz": 1,
        "vout_sz": 1,
        "inputs": [
            {
                "sequence": 16,
                "addresses": [
                    "cf814a81c4518debdf6a093632d4de023fc29b45"
                ]
            }
        ],
        "outputs": [
            {
                "value": 10,
                "addresses": [
                    "cf814a81c4518debdf6a093632d4de023fc29b45"
                ]
            }
        ],
        "tosign": [
            "68b1eab6aa71475a72527eab35fb5bd26032426cc8f95262dfdcb057146e6cb4"
        ],
        "signatures": [
            "3045022100eeb491fcc2f9d03ed7653d7846eefdd842d13a4df8b81011ad96d7f61b8f1e060220401fe34bd114192340ead999a0c45fb4dde6e9ceb7ff4b2ea065dba310e51d0b"
        ]
    }
}

Example. Submit DCore Transfer

curl -X POST "https://services-api.dcore.io/blockchain/transfers/submit?blockchain=DCore" -H "accept: application/json" -H "x-api-key: <your-api-key>" -H "Content-Type: application/json" -d "{\"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
4
5
6
curl -X POST
    "https://services-api.dcore.io/blockchain/transfers/submit?blockchain=DCore"
    -H "accept: application/json"
    -H "x-api-key: <your-api-key>"
    -H "Content-Type: application/json"
    -d "{\"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
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
    }
}

Response for all Blockchains

1
2
3
{
  "txHash": "77757afad62acc3a823ed3a4629d76c0e3b8772770df6a20ff816e5b2b69228f"
}

Response Codes for transfers/submitTransfer

The following response codes could be returned following a call to the transfers/submitTransfer endpoint.

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

Success

  • 200 - Successful operation.