DecentralChain (DCC) icon

DecentralChain (DCC)

Create, sign and broadcast DecentralChain transactions, plus query blockchain data

Overview

This node enables creating, signing, and optionally broadcasting DecentralChain (DCC) blockchain transactions specifically for the "Set Asset Script" operation under the Transaction resource. It supports multiple authentication methods including seed phrase, private key, or creating unsigned transactions.

The "Set Asset Script" operation allows users to attach or update a script on an existing asset, which can define custom logic or rules for that asset on the blockchain. This is useful for token issuers who want to add programmable behavior or restrictions to their tokens.

Typical use cases include:

  • Adding smart contract logic to an asset after issuance.
  • Updating asset scripts to modify token behavior.
  • Creating unsigned transactions for offline signing or external processing.

Example: A user wants to update the script of a token they issued to enforce transfer restrictions. They provide the asset ID, new script, and sign the transaction with their seed phrase. The node creates and signs the transaction, then optionally broadcasts it to the network.

Properties

Name Meaning
Base URL Base URL of the DCC node API to send requests to if no credential base URL is supplied.
Authentication Method How to sign the transaction: Seed Phrase, Private Key, or Create Unsigned Transaction.
Seed Phrase Secret seed phrase used to sign the transaction (required if using Seed Phrase auth).
Private Key Private key used to sign the transaction (required if using Private Key auth).
Sender Public Key Public key of the sender, required when creating unsigned transactions.
Chain ID Network identifier: Mainnet (?) or Testnet (!).
Auto Broadcast Whether to automatically broadcast the signed transaction to the network after creation.

Note: Although the full property list includes many operations, this summary focuses on those relevant to the "Set Asset Script" transaction operation.

Output

The node outputs a JSON object containing:

  • transaction: The created transaction object including details such as type, version, proofs, signature presence, and transaction ID.
  • broadcastResult (if auto broadcast is enabled and successful): The response from the network after broadcasting the transaction.
  • status: Indicates whether the transaction was just created (created) or successfully broadcasted (broadcasted), or if broadcasting failed (broadcast_failed).
  • broadcastError (if broadcasting fails): Error message describing why broadcasting failed.
  • debug: Detailed debug information including operation name, chain ID, authentication method, base URL, transaction ID, timestamp, and transaction metadata.

If the transaction is unsigned, the output notes that the transaction is created but not signed or broadcasted.

No binary data output is produced by this node.

Dependencies

  • Requires the @decentralchain/waves-transactions library for transaction creation and signing. The node attempts to load this library at runtime and falls back to mock functions if unavailable.
  • Requires access to a DecentralChain node API endpoint specified by the Base URL or credentials.
  • For signing transactions, requires either a seed phrase or private key credential, or a sender public key for unsigned transactions.
  • Optional: Internet connectivity to broadcast transactions to the blockchain network.

Troubleshooting

  • Library Loading Failure: If the @decentralchain/waves-transactions library cannot be loaded, the node uses mock functions which do not perform real signing or broadcasting. Ensure the library is installed in the environment where n8n runs.
  • Broadcast Failures: Errors during broadcasting may occur due to network issues, invalid transaction data, or insufficient funds. The error message is included in the output under broadcastError.
  • Missing Required Parameters: Omitting required fields like seed phrase, private key, or sender public key (for unsigned) will cause errors.
  • Invalid Chain ID: Using an incorrect chain ID may result in rejected transactions.
  • Auto Broadcast Disabled: If auto broadcast is false, the transaction is created and signed but not sent to the network; users must handle broadcasting separately.
  • Unsigned Transactions: When creating unsigned transactions, ensure the sender public key is provided; otherwise, transaction creation will fail.

Links and References


This summary is based solely on static analysis of the provided source code and input property definitions.

Discussion