Address Verification when Changing Keys for Unchained Capital Vaults

Don’t Trust. Verify. by @vicariousdrama 649093–649108

Vicarious Drama
Coinmonks
Published in
8 min readSep 19, 2020

--

Summary

Unchained Capital describes itself as a bitcoin native financial services company offering collaborative custody multisignature vaults and loans for bitcoin holders.

The vaults, which are free to setup with a KYC profile, allow the client to control 2 keys while they control a backup key. Periodically, a user may mark a key as lost or stolen or otherwise need or desire to replace it. Within the web application for managing Vaults, addresses are displayed that the user should verify independently to ensure that their signing devices will have the ability to spend. This steps for address verification are not covered in detail within the application so I’ve prepared this article to give some guidance in that regard.

If you follow along and have a vault to try this with, I hope this will improve your understanding of how to verify addresses in general.

Initial Vault & Key Configuration

For the purposes of this article, I have a vault that uses 2 keys that are derived from a single hardware device. The names and BIP32 paths are as follows

  • hollywood — m/45'/0'/0'
  • balboa — m/45'/0'/1'

When the vault was created with these keys, the “account number” for each was 0, making the full base derived path as follows

  • hollywood — m/45'/0'/0'/0
  • balboa — m/45'/0'/1'/0

The xpubs for each, along with the unchained key can be seen on the External Spend Information dialog accessible from the menu of the vault’s Transact section. Anytime a vault is created, or a key is changed, the information from this screen should be retained. I recommend printing it and keeping with your records. The Download button produces a JSON file that can be used directly with Caravan, converted for use with Electrum and other wallets and is also suitable for printing.

In this case, the unchained key has the following xpub

xpub6EDykLBC5ERX7WREobYaca2ALTFZKLku9RDuPCi2MKf4YbnA4pGF7zVzRqGjrdJK33aeJ2K6qr2qfrz64EikAyEkpbdkmoedFC16smSacJB

Key Replacement Process

When a key is replaced on a vault, a new “wallet” is formulated with new addresses. A transaction to sweep funds from the old “wallet” to the new one in the vault is established, signed with remaining keys, and broadcast. The web application does a good job of explaining this and walking through the process.

For purposes of this example, I create a new key which has the following base BIP32 path

  • crater — m/45'/0'/2'

I plan to replace balboa and specify crater as the Replacement Key. Since I still have access to balboa to be able to sign, I toggle that option on and continue clicking Replace Key.

The vault screen depicts the new key and that a Sweep transaction is in progress.

Transaction details show the keys that can sign for this transaction. Note that balboa is present, but crater is not. The address funds are to be sent to is 31w1VhPmSvoCqQJ227aG83prWyQcDKbjiC and is what I want to verify.

The External Spend Information for the vault still reflects the existing key setup with unchained, balboa, and hollywood, and cannot be used to verify the address in external tools.

Determining the New External Spend Information

To verify the address for the new wallet within the vault, its important to understand how the multi-signature wallet is setup.

The full derivation path for keys used by Unchained Capital vaults and addresses is segmented as follows

Depth 1: 45' — Hardened. Indicates it is for multisig

Depth 2: 0' — Hardened. Indicates it is for mainnet

Depth 3: 0' — Hardened. The account number

Depth 4: 0 — Product key for an account, incremented as used in a vault or a loan

Depth 5: 0 — 0 for a deposit address, 1 for a change address. Unchained Capital doesn’t support change addresses yet so this is always 0.

Depth 6: 0 — The address depth which increments as addresses are used.

Depth 4 is what we need to track to for the new key. Recall that when the replacement key crater was made, it had a BIP 32 path of m/45'/0'/2'.

Each time a key is used in a different vault, it’s product key number is incremented. The very first time it is used on a vault, it starts at 0.

The xpubs that comprise the new wallet are as follows

  • xpub for hollywood key with derived path m/45'/0'/0'/1
  • xpub for new crater key with derived path m/45'/0'/2'/0
  • Xpub for unchained key xpub6EDykLBC5ERX7WREobYaca2ALTFZKLku9RDuPCi2MKf4YbnA4pGF7zVzRqGjrdJK33aeJ2K6qr2qfrz64EikAyEkpbdkmoedFC16smSacJB

If I had not created crater, and instead replaced with another key in my account, then the 4th depth would have incremented. For example, A key associated with 3 other vaults (active or closed) with a base path of m/45'/0'/99'/ would have derived paths of m/45'/0'/99'/0, m/45'/0'/99'/1, and m/45'/0'/99'/2. The next derived path would be incremented to m/45'/0'/99'/3.

Most of the remaining aspects of External Spend Information remain the same. The Address Type is P2SH, and the Quorum is 2 of 3. The starting address index will differ and likely directly associated to the total number of addresses already used in the vault.

Verification with Caravan

With the newly derived External Spend Information, we can load this up in the Caravan which is accessible here:

https://unchained-capital.github.io/caravan/#/wallet

For Extended Public Key 1, connect the hardware device for the remaining key, choose the type and specify the BIP32 Path down to the product key taking care to set the apostrophes where required for hardening. In my example, I enter m/45'/0'/0'/1 for my hollywood key. Click Import Extended Public Key and follow on screen instructions.

Similarly for Extended Public Key 2, repeat the process, but for the new key. In my example, I enter m/45'/0'/2'/0 for my crater key and click Import Extended Public Key.

Finally for Extended Public Key 3, I choose Enter as text, and specify the xpub for the Unchained key. Upon doing so, a summary is displayed

When clicking confirm, you will likely see that there is 0 BTC in the multisig wallet, and no records to display for addresses. At the bottom of the screen, check the boxes for Spent Addresses and Zero Balances.

The addresses are displayed, starting with the first 10.

I can verify address 31w1VhPmSvoCqQJ227aG83prWyQcDKbjiC is at index 2.

Verification with Electrum

This process can also be done with Electrum.

Create new multi-signature wallet

Specify 2 signatures required, of 3 cosigners

Import the public key for cosigner 1

Scan devices

Specify script type and derivation path

For device 2, I repeat the process

And use it’s device and derivation path

And lastly, cosigner 3 for the unchained key

Optionally specify a password

The History is displayed

And the addresses

From this I can verify that the address 31w1VhPmSvoCqQJ227aG83prWyQcDKbjiC intended for Key Replacement is present in index 2. Funds swept to the address would be spendable by me. Two transactions are shown here as I’ve since swept funds out of this wallet when my testing was concluded.

Verification with Electrum Watch Wallet

A watch wallet is convenient to have for verifying addresses on a wallet, as well as reviewing transactions over time. For the aforementioned example, the following public keys are used for this wallet which you can use to test this on your own.

These public keys were derived by using both Caravan and Electrum in prior sections

xpub6FBFAVmiF1pgCYanH9GdbgHbiLkHSUq9c5KkY6c7mEk4o8757p8JsrdXo3zsy3uifqGEsBkp45C4jFYPM1X7k3bgsRmijrjz5edaFsxdodA

xpub6EkQHCE3w9F6qyCAZxW5vh87b969wiKUaB6NnYcjcsuLzPeEckNSffjHPFhP2hKM6jeAtRdoRiPGBJ3F72t6n4psx4gvEyhPsRitDo7yKkj

xpub6EDykLBC5ERX7WREobYaca2ALTFZKLku9RDuPCi2MKf4YbnA4pGF7zVzRqGjrdJK33aeJ2K6qr2qfrz64EikAyEkpbdkmoedFC16smSacJB

Create new multi-signature wallet

Specify 2 signatures required, of 3 cosigners

Specify the master key for cosigner 1

It will display it back to you

For cosigner 2 and 3, repeat the process with those keys

Optionally specify a password

When this wallet loads, it will display its history as follows

If the Addresses tab is not displayed, from the menu bar, select View, and then Show Addresses. Switch to the Addresses tab. The address in index 2 is the one used for the Key Replacement process previously

Conclusion

Determining the intended key information for a wallet is essential to ascertaining whether you have access to an address when sweeping funds during a key replacement process in Unchained Capital.

Both Caravan and Electrum are useful wallet facilitators to be able to see addresses associated with a Multi-signature wallet.

When sending funds between wallets, Don’t Trust. Verify.

Also, Read

--

--