DecentralChain (DCC) icon

DecentralChain (DCC)

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

Overview

The node facilitates creating, signing, and optionally broadcasting DecentralChain blockchain transactions specifically for the "Set Account Script" operation under the "Transaction" resource. This operation allows users to set or update a script on a blockchain account, which can control account behavior such as smart contract logic or custom validations.

Typical use cases include:

  • Deploying or updating smart contract scripts tied to an account.
  • Automating blockchain account configuration within workflows.
  • Managing account-level programmable logic in DecentralChain.

For example, a user might want to automate setting a new account script after certain conditions are met in their workflow, ensuring the account behaves according to updated business rules.

Properties

Name Meaning
Base URL The base API endpoint URL used if no credential is supplied (default: https://nodes.decentralchain.io).
Authentication Method How the transaction will be signed. Options: Seed Phrase, Private Key, Create Unsigned Transaction.
Seed Phrase Secret seed phrase used to sign the transaction (required if using Seed Phrase authentication).
Private Key Private key used to sign the transaction (required if using Private Key authentication).
Sender Public Key Public key of the sender; required when creating unsigned transactions.
Chain ID Network identifier for the transaction. Options: Mainnet (?), Testnet (!).
Auto Broadcast Whether to automatically broadcast the transaction after signing (boolean).

Output

The node outputs a JSON object containing:

  • transaction: The created transaction object including its details such as type, version, proofs, and signature presence.
  • broadcastResult (optional): Result returned from broadcasting the transaction to the network, present only if auto-broadcast is enabled and successful.
  • status: Indicates the state of the transaction, e.g., "created", "broadcasted", or "broadcast_failed".
  • broadcastError (optional): Error message if broadcasting failed.
  • debug: Contains metadata about the operation, including timestamps, chain ID, authentication method, base URL, transaction ID, and other diagnostic information useful for troubleshooting.

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

No binary data output is produced by this operation.

Dependencies

  • Requires the external @decentralchain/waves-transactions library (or compatible) for transaction creation and signing.
  • Needs access to a DecentralChain node API endpoint (configurable via Base URL or credentials).
  • Optionally requires an API key credential for authenticated requests.
  • The node attempts dynamic loading of the transaction library at runtime; if unavailable, it falls back to mock implementations for testing.

Troubleshooting

  • Library Loading Failure: If the transaction library fails to load, the node logs errors and uses mock functions, which means actual blockchain interaction won't occur. Ensure the library is installed and accessible in the environment.
  • Invalid Attachment Errors: Attachments must be valid base58 strings or UTF-8 text not exceeding 140 bytes. Invalid attachments cause errors.
  • Broadcast Failures: Broadcasting may fail due to network issues or invalid transaction data. The error message and stack trace are included in the output debug info.
  • Missing Required Parameters: Omitting required fields like seed phrase, private key, or sender public key (for unsigned) will cause errors.
  • Incorrect Chain ID: Using the wrong chain ID for the target network can cause transaction rejection.
  • JSON Parsing Errors: For raw JSON inputs (not applicable here but relevant in other operations), invalid JSON causes errors.

To resolve issues:

  • Verify all required parameters are correctly set.
  • Confirm the node environment has the necessary libraries installed.
  • Check network connectivity to the specified Base URL.
  • Review debug output for detailed error context.

Links and References

Discussion