Prepare Transaction From Address

Through this endpoint customers can prepare a transaction from an address with private and public keys. The address doesn’t have to belong to a wallet. The response will include the transaction fee in Wei.

Single Result - This endpoint returns only one single result. POST /blockchain-data/{blockchain}/{network}/transactions/prepare-from-address

Path Parameters

  • Required
    blockchain string

    Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

    Example : ethereum
    Possible Values : binance-smart-chain ethereum ethereum-classic
  • Required
    network string

    Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while networks like "testnet", "goerli" are test networks.

    Example : goerli
    Possible Values : testnet goerli mordor mainnet

Query parameters

  • Optional
    context string

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

    Example : yourExampleString

Request body schema application/json

  • Optional
    context string

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

    Example : yourExampleString
  • Required
    data object
    • Required
      item object
      • Optional
        additionalData string

        Represents an optional note to add a free text in, explaining or providing additional detail on the transaction request.

        Example : yourAdditionalStriingHere
      • Required
        amount string

        Representation of the transacted amount

        Example : 2000000009340
      • Optional
        nonce string

        Represents the sequential running number for an address, starting from 0 for the first transaction. E.g., if the nonce of a transaction is 10, it would be the 11th transaction sent from the sender's address.

        Example : 0
      • Required
        recipient string

        The address which receives this transaction. In UTXO-based protocols like Bitcoin there could be several senders while in account-based protocols like Ethereum there is always only one recipient.

        Example : 0x0902a667d6a3f287835e0a4593cae4167384abc6
      • Required
        sender string

        Represents the address which sends this transaction. In UTXO-based protocols like Bitcoin there could be several senders while in account-based protocols like Ethereum there is always only one sender.

        Example : 0x1d107b75353229768dff96051262ce0088a3e26b
      • Required
        fee object

        Defines the amount of the transaction fee.

        • Optional
          exactAmount string

          String representation of the exact amount

          Example : 0.00045
        • Required
          priority string

          Enum representation of the fee priority

          Example : standard
          Possible Values : slow standard fast
        • Optional
          substractFromAmount boolean

          Representation of the subtract from amount whether it is "true", or "false".

          Example : True
      • Optional
        transactionType string

        Representation of the transaction type. For Ethereum-Classic and Binance Smart Chain there is no need to provide "transactionType" in the request.

        Default : gas-fee-market-transaction
        Example : access-list-transaction
        Possible Values : legacy-transaction access-list-transaction gas-fee-market-transaction

Response schema

201 400 401 402 403 409 415 422 429 500
HTTP Status Code: 201
Content-Type: application/json

The resource has been successfully submitted.

  • Object :

  • Required
    apiVersion string

    Specifies the version of the API that incorporates this endpoint.

    Example : 2021-03-20
  • Required
    requestId string

    Defines the ID of the request. The requestId is generated by Crypto APIs and it's unique for every request.

    Example : 601c1710034ed6d407996b30
  • Optional
    context string

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

    Example : yourExampleString
  • Required
    data object
    • Required
      item object
      • Required
        amount string

        Representation of the transacted amount

        Example : 2000000009340
      • Optional
        dataHex string

        Representation of the data in hex value

        Example : 0x006e0065006b006100760073007400720069006e0067
      • Optional
        nonce string

        Represents the sequential running number for an address, starting from 0 for the first transaction. E.g., if the nonce of a transaction is 10, it would be the 11th transaction sent from the sender's address.

        Example : 0
      • Required
        recipient string

        The address which receives this transaction. In UTXO-based protocols like Bitcoin there could be several senders while in account-based protocols like Ethereum there is always only one recipient.

        Example : 0x041c594a0cc194e826bef5411b29c7f27001b7e3
      • Required
        sender string

        Represents the address which sends this transaction. In UTXO-based protocols like Bitcoin there could be several senders while in account-based protocols like Ethereum there is always only one sender.

        Example : 0x03654A9E78771442CAdf8DB37ae60D6a12bAEa9f
      • Required
        sighash string

        Representation of the hash that should be signed

        Example : 9f59f25bc9f6cbff293ceee32c1fb25ae82fab23a99b860e26cad800ceadd123
      • Required
        blockchainSpecific object One Of
        object
        • Required
          fee object

          Defines the amount of the transaction fee.

          • Required
            gasLimit string

            Represents the amount of gas used by this specific transaction alone.

            Example : 21220
          • Required
            gasPrice string

            Represents the price offered to the miner to purchase this amount of gas.

            Example : 47125353
        • Required
          transactionType string

          Representation of the transaction type

          Example : legacy-transaction
          Possible Values : legacy-transaction
        • Required
          unit string

          Represents the unit of the amount transacted

          Example : BNB

Credits Cost : 5000 Credits For 1 Result(s)

Try it out

Request Example

POST
https://rest.cryptoapis.io/blockchain-data/ethereum/goerli/transactions/prepare-from-address?context=yourExampleString
Headers
Content-Type: application/json
X-API-Key: my-api-key

Request Body
{
    "context": "yourExampleString",
    "data": {
        "item": {
            "additionalData": "yourAdditionalStriingHere",
            "amount": "2000000009340",
            "nonce": "0",
            "recipient": "0x0902a667d6a3f287835e0a4593cae4167384abc6",
            "sender": "0x1d107b75353229768dff96051262ce0088a3e26b",
            "fee": {
                "exactAmount": "0.00045",
                "priority": "standard",
                "substractFromAmount": true
            },
            "transactionType": "access-list-transaction"
        }
    }
}

Response Example

{
    "apiVersion": "2021-03-20",
    "requestId": "601c1710034ed6d407996b30",
    "context": "yourExampleString",
    "data": {
        "item": {
            "amount": "2000000009340",
            "dataHex": "0x006e0065006b006100760073007400720069006e0067",
            "nonce": "0",
            "recipient": "0x041c594a0cc194e826bef5411b29c7f27001b7e3",
            "sender": "0x03654A9E78771442CAdf8DB37ae60D6a12bAEa9f",
            "sighash": "9f59f25bc9f6cbff293ceee32c1fb25ae82fab23a99b860e26cad800ceadd123",
            "blockchainSpecific": {
                "fee": {
                    "gasLimit": "21220",
                    "gasPrice": "47125353"
                },
                "transactionType": "legacy-transaction",
                "unit": "BNB"
            }
        }
    }
}