Articles on: Mixin Safe
This article is also available in:

How to use Bitcoin Core CLI to create Mixin Safe?

Prepare the Bitcoin Core wallet



Install Bitcoin Core; please install version 25.0 and above.
Or you can try to use Bitcoin Core GUI to create Safe?
Follow the documentation guide to compile and configure the wallet.
Go to the src directory and run the bitcoin client in the background by typing the command in the terminal:

./bitcoind -daemon
  Bitcoin Core starting


Managing the Safe with Bitcoin Core doesn't require synchronizing Bitcoin node data!

Create a Mixin Safe



Log into the Safe Dashboard and create a New Safe "+ New Safe".

Name the Safe and select Bitcoin network.

Select Bitcoin Core as the private key wallet.


It requires generating two wallets on Bitcoin Core when you select Bitcoin Core as the Owner's Safe:

Key wallet that manages keys;
Script wallet for multi-signature transactions, managing UTXOs.

3.1 Switch to Terminal and input the following command to create a wallet:

$ ./bitcoin-cli createwallet mixin-safe-holder
{
   "name": "mixin-safe-holder"
}


3.2 To generate the address, please run the following command:

$ ./bitcoin-cli --rpcwallet=mixin-safe-holder getnewaddress safe legacy
1Gz4GoSjNV8MxLFt8bE8JTfqJp6b2bXhvZ


Parameter safe: address label
Parameter legacy: it must be in a legacy format; otherwise, the parameter signmessage will not be available.


3.3 Query the wallet address based on the address label:

$ ./bitcoin-cli --rpcwallet=mixin-safe-holder getaddressesbylabel safe
{
   "1Gz4GoSjNV8MxLFt8bE8JTfqJp6b2bXhvZ": {
      "purpose": "receive"
    }
}


3.4 Get the public key
$ ./bitcoin-cli --rpcwallet=mixin-safe-holder getaddressinfo 1Gz4GoSjNV8MxLFt8bE8JTfqJp6b2bXhvZ
{
  "address": "1Gz4GoSjNV8MxLFt8bE8JTfqJp6b2bXhvZ",
  "scriptPubKey": "76a914af5454090a5fed618162431ddc57f67c671e82fa88ac",
  "ismine": true,
  "solvable": true,
  "desc": "pkh([e8a47a9c/44'/0'/0'/0/0]03b08eeab9826f10b68569ff9af26ea350675e9d5cf9274c1990cfe5d7cf2b186c)#n9cxzr97",
  "parent_desc": "pkh([e8a47a9c/44'/0'/0']xpub6CKHxzDBDi8rRzUcRwaYhHgN6nRNuFSqh7dH3CTgzb2Qa7CN6DGzvTJpnoCgCYj9S5JsnXkbiCGgGWjh7egGBouV533cmY7xy7wUBuQGfvX/0/*)#c7p9wm6z",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": false,
  "pubkey": "03b08eeab9826f10b68569ff9af26ea350675e9d5cf9274c1990cfe5d7cf2b186c",
  "iscompressed": true,
  "ischange": false,
  "timestamp": 1686997004,
  "hdkeypath": "m/44'/0'/0'/0/0",
  "hdseedid": "0000000000000000000000000000000000000000",
  "hdmasterfingerprint": "e8a47a9c",
  "labels": [
    "safe"
  ]
}


3.5 Copy-paste the pubkey to the Safe Dashboard and tap Next to save:



Set up members

Add a family member, friend, or coworker you trust as a member and set up a reasonable threshold.

Preview and create the Safe

Active the Safe

6.1 Decode Safe data



Copy the script data on step 1 from the Safe Dashboard and decode the data with the following command:

$ ./bitcoin-cli decodescript 2103b08eeab9826f10b68569ff9af26ea350675e9d5cf9274c1990cfe5d7cf2b186cac7c210261300cb233f092c6c2f787139624b88ea4c774e779b3a257b36a2fcf186a09a7ac937c82926321026e37ea6e1e9a018753e3289387306d8d605351803497021c1a7cf7e6c0a8dab6ad02b001b29268935287
{
  "asm": "03b08eeab9826f10b68569ff9af26ea350675e9d5cf9274c1990cfe5d7cf2b186c OP_CHECKSIG OP_SWAP 0261300cb233f092c6c2f787139624b88ea4c774e779b3a257b36a2fcf186a09a7 OP_CHECKSIG OP_ADD OP_SWAP OP_SIZE OP_0NOTEQUAL OP_IF 026e37ea6e1e9a018753e3289387306d8d605351803497021c1a7cf7e6c0a8dab6 OP_CHECKSIGVERIFY 432 OP_CHECKSEQUENCEVERIFY OP_0NOTEQUAL OP_ENDIF OP_ADD 2 OP_EQUAL",
  "desc": "raw(2103b08eeab9826f10b68569ff9af26ea350675e9d5cf9274c1990cfe5d7cf2b186cac7c210261300cb233f092c6c2f787139624b88ea4c774e779b3a257b36a2fcf186a09a7ac937c82926321026e37ea6e1e9a018753e3289387306d8d605351803497021c1a7cf7e6c0a8dab6ad02b001b29268935287)#q9ngh6sm",
  "type": "nonstandard",
  "p2sh": "3J7w4UTU99Q55q3nxse4qGece52Nc21LKD",
  "segwit": {
    "asm": "0 0f338779ff70a9233ba47940b9136ef7f6f5c7524b49bb01ad66baad9d8864dc",
    "desc": "wsh(thresh(2,pk(03b08eeab9826f10b68569ff9af26ea350675e9d5cf9274c1990cfe5d7cf2b186c),s:pk(0261300cb233f092c6c2f787139624b88ea4c774e779b3a257b36a2fcf186a09a7),sj:and_v(v:pk(026e37ea6e1e9a018753e3289387306d8d605351803497021c1a7cf7e6c0a8dab6),n:older(432))))#p6vc2x03",
    "hex": "00200f338779ff70a9233ba47940b9136ef7f6f5c7524b49bb01ad66baad9d8864dc",
    "address": "bc1qpuecw70lwz5jxway09qtjymw7lm0t36jfdymkqddv6a2m8vgvnwqfnt0pq",
    "type": "witness_v0_scripthash",
    "p2sh-segwit": "342sprEcLKM3sYrCfPtdLemasXwYnAukT3"
  }
}


6.2 Create script wallet

$ ./bitcoin-cli -named createwallet wallet_name="mixin-safe" disable_private_keys=true blank=true load_on_startup=true
{
  "name": "mixin-safe"
}


6.3 Import descriptors to the script wallet

Take the desc under segwit in the data decoded in step 6.1 and import it into the script wallet as a descriptor in the format '[{"desc": "xxx","timestamp": "now", "internal":false}]':

$ ./bitcoin-cli --rpcwallet=mixin-safe importdescriptors '[{"desc":"wsh(thresh(2,pk(03b08eeab9826f10b68569ff9af26ea350675e9d5cf9274c1990cfe5d7cf2b186c),s:pk(0261300cb233f092c6c2f787139624b88ea4c774e779b3a257b36a2fcf186a09a7),sj:and_v(v:pk(026e37ea6e1e9a018753e3289387306d8d605351803497021c1a7cf7e6c0a8dab6),n:older(432))))#p6vc2x03","timestamp":"now","internal":false}]' 
[
  {
    "success": true
  }
]


6.4 Sign data



Sign the data copied from step 3 on Safe Dashboard in the following format:

$ ./bitcoin-cli --rpcwallet=mixin-safe-holder signmessage 1Gz4GoSjNV8MxLFt8bE8JTfqJp6b2bXhvZ APPROVE:c09c6f5f-4461-46a2-a172-4cd970aab955:bc1qpuecw70lwz5jxway09qtjymw7lm0t36jfdymkqddv6a2m8vgvnwqfnt0pq
IOs73u6gnEy9hIIH6zpEXLtaQncAUYkCk6hV8LQxwdxvQz3jOLbEDXJpo669P6sXQVHHpmnlbDbt22HHdgigeYs=


Please note that the parameter “1Gz4GoSjNV8MxLFt8bE8JTfqJp6b2bXhvZ” after signmessage is the key wallet address.

6.5 Active the Safe

Copy the 6.4 Signed data to the step 5 input box and tap the Activate button:



Wait about 30 seconds for the Safe to be activated successfully; you can check if the Safe deposit address is the same![]() script wallet address:


$ ./bitcoin-cli --rpcwallet=mixin-safe getaddressesbylabel ""
{
  "bc1qpuecw70lwz5jxway09qtjymw7lm0t36jfdymkqddv6a2m8vgvnwqfnt0pq": {
    "purpose": "receive"
  }
}






Then you can deposit BTC to the Safe's address.

Updated on: 29/02/2024