POST
/
construction
/
preprocess
curl --request POST \
  --url https://example.com/construction/preprocess \
  --header 'Content-Type: application/json' \
  --data '{
  "network_identifier": {
    "blockchain": "bitcoin",
    "network": "mainnet",
    "sub_network_identifier": {
      "network": "shard 1",
      "metadata": {
        "producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
      }
    }
  },
  "operations": [
    {
      "operation_identifier": {
        "index": 5,
        "network_index": 0
      },
      "related_operations": [
        {
          "index": 1
        },
        {
          "index": 2
        }
      ],
      "type": "Transfer",
      "status": "Reverted",
      "account": {
        "address": "0x3a065000ab4183c6bf581dc1e55a605455fc6d61",
        "sub_account": {
          "address": "0x6b175474e89094c44da98b954eedeac495271d0f",
          "metadata": {}
        },
        "metadata": {}
      },
      "amount": {
        "value": "1238089899992",
        "currency": {
          "symbol": "BTC",
          "decimals": 8,
          "metadata": {
            "Issuer": "Satoshi"
          }
        },
        "metadata": {}
      },
      "coin_change": {
        "coin_identifier": {
          "identifier": "0x2f23fd8cca835af21f3ac375bac601f97ead75f2e79143bdf71fe2c4be043e8f:1"
        },
        "coin_action": "coin_created"
      },
      "metadata": {
        "asm": "304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd01 03301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2",
        "hex": "48304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd012103301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2"
      }
    }
  ],
  "metadata": {},
  "max_fee": [
    {
      "value": "1238089899992",
      "currency": {
        "symbol": "BTC",
        "decimals": 8,
        "metadata": {
          "Issuer": "Satoshi"
        }
      },
      "metadata": {}
    }
  ],
  "suggested_fee_multiplier": 1
}'
{
  "options": {},
  "required_public_keys": [
    {
      "address": "0x3a065000ab4183c6bf581dc1e55a605455fc6d61",
      "sub_account": {
        "address": "0x6b175474e89094c44da98b954eedeac495271d0f",
        "metadata": {}
      },
      "metadata": {}
    }
  ]
}

Body

application/json

ConstructionPreprocessRequest is passed to the /construction/preprocess endpoint so that a Rosetta implementation can determine which metadata it needs to request for construction. Metadata provided in this object should NEVER be a product of live data (i.e. the caller must follow some network-specific data fetching strategy outside of the Construction API to populate required Metadata). If live data is required for construction, it MUST be fetched in the call to /construction/metadata. The caller can provide a max fee they are willing to pay for a transaction. This is an array in the case fees must be paid in multiple currencies. The caller can also provide a suggested fee multiplier to indicate that the suggested fee should be scaled. This may be used to set higher fees for urgent transactions or to pay lower fees when there is less urgency. It is assumed that providing a very low multiplier (like 0.0001) will never lead to a transaction being created with a fee less than the minimum network fee (if applicable). In the case that the caller provides both a max fee and a suggested fee multiplier, the max fee will set an upper bound on the suggested fee (regardless of the multiplier provided).

Response

200
application/json

Expected response to a valid request

ConstructionPreprocessResponse contains options that will be sent unmodified to /construction/metadata. If it is not necessary to make a request to /construction/metadata, options should be omitted. Some blockchains require the PublicKey of particular AccountIdentifiers to construct a valid transaction. To fetch these PublicKeys, populate required_public_keys with the AccountIdentifiers associated with the desired PublicKeys. If it is not necessary to retrieve any PublicKeys for construction, required_public_keys should be omitted.