Construction

Parse High-Level Construction Operations

Changed on

PreprocessOperations is called to parse and validate high-level transaction construction operations into Rosetta operations. This endpoint allows the Rosetta implementation to handle operation parsing that might not be supported by local client-side parsers.

This endpoint is OPTIONAL and implementations can return HTTP 501 (Not Implemented) if they don't support this functionality.

The input format matches TransactionConstructOpInput used by chainstdio, and the output format matches the return values of ParseTransactionConstructOp to maintain compatibility with existing operation parsing workflows.

post/construction/preprocess-operations

Request

  • The document declares no server URL.
  • Auth
    none declared

Request body

ConstructionPreprocessOperationsRequest required

ConstructionPreprocessOperationsRequest is passed to the /construction/preprocess-operations endpoint so that a Rosetta implementation can parse high-level transaction construction operations into Rosetta operations. This endpoint allows the Rosetta API to handle operation parsing that might not be supported by the local OperationSelector.

network_identifier, NetworkIdentifier required

The network_identifier specifies which network a particular object is associated with.

from_address, string

The address that will be the source of the transaction. This is optional and may not be required for all construct operations.

construct_op, string required

The high-level operation type to be parsed (e.g. "transfer", "stake", "delegate").

options, object

Operation-specific parameters as a JSON object. The format of this object is specific to the construct_op type and the blockchain implementation.

Example request

{
  "network_identifier": {
    "blockchain": "bitcoin",
    "network": "mainnet",
    "sub_network_identifier": {
      "network": "shard 1",
      "metadata": {
        "producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
      }
    }
  }
}

Response

Expected response to a valid request

ConstructionPreprocessOperationsResponse required

ConstructionPreprocessOperationsResponse contains the parsed operations and related information returned by the Rosetta implementation after processing the high-level transaction construction request. This response mirrors the return values of ParseTransactionConstructOp method to maintain compatibility.

operations, Operation[] required

The parsed operations that result from processing the construct_op.

max_fee, Amount

Amount is some Value of a Currency. It is considered invalid to specify a Value without a Currency.

metadata, string byte

Metadata as raw JSON bytes, matching ParseTransactionConstructOp return format for compatibility with existing workflows.

Example response

{
  "operations": [
    {
      "operation_identifier": {
        "index": 5
      },
      "related_operations": [
        {
          "index": 1
        },
        {
          "index": 2
        }
      ],
      "type": "Transfer",
      "status": "Reverted",
      "account": {
        "address": "0x3a065000ab4183c6bf581dc1e55a605455fc6d61",
        "sub_account": {
          "address": "0x6b175474e89094c44da98b954eedeac495271d0f"
        }
      },
      "amount": {
        "value": "1238089899992",
        "currency": {
          "symbol": "BTC",
          "decimals": 8,
          "metadata": {
            "Issuer": "Satoshi"
          }
        }
      },
      "coin_change": {
        "coin_identifier": {
          "identifier": "0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f:1"
        }
      },
      "metadata": {
        "asm": "304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd01 03301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2",
        "hex": "48304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd012103301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2"
      }
    }
  ],
  "max_fee": {
    "value": "1238089899992",
    "currency": {
      "symbol": "BTC",
      "decimals": 8,
      "metadata": {
        "Issuer": "Satoshi"
      }
    }
  }
}

Changes