Prepare An Account-Based Transaction From HD Wallet (xPub, yPub, zPub)

Through the “Prepare an account-based transaction from xPub” endpoint users can prepare a transaction for signing from a synced with Crypto APIs address from the specific xPub. This endpoint applies to all supported account-based blockchain protocols, e.g. Ethereum, BSC, etc

Single Result - This endpoint returns only one single result. POST /blockchain-tools/{blockchain}/{network}/transactions/prepare-account-based-transaction

Path Parameters

  • Required
    blockchain string
    Example : ethereum
    Possible Values : ethereum
  • Required
    network string
    Example : ropsten
    Possible Values : mainnet ropsten

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

        Representation of the additional data.

        Example : yourAdditionalDataHere
      • Required
        amount string

        Representation of the amount of the transaction

        Example : 0.000003
      • Required
        fee object
        • Optional
          exactAmount string

          Representation of the exact amount value

          Example : 0.00045
        • Optional
          priority string

          Represents the fee priority

          Example : standard
          Possible Values : slow standard fast
      • Optional
        nonce string

        Representation of the nonce value

        Example : 0
      • Required
        recipient string

        Represents a list of recipient addresses with the respective amounts. In account-based protocols like Ethereum there is only one address in this list.

        Example : 0x041c594a0cc194e826bef5411b29c7f27001b7e3
      • Required
        sender string

        Represents a sender address with the respective amount. In account-based protocols like Ethereum there is only one address in this list.

        Example : 0x03654A9E78771442CAdf8DB37ae60D6a12bAEa9f
      • Optional
        transactionType string

        Representation of the transaction type

        Example : access-list-transaction
        Possible Values : legacy-transaction access-list-transaction gas-fee-market-transaction
      • Required
        xpub string

        Defines the account extended publicly known key which is used to derive all child public keys.

        Example : xpub6CsGdqTDEVRnLmpWN218HBwJqfhqSx46iA8ByzEA5Bz9jfwU3TSg9U7ambKgJyykvCraHQ6sAFAddMGFdPzhXrRanKbHnnkbDTyRPyn5gRJ

Response schema

200 400 401 402 403 409 415 422 429 500
HTTP Status Code: 200
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 amount of the transaction

        Example : 30000000000000
      • Required
        dataHex string

        Representation of the data in hex value

        Example : 0x0079006f00750072004100640064006900740069006f006e0061006c00440061007400610048006500720065
      • Required
        derivationIndex integer

        Representation of the derivation index of the xpub address

        Example : 0
      • Required
        fee object

        When isConfirmed is True - Defines the amount of the transaction fee When isConfirmed is False - For ETH-based blockchains this attribute represents the max fee value.

        • Required
          gasLimit string

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

          Example : 552020
        • Required
          gasPrice string

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

          Example : 2500000007
        • Required
          maxFeePerGas string

          Representation of the max fee per gas value

          Example : 2000000008
        • Required
          maxPriorityFeePerGas string

          Rrepresentation of the max priority fee per gas value

          Example : 2000000000
      • Required
        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

        Represents a recipient addresses. In account-based protocols like Ethereum there is only one address in this list.

        Example : 0x041c594a0cc194e826bef5411b29c7f27001b7e3
      • Required
        sender string

        Represents a sender address. In account-based protocols like Ethereum there is only one address in this list.

        Example : 0x03654A9E78771442CAdf8DB37ae60D6a12bAEa9f
      • Required
        sigHash string

        Representation of the hash that should be signed.

        Example : 40738814e379fd2b1923729c87ac80dddc6810a3f8f02fef05452251972ec83a
      • Required
        transactionType string

        Representation of the transaction type

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

Credits Cost : 50 Credits For 1 Result(s)

Try it out

Request Example

POST
https://rest.cryptoapis.io/blockchain-tools/ethereum/ropsten/transactions/prepare-account-based-transaction?context=yourExampleString
Headers
Content-Type: application/json
X-API-Key: my-api-key

Request Body
{
    "context": "yourExampleString",
    "data": {
        "item": {
            "additionalData": "yourAdditionalDataHere",
            "amount": "0.000003",
            "fee": {
                "exactAmount": "0.00045",
                "priority": "standard"
            },
            "nonce": "0",
            "recipient": "0x041c594a0cc194e826bef5411b29c7f27001b7e3",
            "sender": "0x03654A9E78771442CAdf8DB37ae60D6a12bAEa9f",
            "transactionType": "access-list-transaction",
            "xpub": "xpub6CsGdqTDEVRnLmpWN218HBwJqfhqSx46iA8ByzEA5Bz9jfwU3TSg9U7ambKgJyykvCraHQ6sAFAddMGFdPzhXrRanKbHnnkbDTyRPyn5gRJ"
        }
    }
}

Response Example

{
    "apiVersion": "2021-03-20",
    "requestId": "601c1710034ed6d407996b30",
    "context": "yourExampleString",
    "data": {
        "item": {
            "amount": "30000000000000",
            "dataHex": "0x0079006f00750072004100640064006900740069006f006e0061006c00440061007400610048006500720065",
            "derivationIndex": 0,
            "fee": {
                "gasLimit": "552020",
                "gasPrice": "2500000007",
                "maxFeePerGas": "2000000008",
                "maxPriorityFeePerGas": "2000000000"
            },
            "nonce": "0",
            "recipient": "0x041c594a0cc194e826bef5411b29c7f27001b7e3",
            "sender": "0x03654A9E78771442CAdf8DB37ae60D6a12bAEa9f",
            "sigHash": "40738814e379fd2b1923729c87ac80dddc6810a3f8f02fef05452251972ec83a",
            "transactionType": "access-list-transaction"
        }
    }
}