Skip to content

Instantly share code, notes, and snippets.

@pinheadmz
Last active June 21, 2022 15:45
Show Gist options
  • Save pinheadmz/0406c1a0dfc98877180ff02dc3154e9a to your computer and use it in GitHub Desktop.
Save pinheadmz/0406c1a0dfc98877180ff02dc3154e9a to your computer and use it in GitHub Desktop.

NOTE: These example commands are for windows shell only and you must be careful to copy/paste them as written, ESPECIALLY the punctuation, and ESPECIALLY the weird double-double quotes around strings like ""default""

Open Bob Wallet, log in, go to settings > wallet > API key and click "view API key". Copy the value, it will look something like this:

21060251f5c7a63fa9b364d756e2f22402278e30

Next, open command prompt (can be found by searching in the windows menu)

Execute this command with your own API key you copied from Bob:

SET apikey=21060251f5c7a63fa9b364d756e2f22402278e30

Next run this command:

curl x:%apikey%@127.0.0.1:12039/wallet

Your output should look about the same as this example below, but with the names of wallets you have created in Bob:

[
  "primary",
  "test",
  "zoo"
]

Now create a 2 of 3 multisig wallet called "gateway-ms":

curl x:%apikey%@127.0.0.1:12039/wallet/gateway-ms -X PUT --data "{""m"":2,""n"":3}"

Your output should look similar to this:

{
  "network": "main",
  "wid": 3,
  "id": "gateway-ms",
  "watchOnly": false,
  "accountDepth": 1,
  "token": "cc4a6d9c88cd08d2962c83f6160b0cde85c8e4fe2476355f5c733db6ad197e34",
  "tokenDepth": 0,
  "master": {
    "encrypted": false
  },
  "balance": {
    "account": -1,
    "tx": 0,
    "coin": 0,
    "unconfirmed": 0,
    "confirmed": 0,
    "lockedUnconfirmed": 0,
    "lockedConfirmed": 0
  }
}

Get your 24-word seed phrase with this command. Write it down and keep it safe!

curl x:%apikey%@127.0.0.1:12039/wallet/gateway-ms/master

Example output (NEVER SHARE THIS, this example is just a test). All you need to write down is the "phrase":

{
  "encrypted": false,
  "key": {
    "xprivkey": "xprv9s21ZrQH143K4ARW7MubpBqfHuSwwxocFcRf5dmFMioBGdZrXP5Rh2JsZzxVyUBHLyJp4bPMMbKEgnaHQEbG8NXLmpHHBnRZedSWVGzKGgL"
  },
  "mnemonic": {
    "bits": 256,
    "language": "english",
    "entropy": "9a33723a633e601acdab0c5a0d6927b1be5a7543267091c992f375bdcf0480d2",
    "phrase": "olive oppose model shoe toward aspect cute ghost foam hero enemy gloom toss deny arrive sock mushroom erode rubber twin table liquid addict erupt"
  }
}

You need to set a strong passphrase for this wallet! This requires two commands:

FIrst:

curl x:%apikey%@127.0.0.1:12039 -X POST --data "{""method"":""selectwallet"",""params"":[""gateway-ms""]}"

Example output:

{"result":null,"error":null,"id":null}

Then execute (obviously, change STRONGPASSPHRASE to your passphrase):

curl x:%apikey%@127.0.0.1:12039 -X POST --data "{""method"":""encryptwallet"",""params"":[""STRONGPASSPHRASE""]}"

Example output:

{"result":"wallet encrypted; we do not need to stop!","error":null,"id":null}

Next we need to get your xpub:

curl x:%apikey%@127.0.0.1:12039/wallet/gateway-ms/account/default

Example output:

{
  "name": "default",
  "initialized": false,
  "watchOnly": false,
  "type": "multisig",
  "m": 2,
  "n": 3,
  "accountIndex": 0,
  "receiveDepth": 0,
  "changeDepth": 0,
  "lookahead": 200,
  "receiveAddress": null,
  "changeAddress": null,
  "accountKey": "xpub6DGxx4QHy9yNwLPVj5D5jESmAnGHvrLeaqvj8ajfekv7ACJcbrtD64BKtLvF82kAXvyY1yRn3UzmpFoqzvDz3WND5Mnug7eGqT8ox4Z1fcr",
  "keys": [],
  "balance": {
    "account": 0,
    "tx": 0,
    "coin": 0,
    "unconfirmed": 0,
    "confirmed": 0,
    "lockedUnconfirmed": 0,
    "lockedConfirmed": 0
  }
}

In this example, the data you need to send to the other multisig particpants is this line:

"accountKey": "xpub6DGxx4QHy9yNwLPVj5D5jESmAnGHvrLeaqvj8ajfekv7ACJcbrtD64BKtLvF82kAXvyY1yRn3UzmpFoqzvDz3WND5Mnug7eGqT8ox4Z1fcr",

The other multisig participants will also send you long strings like this. You need to add them to your wallet like this. You will run this command once for each xpub you get from the other participants (so twice total, but with different xpub strings each time)

curl x:%apikey%@127.0.0.1:12039/wallet/gateway-ms/shared-key -X PUT --data "{""account"":""default"", ""accountKey"":""xpub6DGxx4QHy9yNwLPVj5D5jESmAnGHvrLeaqvj8ajfekv7ACJcbrtD64BKtLvF82kAXvyY1yRn3UzmpFoqzvDz3WND5Mnug7eGqT8ox4Z1fcr""}"

Output should look like this:

{
  "success": true,
  "addedKey": true
}

Once you have imported both keys, you are done!

Verify your wallet matches the other participants:

curl x:%apikey%@127.0.0.1:12039/wallet/gateway-ms/account/default

Output should look like this:

{
  "name": "default",
  "initialized": true,
  "watchOnly": false,
  "type": "multisig",
  "m": 2,
  "n": 3,
  "accountIndex": 0,
  "receiveDepth": 1,
  "changeDepth": 1,
  "lookahead": 200,
  "receiveAddress": "hs1qp9wpwlvvplzc7qp6w0fuew39ldlj9rj0g7zuuth7krhf8em5fj6qed6w2a",
  "changeAddress": "hs1qsp63kqprm5stmlg2r3h4k8zx0gcglwtsjrmn2ehu0apmxy4tvy9s45c766",
  "accountKey": "xpub6DGxx4QHy9yNwLPVj5D5jESmAnGHvrLeaqvj8ajfekv7ACJcbrtD64BKtLvF82kAXvyY1yRn3UzmpFoqzvDz3WND5Mnug7eGqT8ox4Z1fcr",
  "keys": [
    "xpub6CK4GKZshmzHaBg55mz4a1xupmdfQ7Sw37cAH6dmvayjcRQoApLs63miCdHg7vuxviifJr4yqfsJVSnpd7DUFCa7LAqnCMFCvgPgmNxWzPb",
    "xpub6DEy8gVKMPAWwm3CWaELCepRotnzVS2YyhmJQugDweKn5N1o1pVjguqEr1qV9Pxr2itUwQqPoNCkPm7cB5bZgU5UUC2WwXJswvni68g1tFu"
  ],
  "balance": {
    "account": 0,
    "tx": 0,
    "coin": 0,
    "unconfirmed": 0,
    "confirmed": 0,
    "lockedUnconfirmed": 0,
    "lockedConfirmed": 0
  }
}

This time, the important data is this line, you want to make sure it matches the same output as the other multisig participants:

"receiveAddress": "hs1qp9wpwlvvplzc7qp6w0fuew39ldlj9rj0g7zuuth7krhf8em5fj6qed6w2a",

NOW you must restart Bob Wallet. When it re-opens you should see "gateway-ms" listed as an available wallet in the menu. Enter your passphrase to log in. If you go to the "receive" tab you should see the same "receiveAddress" we had earlier. It does not fit correctly in the display! Because Bob is not ready for multisig yet. But that address WORKS. You can transfer your TLDs to that address and those transactions will appear in the Bob Wallet history / portfolio.

YOU WILL NOT BE ABLE TO SIGN multisig transactions with the Bob Wallet interface. You can do so with more terminal commands, but I think that's enough for today, don't you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment