Skip to content

How to migrate a Byron wallet using the command line

Matthias Benkort edited this page May 12, 2020 · 9 revisions

Pre-Requisites

Disclaimer

Some of the commands below will query the wallet API directly via cURL because not all API endpoints are available through the command-line yet. Our sincere apologies for the inconvenience.

Step 1: Launch cardano-wallet

  • The launch command starts both a wallet web server and a full Jörmungandr node. Options can be passed directly down to Jörmungandr when specified after --.

    $ cardano-wallet launch --genesis-block-hash $GENESIS_HASH -- --config config.yaml
    

    ⚠️ By default, the wallet server listens on tcp/8090. If you already have a service listening on this port, use --port to provide a port of your choice or, --random-port to let the server finds an available port on the host machine. Should you use a custom port, provide an additional --port to every command below.

    ❓ See Protocol Parameters below for values of $GENESIS_HASH

  • (optional) Make sure that your server is up-and-running and, rather synced with the node

    $ cardano-wallet network information
    Ok.
    {
      ...
        "node_tip": {
            "height": {
                "quantity": 8,
                "unit": "block"
            },
            "epoch_number": 985701,
            "slot_number": 6
        },
        "sync_progress": {
            "status": "ready"
        },
      ...
    }
    

Step 2: Restore Your Byron Wallet

  • Restore your Byron wallet using your 12-word mnemonic sentence:

    $ curl -X POST http://localhost:8090/v2/byron-wallets \
      -H "Content-Type: application/json" \
      -d '{
        "name": "MyByronWallet",
        "style": "random",
        "passphrase": "MySecurePassphrase",
        "mnemonic_sentence": [
          "survey",
          "wonder",
          ...
      ]}'
    { ..., "id": "aa129a07d1ce083e67597348f1788747a034686e", ... }
    

    ❓ Your passphrase above doesn't need to be identical to the passphrase you used when initially creating your wallet with Daedalus. The passphrase is only used to encrypt the resulting root private key but does not affect the seed generation from the mnemonic sentence.

  • Retain the value associated with the "id" field from the response to the previous command.

    $ export BYRON_ID=aa129a07d1ce083e67597348f1788747a034686e
    
  • Monitor your wallet and wait for it to be restored.

    $ curl http://localhost:8090/v2/byron-wallets/$BYRON_ID
    { ..., "state":{"status":"ready"},"balance":{"available":{"quantity":1000000000000,"unit":"lovelace"}, ...}
    

Step 3: Create a new Shelley wallet

  • (optional) Generate a 15-word mnemonic sentence for your wallet. Alternatively, you may also use an existing one if you already have one.

    $ cardano-wallet mnemonic generate --size=15
    perfect canvas ...
    
  • Restore this wallet using the command-line

    $ cardano-wallet wallet create MyShelleyWallet
    Please enter a 15–24 word mnemonic sentence: perfect canvas ...
    
    (Enter a blank line if you didn't use a second factor.)
    Please enter your 9–12 word mnemonic second factor:
    
    Please enter a passphrase: **********
    Enter the passphrase a second time: **********
    Ok.
    {
    ...
    "id": "2d4cc31a4b3116ab86bfe529d30d9c362acd0b44",
    ...
    }
    
  • Retain the value associated with the "id" field in the response from the previous command.

    $ export SHELLEY_ID=2d4cc31a4b3116ab86bfe529d30d9c362acd0b44
    

Step 4: Migrate your Byron wallet

  • Using the ids of your Byron and Shelley wallets, migrate the Byron wallet via the API:

    $ curl -X POST http://localhost:8090/v2/byron-wallets/$BYRON_ID/migrations/$SHELLEY_ID \
      -H "Content-Type: application/json" \
      -d '{
        "passphrase": "MySecurePassphrase"
      }'
    

    This will create one or several transactions (depending on the size of your UTxO) from your Byron wallet to your Shelley wallet. Eventually, all those transactions will be inserted in the ledger and your funds available on your Shelley wallet.

  • Monitor the migration by looking at the transaction history:

    $ cardano-wallet transaction list $SHELLEY_ID
    Ok.
    [
        {
            "inserted_at": {
                "time": "2019-12-09T18:53:23Z",
                "block": {
                    "height": {
                        "quantity": 689,
                        "unit": "block"
                    },
                    "epoch_number": 985777,
                    "slot_number": 3
                }
            },
            "status": "in_ledger",
        ...
    ]
    

    or, alternatively, by looking at the wallet balances directly:

    $ cardano-wallet wallet get  $SHELLEY_ID
    Ok.
    {
      ...
        "balance": {
            "available": {
                "quantity": 999999999966,
                "unit": "lovelace"
            },
      ...
    }
    

Annex

Protocol Parameters

See Protocol Parameters