DecentralChain (DCC)
Actions36
- Account Actions
- Matcher Actions
- Token/Asset Actions
- Transaction Actions
- Utility Actions
Overview
The "Place Market Order" operation in the Matcher resource allows users to submit a market order to a decentralized exchange matcher service on the DecentralChain (DCC) blockchain. This operation facilitates immediate buying or selling of a specified amount of an asset at the best available price, without specifying a limit price.
This node is beneficial for traders and automated systems that want to quickly execute trades on the DCC matcher without manually interacting with the matcher API. For example, it can be used to:
- Quickly buy a certain amount of a token using DCC or another asset.
- Sell tokens immediately at the current market price.
- Automate trading strategies that require fast execution without waiting for limit orders to fill.
Properties
| Name | Meaning |
|---|---|
| Base URL | Base URL for the main DCC node API, used if no credential is supplied. Default: https://nodes.decentralchain.io. |
| Matcher Base URL | Base URL for the Matcher API, used if no matcher credential is supplied. Default: https://mainnet-matcher.decentralchain.io. |
| Amount Asset | The asset ID or symbol (e.g., 'DCC') representing the asset quantity you want to trade (amount asset). |
| Price Asset | The asset ID or symbol (e.g., 'DCC') representing the asset used as the price reference (price asset). |
| Use Raw Order JSON | Boolean flag indicating whether to provide the entire raw JSON order body instead of filling individual fields. |
| Order JSON | Raw JSON string representing the full order object as required by the matcher API. Required if "Use Raw Order JSON" is true. |
| Order Type | Specifies whether the order is a "Buy" or "Sell" order. |
| Amount (Long Units) | The amount to trade expressed in the smallest units of the amount asset (e.g., satoshis). |
| Matcher Fee (Long Units) | The fee amount to pay to the matcher, expressed in the smallest units of the fee asset. Defaults to 300000 (0.003 DCC). |
| Fee Asset ID | The asset ID or symbol used to pay the matcher fee. Defaults to 'DCC'. |
| Sender Public Key | The public key of the order sender, used to identify and sign the order. |
| Expiration (Hours) | Duration in hours for which the order remains valid before expiring. Minimum 1 hour, maximum 720 hours. Default is 24 hours. |
| Order Version | Numeric version of the order format. Default is 3. |
Output
The output JSON contains the response from the matcher API after placing the market order. It includes details such as:
- Order confirmation data returned by the matcher.
- Debug information including:
- Operation name (
placeMarketOrder). - Endpoint called on the matcher API.
- Matcher base URL used.
- Timestamp of the request.
- The exact request body sent to the matcher.
- Operation name (
If the user provides invalid JSON when using the raw order option, the node throws an error indicating invalid JSON.
No binary data output is produced by this operation.
Dependencies
- Requires access to the DecentralChain matcher API endpoint, either via a provided base URL or credentials containing the matcher API URL and optional authentication token.
- Uses HTTP requests to communicate with the matcher API.
- Optionally requires an API token for authorization with the matcher API (passed as a Bearer token in the Authorization header).
- No internal credential names are exposed; users must supply appropriate URLs and optionally API tokens.
Troubleshooting
- Invalid JSON in Order JSON: If "Use Raw Order JSON" is enabled but the provided JSON string is malformed, the node will throw an error stating "Invalid JSON in Order JSON". To fix, ensure the JSON is correctly formatted.
- HTTP Request Failures: Network issues or incorrect matcher base URL may cause HTTP request failures. Verify the matcher base URL and network connectivity.
- Authorization Errors: If the matcher API requires authentication and no valid token is provided, requests may fail with authorization errors. Provide a valid API token credential or ensure the matcher API allows unauthenticated requests.
- Missing Required Fields: Omitting required properties like
amountAsset,priceAsset,matcherAmount, ormatcherSenderPublicKeywill cause the node to fail. Ensure all required inputs are provided. - Expiration Hours Out of Range: The expiration time must be between 1 and 720 hours. Values outside this range may cause errors.
Links and References
- DecentralChain Matcher API Documentation (hypothetical link, replace with actual if available)
- DecentralChain Waves Transactions Library
- n8n Documentation on Creating Custom Nodes
This summary covers the static analysis of the "Place Market Order" operation within the Matcher resource of the DecentralChain node implementation.