Skip to content

Use z_mergetoaddress to migrate your funds from sprout address to sapling address

ParrotGotMeEye edited this page Jan 27, 2019 · 10 revisions

Make Sure Your Computer's Firewall is Turned OFF

Start Pirate in native mode

  • Download and run latest Agama from here (Select the installer if you want to install it or use the portable version to start Agama immediately)
  • Make sure you have fully synced and 100% blockchain database downloaded.

Extract the downloaded zip file from here, open a terminal console from the extracted directory to run the following commands on Linux and macOS. For Windows guide click here

Create necessary new addresses

Use the following commands to create necessary addresses and save them in a text editor (notepad). We will need all 3 types of addresses; transparent, sprout and sapling. Sprout z addresses starts with zc, Sapling z addresses starts with zs and Transparent addresses starts with R.
Note: You should already have your funds in a sprout address. Make a note of that address as well, as we will use that first

./pirate getnewaddress
# this command will generate transparent address starting with `R`
./pirate z_getnewaddress sprout
# this command will generate sprout address starting with `zc`
./pirate -ac_name=PIRATE z_getnewaddress
# this command will generate sapling address starting with `zs`

Check Operation Status

Important: Each time you send a private transaction, please wait for it to confirm before issuing the next one. If your transaction is unconfirmed state, you will not see actual balance and next operation may not work. To find a details of displayed opid use the following command. The opid will show you the details of that specific z transaction along with txid which you can search on Pirate explorer.

./pirate z_getoperationstatus [\"opid-84a07937-1a46-41fb-9cf3-80c7d422d373\"]

Replace the opid with the one displayed in your console after each z_mergetoaddress call.

Step 1: z_mergetoaddress Sprout > Sprout

Send your funds from old sprout address to new sprout address using z_mergetoaddress call. You may have to do this multiple times until there are no remaining zutxos available. Usage:

./pirate z_mergetoaddress [\"oldsproutaddress\"] newsproutaddress

Example:

./pirate z_mergetoaddress [\"zccPBzsHA53dmuX6jd6DXt8YR2GYKSFL5dUuwtNoJ8iqbzvP4KtL1zWad2qJq6fvgLsQqmkQBmpsY6rY13H71wCZ1wb7aGR\"] zcaa1KcQnEmuGNFnaACHLBUeQMTYGy7yHUv3TyEwtk1KCjED4EhY9V1eRGUSSQtYP8ktFrNBwsoSEN9qsMP7jaN4e8THXZt

You will see output like below.

{
  "remainingUTXOs": 0,
  "remainingTransparentValue": 0.00000000,
  "remainingNotes": 4,
  "remainingShieldedValue": 2788.74052146,
  "mergingUTXOs": 0,
  "mergingTransparentValue": 0.00000000,
  "mergingNotes": 10,
  "mergingShieldedValue": 53760.89576650,
  "opid": "opid-d08a6033-3968-4561-9c3d-b38ab99c6900"
}

The above output shows "remainingNotes": 4, which means you need to run the same command again until remaining notes becomes 0.

Step 2: z_mergetoaddress Sprout > Transparent

Send all your funds from newsproutaddress to a transparent address. Usage:

./komodo-cli -ac_name=PIRATE z_mergetoaddress [\"newsproutaddress\"] transparentaddress

Example:

./komodo-cli -ac_name=PIRATE z_mergetoaddress [\"zcaa1KcQnEmuGNFnaACHLBUeQMTYGy7yHUv3TyEwtk1KCjED4EhY9V1eRGUSSQtYP8ktFrNBwsoSEN9qsMP7jaN4e8THXZt\"] RPjqW9TyRMUsEDi3KruD136xHEaLeLTmRK

You will see output like below.

{
  "remainingUTXOs": 0,
  "remainingTransparentValue": 0.00000000,
  "remainingNotes": 0,
  "remainingShieldedValue": 0.00000000,
  "mergingUTXOs": 0,
  "mergingTransparentValue": 0.00000000,
  "mergingNotes": 2,
  "mergingShieldedValue": 56549.63608796,
  "opid": "opid-40f62c86-2bea-450d-812c-73fb76604332"
}

If you see there are any remaining notes, you need to use the same command again until you see the value is 0.

Step 3: z_mergetoaddress Transparent > Sapling

This is last step if you have completed the previous 2 successfully. You should have all funds in transparent address by now and you need to wait for the last sprout > transparent transaction to be confirmed before issuing commands from this step. Easiest way to find it is searching for your transparent address in the explorer. Usage:

./komodo-cli -ac_name=PIRATE z_mergetoaddress [\"transparentaddress\"] saplingaddress

Example:

./komodo-cli -ac_name=PIRATE z_mergetoaddress [\"RPjqW9TyRMUsEDi3KruD136xHEaLeLTmRK\"] zs1fu9l5qfpgqv4xw8xt477tr66uczpxgrunhjg3ann46vlx6wudhfhwcutdr2asjw5tykq6ha6hu4

Output will be like below:

{
  "remainingUTXOs": 0,
  "remainingTransparentValue": 0.00000000,
  "remainingNotes": 0,
  "remainingShieldedValue": 0.00000000,
  "mergingUTXOs": 1,
  "mergingTransparentValue": 56549.63598796,
  "mergingNotes": 0,
  "mergingShieldedValue": 0.00000000,
  "opid": "opid-b51cc28b-05d8-44f1-80e3-0c9ab0e13fc4"
}

That was the last step. Hope all your funds are migrated now.