Crypto APIs icon

Crypto APIs

Interact with Crypto APIs REST API

Actions113

Overview

This node operation prepares a UTXO-based cryptocurrency transaction using an HD Wallet's extended public key (xPub, yPub, or zPub). It interacts with a blockchain network to construct the transaction details without requiring private keys, enabling secure transaction preparation for cryptocurrencies that use the UTXO model (e.g., Bitcoin and its derivatives).

Typical use cases include:

  • Creating unsigned transactions for cold storage wallets.
  • Preparing transactions for hardware wallets or external signing tools.
  • Building transactions programmatically in workflows that manage multiple addresses derived from an HD wallet.

For example, you might use this node to prepare a Bitcoin transaction specifying recipients and fees, then export the prepared transaction for offline signing.

Properties

Name Meaning
blockchain The blockchain network to interact with (e.g., bitcoin, litecoin).
network The specific network type within the blockchain (e.g., mainnet, testnet).
extendedPublicKey The HD wallet's extended public key (xPub, yPub, or zPub) used to derive addresses.
context Optional context string for the request, if applicable.
JSON Body A collection of optional parameters to customize the transaction preparation:
- additionalData Extra data to include in the transaction, if supported.
- locktime The locktime value for the transaction, controlling when it can be added to the blockchain.
- fee Fee-related settings (structure not detailed here).
- prepareStrategy Strategy for preparing the transaction; options are: none, minimize-dust, optimize-size.
- recipients Collection defining recipients of the transaction (addresses and amounts).
- replaceable Boolean indicating if the transaction is replaceable (RBF - Replace-By-Fee).

Output

The node outputs a JSON array where each item represents the prepared transaction data returned by the API. This typically includes:

  • Transaction hex or raw data ready for signing.
  • Details about inputs, outputs, fees, and other metadata relevant to the UTXO transaction.
  • Any additional information provided by the API response related to the prepared transaction.

No binary data output is indicated by the source code.

Dependencies

  • Requires an active connection to the Crypto APIs REST API service.
  • Needs an API authentication token configured in n8n credentials to authorize requests.
  • The node reads a local OpenAPI specification file (2024-12-12-final.json) bundled with the node for operation definitions.
  • No other external dependencies are required.

Troubleshooting

  • Operation Not Found Error: If the specified operation cannot be found, ensure the "operation" parameter matches exactly the supported operation name.
  • Missing Required Parameters: The node requires blockchain, network, and extendedPublicKey at minimum. Omitting these will cause errors.
  • API Request Failures: Network issues or invalid API credentials will result in request errors. Verify API key validity and network connectivity.
  • Invalid Extended Public Key: Providing an incorrect or malformed xPub/yPub/zPub will cause the API to reject the request.
  • Incorrect Recipients Format: Ensure recipients are correctly structured as per API expectations; otherwise, the transaction preparation may fail.
  • Use the "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion