Create a migration plan

POST /byron-wallets/{walletId}/migrations/plan

Generate a plan for migrating the UTxO balance of this wallet to another wallet, without executing the plan.

This operation generates a plan that transfers as much of the wallet's balance as possible, by creating as many selections as may be necessary to migrate the entire balance. Each selection created is the basis for a transaction.

In order to minimize the total transaction fee required, UTxO entries are coalesced together to the greatest extent possible in the resulting selections. No attempt is made to preserve the wallet's UTxO distribution.

The plan is generated on a best-effort basis. If there is insufficient ada available to pay for the entire UTxO set to be migrated, then only a subset of the wallet's UTxO set will be included in the resultant plan.

Path parameters

  • walletId string(hex) Required

    Minimum length is 40, maximum length is 40.

application/json

Body Required

  • addresses array[string(base58) | bech32] Required

    A sequence of characters that encodes (in Base58 or Bech32) a sequence of bytes which represents an address on the Cardano blockchain. Sequences in Base58 encoding are expected to be legacy Byron addresses, whereas sequences in Bech32 encoding correspond to current Shelley addresses.

    For more details, see CIP-0019 — Cardano addresses .

    At least 1 element.

Responses

  • 406 application/json

    Not Acceptable

    Hide response attributes Show response attributes object
    • message string Required

      May occur when providing an invalid 'Accept' header.

    • code string Required

      Value is not_acceptable.

  • 404 application/json

    Not Found

    Hide response attributes Show response attributes object
    • message string Required

      May occur when a given walletId does not match with any known wallets (because it has been deleted, or has never existed).

    • code string Required

      Value is no_such_wallet.

    • info object

      Additional properties are allowed.

      Hide info attribute Show info attribute object
      • wallet_id string(hex) Required

        A unique identifier for the wallet

        Minimum length is 40, maximum length is 40.

  • 403 application/json

    Forbidden

    Hide response attributes Show response attributes object
    • message string Required

      May occur when trying to migrate a wallet that is empty or full of dust.

    • code string Required

      Value is nothing_to_migrate.

  • 202 application/json

    Accepted

    Hide response attributes Show response attributes object
    • selections array[object] Required

      The complete set of selections required for a migration.

      Each selection is the basis for a single transaction.

      The ordering of selections within the list is not significant. After conversion into transactions, the transactions can be broadcast to the network in any order to perform the migration.

      Hide selections attributes Show selections attributes object
      • inputs array[object] Required

        A list of transaction inputs

        Hide inputs attributes Show inputs attributes object
        • address string(base58|bech32) Required

          A sequence of characters that encodes (in Base58 or Bech32) a sequence of bytes which represents an address on the Cardano blockchain. Sequences in Base58 encoding are expected to be legacy Byron addresses, whereas sequences in Bech32 encoding correspond to current Shelley addresses.

          For more details, see CIP-0019 — Cardano addresses .

        • amount object Required

          Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

          Additional properties are allowed.

          Hide amount attributes Show amount attributes object
          • quantity integer Required

            Minimum value is 0.

          • unit string Required

            Value is lovelace.

        • assets array[object]

          A flat list of assets (possibly empty).

          An asset on the Cardano blockchain. An asset is uniquely identified by its policy_id and asset_name (together, these form the asset id).

          Two assets with the same asset_name and policy_id are interchangeable. Yet, different assets with a same policy_id but different asset_name are treated as separate assets, as are two assets with the same asset_name but different policy_id.

          Hide assets attributes Show assets attributes object
          • policy_id string(hex) Required

            A unique identifier of the asset's monetary policy. The policy controls how assets of this kind are created and destroyed.

            The contents are the blake2b-224 hash of the monetary policy script, encoded in hexadecimal.

            Minimum length is 56, maximum length is 56.

          • asset_name string(hex) Required

            The asset on-chain type which acts as a sub-identifier within a policy. Although we call it "asset name", the value needn't be text, and it could even be empty.

            For policies with a single fungible asset item, asset name is typically an empty string.

            This value can be up to 32 bytes of arbitrary data (which is 64 hexadecimal digits).

            Maximum length is 64.

          • quantity integer Required

            Number of assets for the given policy_id and asset_name.

            Minimum value is 0.

        • id string(hex) Required

          A unique identifier for this transaction

          Minimum length is 64, maximum length is 64.

        • derivation_path array[string] Required

          An individual segment within a derivation path.

          The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.

          At least 1 element.

        • index integer Required

          Minimum value is 0.

      • outputs array[object] Required

        A list of target outputs with amounts specified.

        When creating a new transaction, the wallet software ensures that all user-specified transaction outputs have ada amounts that satisfy the ledger minimum UTxO rule:

        • If a user-specified transaction output has an ada amount that is zero, the wallet software will automatically assign a minimal amount of ada to the output so that it satisfies the ledger minimum UTxO rule.

        • If a user-specified transaction output has an ada amount that is non-zero, the wallet software will verify that the specified amount is large enough to satisfy the ledger minimum UTxO rule. If the amount is not large enough, the wallet software will return a utxo_too_small error, together with a revised ada amount that does satisfy the minimum UTxO rule.

        At least 0 elements.

        Hide outputs attributes Show outputs attributes object
        • address string(base58|bech32) Required

          A sequence of characters that encodes (in Base58 or Bech32) a sequence of bytes which represents an address on the Cardano blockchain. Sequences in Base58 encoding are expected to be legacy Byron addresses, whereas sequences in Bech32 encoding correspond to current Shelley addresses.

          For more details, see CIP-0019 — Cardano addresses .

        • amount object Required

          Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

          Additional properties are allowed.

          Hide amount attributes Show amount attributes object
          • quantity integer Required

            Minimum value is 0.

          • unit string Required

            Value is lovelace.

        • assets array[object]

          A flat list of assets (possibly empty).

          An asset on the Cardano blockchain. An asset is uniquely identified by its policy_id and asset_name (together, these form the asset id).

          Two assets with the same asset_name and policy_id are interchangeable. Yet, different assets with a same policy_id but different asset_name are treated as separate assets, as are two assets with the same asset_name but different policy_id.

          Hide assets attributes Show assets attributes object
          • policy_id string(hex) Required

            A unique identifier of the asset's monetary policy. The policy controls how assets of this kind are created and destroyed.

            The contents are the blake2b-224 hash of the monetary policy script, encoded in hexadecimal.

            Minimum length is 56, maximum length is 56.

          • asset_name string(hex) Required

            The asset on-chain type which acts as a sub-identifier within a policy. Although we call it "asset name", the value needn't be text, and it could even be empty.

            For policies with a single fungible asset item, asset name is typically an empty string.

            This value can be up to 32 bytes of arbitrary data (which is 64 hexadecimal digits).

            Maximum length is 64.

          • quantity integer Required

            Number of assets for the given policy_id and asset_name.

            Minimum value is 0.

      • change array[object] Required

        A list of transaction change outputs.

        At least 0 elements.

        Hide change attributes Show change attributes object
        • address string(base58|bech32) Required

          A sequence of characters that encodes (in Base58 or Bech32) a sequence of bytes which represents an address on the Cardano blockchain. Sequences in Base58 encoding are expected to be legacy Byron addresses, whereas sequences in Bech32 encoding correspond to current Shelley addresses.

          For more details, see CIP-0019 — Cardano addresses .

        • amount object Required

          Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

          Additional properties are allowed.

          Hide amount attributes Show amount attributes object
          • quantity integer Required

            Minimum value is 0.

          • unit string Required

            Value is lovelace.

        • assets array[object]

          A flat list of assets (possibly empty).

          An asset on the Cardano blockchain. An asset is uniquely identified by its policy_id and asset_name (together, these form the asset id).

          Two assets with the same asset_name and policy_id are interchangeable. Yet, different assets with a same policy_id but different asset_name are treated as separate assets, as are two assets with the same asset_name but different policy_id.

          Hide assets attributes Show assets attributes object
          • policy_id string(hex) Required

            A unique identifier of the asset's monetary policy. The policy controls how assets of this kind are created and destroyed.

            The contents are the blake2b-224 hash of the monetary policy script, encoded in hexadecimal.

            Minimum length is 56, maximum length is 56.

          • asset_name string(hex) Required

            The asset on-chain type which acts as a sub-identifier within a policy. Although we call it "asset name", the value needn't be text, and it could even be empty.

            For policies with a single fungible asset item, asset name is typically an empty string.

            This value can be up to 32 bytes of arbitrary data (which is 64 hexadecimal digits).

            Maximum length is 64.

          • quantity integer Required

            Number of assets for the given policy_id and asset_name.

            Minimum value is 0.

        • derivation_path array[string] Required

          An individual segment within a derivation path.

          The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.

          At least 1 element.

      • collateral array[object]

        A list of transaction inputs used for collateral

        Hide collateral attributes Show collateral attributes object
        • address string(base58|bech32) Required

          A sequence of characters that encodes (in Base58 or Bech32) a sequence of bytes which represents an address on the Cardano blockchain. Sequences in Base58 encoding are expected to be legacy Byron addresses, whereas sequences in Bech32 encoding correspond to current Shelley addresses.

          For more details, see CIP-0019 — Cardano addresses .

        • amount object Required

          Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

          Additional properties are allowed.

          Hide amount attributes Show amount attributes object
          • quantity integer Required

            Minimum value is 0.

          • unit string Required

            Value is lovelace.

        • id string(hex) Required

          A unique identifier for this transaction

          Minimum length is 64, maximum length is 64.

        • derivation_path array[string] Required

          An individual segment within a derivation path.

          The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.

          At least 1 element.

        • index integer Required

          Minimum value is 0.

      • withdrawals array[object]

        A list of withdrawals from stake addresses.

        At least 0 elements.

        Hide withdrawals attributes Show withdrawals attributes object
        • stake_address string(bech32) Required
        • derivation_path array[string] Required

          An individual segment within a derivation path.

          The H suffix indicates a Hardened child private key, which means that children of this key cannot be derived from the public key. Indices without a H suffix are called Soft.

          At least 1 element.

        • amount object Required

          Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

          Additional properties are allowed.

          Hide amount attributes Show amount attributes object
          • quantity integer Required

            Minimum value is 0.

          • unit string Required

            Value is lovelace.

      • certificates array[object]

        A delegation certificate belonging to wallet

        Only for 'join_pool' the 'pool' property is required.

        Hide certificates attributes Show certificates attributes object
        • certificate_type string Required

          Values are join_pool, quit_pool, or register_reward_account.

        • pool string(hex|bech32)

          A unique identifier for the pool.

        • reward_account_path array[string] Required

          At least 5 but not more than 5 elements.

      • deposits_taken array[object]

        A list of deposits associated with a transaction.

        Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

        At least 0 elements.

        Hide deposits_taken attributes Show deposits_taken attributes object
        • quantity integer Required

          Minimum value is 0.

        • unit string Required

          Value is lovelace.

      • deposits_returned array[object]

        A list of deposits associated with a transaction.

        Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

        At least 0 elements.

        Hide deposits_returned attributes Show deposits_returned attributes object
        • quantity integer Required

          Minimum value is 0.

        • unit string Required

          Value is lovelace.

      • metadata string(base64)

        Transaction metadata, serialized according to the expected on-chain binary format, base64-encoded.

    • total_fee object Required

      The total amount to be paid in fees for a migration.

      This is the total sum of the fees of the individual selections.

      Additional properties are allowed.

      Hide total_fee attributes Show total_fee attributes object
      • quantity integer Required

        Minimum value is 0.

      • unit string Required

        Value is lovelace.

    • balance_leftover object Required

      The total balance of assets that cannot be migrated.

      The ada component of this balance is the total sum of all dust ada entries in the UTxO set. An ada entry is considered to be dust if its value is not large enough to pay for the marginal cost of including it in a transaction.

      The assets component of this balance is the total sum of all non-ada assets that cannot currently be migrated. Tokens of a non-ada asset cannot be migrated if there is insufficient ada available to pay for their inclusion in a transaction.

      Additional properties are allowed.

      Hide balance_leftover attributes Show balance_leftover attributes object
      • ada object Required

        Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

        Additional properties are allowed.

        Hide ada attributes Show ada attributes object
        • quantity integer Required

          Minimum value is 0.

        • unit string Required

          Value is lovelace.

      • assets array[object] Required

        A flat list of assets (possibly empty).

        An asset on the Cardano blockchain. An asset is uniquely identified by its policy_id and asset_name (together, these form the asset id).

        Two assets with the same asset_name and policy_id are interchangeable. Yet, different assets with a same policy_id but different asset_name are treated as separate assets, as are two assets with the same asset_name but different policy_id.

        Hide assets attributes Show assets attributes object
        • policy_id string(hex) Required

          A unique identifier of the asset's monetary policy. The policy controls how assets of this kind are created and destroyed.

          The contents are the blake2b-224 hash of the monetary policy script, encoded in hexadecimal.

          Minimum length is 56, maximum length is 56.

        • asset_name string(hex) Required

          The asset on-chain type which acts as a sub-identifier within a policy. Although we call it "asset name", the value needn't be text, and it could even be empty.

          For policies with a single fungible asset item, asset name is typically an empty string.

          This value can be up to 32 bytes of arbitrary data (which is 64 hexadecimal digits).

          Maximum length is 64.

        • quantity integer Required

          Number of assets for the given policy_id and asset_name.

          Minimum value is 0.

    • balance_selected object Required

      The total balance of assets that can be migrated.

      Additional properties are allowed.

      Hide balance_selected attributes Show balance_selected attributes object
      • ada object Required

        Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

        Additional properties are allowed.

        Hide ada attributes Show ada attributes object
        • quantity integer Required

          Minimum value is 0.

        • unit string Required

          Value is lovelace.

      • assets array[object] Required

        A flat list of assets (possibly empty).

        An asset on the Cardano blockchain. An asset is uniquely identified by its policy_id and asset_name (together, these form the asset id).

        Two assets with the same asset_name and policy_id are interchangeable. Yet, different assets with a same policy_id but different asset_name are treated as separate assets, as are two assets with the same asset_name but different policy_id.

        Hide assets attributes Show assets attributes object
        • policy_id string(hex) Required

          A unique identifier of the asset's monetary policy. The policy controls how assets of this kind are created and destroyed.

          The contents are the blake2b-224 hash of the monetary policy script, encoded in hexadecimal.

          Minimum length is 56, maximum length is 56.

        • asset_name string(hex) Required

          The asset on-chain type which acts as a sub-identifier within a policy. Although we call it "asset name", the value needn't be text, and it could even be empty.

          For policies with a single fungible asset item, asset name is typically an empty string.

          This value can be up to 32 bytes of arbitrary data (which is 64 hexadecimal digits).

          Maximum length is 64.

        • quantity integer Required

          Number of assets for the given policy_id and asset_name.

          Minimum value is 0.

POST /byron-wallets/{walletId}/migrations/plan
curl \
 --request POST 'https://localhost:8090/v2/byron-wallets/{walletId}/migrations/plan' \
 --header "Content-Type: application/json" \
 --data '{"addresses":["addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g"]}'
Request examples
{
  "addresses": [
    "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g"
  ]
}
Response examples (406)
{
  "message": "string",
  "code": "not_acceptable"
}
Response examples (404)
{
  "message": "string",
  "code": "no_such_wallet",
  "info": {
    "wallet_id": "2512a00e9653fe49a44a5886202e24d77eeb998f"
  }
}
Response examples (403)
{
  "message": "string",
  "code": "nothing_to_migrate"
}
Response examples (202)
{
  "selections": [
    {
      "inputs": [
        {
          "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
          "amount": {
            "quantity": 42000000,
            "unit": "lovelace"
          },
          "assets": [
            {
              "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
              "asset_name": "string",
              "quantity": 42
            }
          ],
          "id": "1423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db1",
          "derivation_path": [
            "1852H"
          ],
          "index": 42
        }
      ],
      "outputs": [
        {
          "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
          "amount": {
            "quantity": 42000000,
            "unit": "lovelace"
          },
          "assets": [
            {
              "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
              "asset_name": "string",
              "quantity": 42
            }
          ]
        }
      ],
      "change": [
        {
          "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
          "amount": {
            "quantity": 42000000,
            "unit": "lovelace"
          },
          "assets": [
            {
              "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
              "asset_name": "string",
              "quantity": 42
            }
          ],
          "derivation_path": [
            "1852H"
          ]
        }
      ],
      "collateral": [
        {
          "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
          "amount": {
            "quantity": 42000000,
            "unit": "lovelace"
          },
          "id": "1423856bc91c49e928f6f30f4e8d665d53eb4ab6028bd0ac971809d514c92db1",
          "derivation_path": [
            "1852H"
          ],
          "index": 42
        }
      ],
      "withdrawals": [
        {
          "stake_address": "stake1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2x",
          "derivation_path": [
            "1852H"
          ],
          "amount": {
            "quantity": 42000000,
            "unit": "lovelace"
          }
        }
      ],
      "certificates": [
        {
          "certificate_type": "join_pool",
          "pool": "pool1wqaz0q0zhtxlgn0ewssevn2mrtm30fgh2g7hr7z9rj5856457mm",
          "reward_account_path": [
            "string"
          ]
        }
      ],
      "deposits_taken": [
        {
          "quantity": 42000000,
          "unit": "lovelace"
        }
      ],
      "deposits_returned": [
        {
          "quantity": 42000000,
          "unit": "lovelace"
        }
      ],
      "metadata": "string"
    }
  ],
  "total_fee": {
    "quantity": 42000000,
    "unit": "lovelace"
  },
  "balance_leftover": {
    "ada": {
      "quantity": 42000000,
      "unit": "lovelace"
    },
    "assets": [
      {
        "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
        "asset_name": "string",
        "quantity": 42
      }
    ]
  },
  "balance_selected": {
    "ada": {
      "quantity": 42000000,
      "unit": "lovelace"
    },
    "assets": [
      {
        "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
        "asset_name": "string",
        "quantity": 42
      }
    ]
  }
}