Skip to content

Method: transfers/create-signed

POST /transfers/createTransfer
( https://services-api.dcore.io/blockchain/transfers/create-signed )


This endpoint, is a 'convenience' method that takes both the transfer details and your private key with which it generates, and returns, a signed transfer object which you can then submit to the blockchain using transfers/submitTransfer. This is ideal to get a quick feel for the API's utility during initial development but not recommended for production since it involves exposing your private key.

If you do not wish to expose your private key, it will be necesary to sign the transfer object yourself before submitting it to


Query Parameters

Name Description Type
blockchain
required
Which blockchain to use.
Values: "Bitcoin", "Ethereum", "DCore".
string

Request Headers

1
2
3
accept: application/json
x-api-key: <your-api-key>
Content-Type: application/json

Request Body

Required

Schema Type: application/json

The request body consists of a transfer object packaged with the Private Key that is to be used to sign it.

Schema Body: createTransaction.body

Example request Body

Example request body (common to all blockchains)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
    {
        "transfer": {
          "amount": {
              "value": 0,
              "token": "DCT"
          },
          "from": "string",
          "to": "string"
        },
        "key": "string"
    }

Responses for transfers/create-signed

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

200

Content Type: application/json

The structure of the response will be determined by the value of the blockchain query parameter:

  • blockchain="Bitcoin"btc.transactionSigned object.

    Bitcoin: Example response body
     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
      {
        "transactionSigned": {
          "block_height": 0,
          "block_index": 0,
          "hash": "string",
          "addresses": [
            "string"
          ],
          "total": 0,
          "fees": 0,
          "size": 0,
          "preference": "string",
          "relayed_by": "string",
          "received": "string",
          "ver": 0,
          "double_spend": true,
          "vin_sz": 0,
          "vout_sz": 0,
          "confirmations": 0,
          "inputs": [
            {
              "prev_hash": "string",
              "output_index": 0,
              "output_value": 0,
              "sequence": 0,
              "addresses": [
                "string"
              ],
              "script_type": "string",
              "age": 0
            }
          ],
          "outputs": [
            {
              "value": 0,
              "script": "string",
              "addresses": [
                "string"
              ],
              "script_type": "string"
            }
          ],
          "tosign": [
            "string"
          ],
          "signatures": [
            "string"
          ],
          "pubkeys": [
            "string"
          ]
        }
      }
    
  • blockchain="Ethereum"eth.transactionSigned object.

    Ethereum: Example response body
     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": 0,
          "block_index": 0,
          "hash": "string",
          "addresses": [
            "string"
          ],
          "total": 0,
          "fees": 0,
          "size": 0,
          "gas_limit": 0,
          "gas_price": 0,
          "received": "string",
          "ver": 0,
          "double_spend": true,
          "vin_sz": 0,
          "vout_sz": 0,
          "inputs": [
            {
              "sequence": 0,
              "addresses": [
                "string"
              ]
            }
          ],
          "outputs": [
            {
              "value": 0,
              "addresses": [
                "string"
              ]
            }
          ],
          "tosign": [
            "string"
          ],
          "signatures": [
            "string"
          ]
        }
      }
    
    DCore: Example response body
     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
      {
        "transactionSigned": {
          "operations": [
            {
              "extensions": [
                "string"
              ],
              "type": 0,
              "from": "string",
              "to": "string",
              "amount": {
                "amount": 0,
                "assetId": "string"
              },
              "fee": {
                "amount": 0,
                "assetId": "string"
              }
            }
          ],
          "blockData": {
            "expiration": "string",
            "refBlockNum": 0,
            "refBlockPrefix": {
              "low": 0,
              "high": 0,
              "unsigned": true
            }
          },
          "signatures": [
            "string"
          ]
        }
      }
    

Using un-escaped responses in CLI cURL calls will probably result in unexpected results.

The returned object is suitable for submission to the blockchain through transfers/submitTransfer but special care needs to be made if doing so using cURL from the command line.

Please read cURL Limitations when POSTing JSON Bodies.

If the response is captured into a file, then this can be submitted to cURL , un-escaped, by replacing the -d <escaped-json-string> with -d @filename. See Using cURL with the Examples for more information.

Error

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

Examples

Examples of using the transfers/create-signed endpoint method can be found here.


  1. The blockchains supported are Bitcoin (BTC) Ethereum (ETH) and DCore (DCT)