Business and family affairs often need multiple signatories for an address.

Let's see how one would go about spending from a multi-signature Veil address.


The Veil GUI (graphical user interface) wallet does not provide methods for handling multi-signature business, so we will be doing this entirely on the command line, as well as using a text editor (or any suitable substitute) for copying and pasting and keeping notes.


Before you can spend from a multisig Veil address you will need to have created a special multisig address with a number of people, a certain number of the total being necessary before a transaction is considered complete enough to spend funds. For this tutorial, let's suppose that you already have a 4 of 7 multisig address holding funds.


Step 0

All the people involved will have installed a Veil wallet and will be able to use either the command line interface (in Terminal or a Command prompt) or can type commands in the Debug Console of the GUI Veil wallet.

Each person has a basecoin address that has been used to create the multisig address. (More on this elsewhere.)
Your powers combined equal the power to spend the funds in the multisig address.


Step 1

You should have some kind of agreement on the valid use of the funds, so let's suppose that you have a list of specific addresses that belong to specific people to whom will be paid specific amounts of Veil. When okaying this multisig transaction the signatories would be expected to check what spending the transaction will actually do, and to check that this matches the agreed spending per your list.


Step 2

One of the signatories will create the initial, unsigned transaction with the createpsbt command (Create Pre-signed Bitcoin Transaction). createpsbt 'wants' a list of the unspent transaction outputs (utxos) that will be spent, and the addresses and amounts to be paid to. For example,

createpsbt '[{"txid":"17a421fbee85e1773a53556da6ea06836751245c9a6bed754f29106857", "vout":3}, {"txid":"55da595d15685d61db9b9bcb84bd41f2926c928552ae786627d5a06cfe", "vout":13}]' '[{"bv1qfll5pfuza03ylne86fckcpvkhmeffuf9":5000},{"bv1q89sxguqz87rau86vr4dthq28v4782pvl":3000},{"bv1q6v9y3rf8x5vjnyauxa2mlhvhjwupljcy":4000},{"bv1qf8hk8s3p3r0tpkjjjra6fd586de2qfs4":4000},{"bv1qevpxm6g4lp7ysx3k2zqr9g6763xr234s":5000},{"bv1q755jwz39hcmq6yagmuvajczz9v82lhz0":3500},{"bv1qyl9ehxf9gkwaj6c8qye2jwjj0q800v8c":2500},{"bv1qkw64cdfzlvrnhte8c4x85xw6lfkasfrd":2500},{"bv1qxprvwv03kafw869ajuexuecnr399a36a":3500},{"bv1qxavfzwjjjsrp20w5333pxgauhh23nq9w":3000},{"bv1q9nzaufgurar3muy7nuqkdk4987egm8cw":4000},{"bv1q5qsjletxmssjuxy72xdhx9ccaa54s9us":3500},{"35uSZnfaYB293sJ8ptUEXkUTQXH8":109720.18}]'

You will note that the UTXOs are denoted by their transaction ID (txid) and the output number. The data is in JavaScript Object Notation (JSON) format. The outputs are simply the addresses and amounts.

 (The above code is all on a single line.)

See listunspent to find which UTXOs you can spend. The final output is for the return of change to the multisig address. So you should ensure that the sum of the outputs equals the sum of the inputs, minus 0.01 Veil for the fee.

You may find it easier using Coin Control to find your unspent transaction outputs and their amounts, but just so you can identify it better, if you copy and paste the `listunspent` output into a text editor, here is an example (testnet example only) found by searching in the text editor for the basecoin address to find the suitable utxos.

From this it may be helpful to use a spreadsheet (see the example below) instead of a text editor, in order to ensure you add up the amounts accurately. Observe that this record (above) begins with the opening curly bracket and ends with the closing bracket and comma.

Now that you have a list of available utxos and what they add up to you can process to build your `createpsbt` command as we saw earlier, once you have your addresses and amounts to pay out, the change return address and the correct change amount.


Step 3 (You and each signatory will do this step and the next (checking and signing), and the last will broadcast the transaction) Each additional signer must take the latest PSBT, not the first one.

The output of your createpsbt command is the PSBT (Pre-signed Bitcoin Transaction).
This is referring to the protocol being used. It is still called a PSBT even when using Veil.

It should look something like this: 

cHNidP8BAP38AQIAAAAAAAACj6RXaBApT3Xta5pcJFFngwbqpm1VUzp34YXu+yEBpBcDAAAAAP////82Hv5soNUnZniuUoWSbJLyQb2Ey5ub22FdaBVdWZ3aVQ0AAAAA/////w0BAFA5J4wEAAAWABSeU//QKeC6+JPzyfScWwFlr7ylPAEAMO99ugIAABYAFMCOWBkcAI/h94fTB1au4FHZXx1BAQBAlFKjAwAAFgAUjvTCkiNJzUZKZO8N1W/3ZeTuB/IBAECUUqMDAAAWABTZknvY8IhiN6w2lKQ+6S2h9NyoCQEAUDknjAQAABYAFJdywJt6RX4fEgaNlCAMqNe1Ew1RAQC4QeguAwAAFgAUZb1KScKJb42DROo3x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BT"

making sure that it has the expected input(s), output(s), and fee. (I have truncated the one above, so it won't work, but yours should have a long output that you need to scroll through to check all the details.)


Step 4

Process the checked PSBT by:

walletprocesspsbt "PSBT"

This will give you a new PSBT. Each time this is processed by another signatory the PSBT will gain an additional digital signature, changing the PSBT slightly. When sufficient signatures have been gathered according to the configuration of the multisig address (for example, four of seven) the decoded psbt will show

"final_scriptSig": {

where previous signers would have seen 

"partial_signatures": {


Adding the final signature (using walletprocesspsbt) will show at the end 

  "complete": true
}


Step 5 The last signer can finalize and then broadcast the transaction

The transaction is ready to be finalized and then can be broadcast by the last signer to sign, once it shows as complete.

finalizepsbt "PSBT"

This will give you a "raw transaction" as output and also show that it is complete.
Use the part between and including the "quotation marks."

Broadcast the FinalizedTransaction like so

sendrawtransaction "0200000000000SOMEOFTHISISDELETEDc7ba05eb3ea4c53ede361d418ea001473044022005175345df2e0f5cf8cee989962ecdfc510d866b8d70b45c70931b3a859107c7022060443717f4edd1dcded504eb4c7384aa073ee9ef15da22f3ca24e6143e9686a00147304402203c422115a41f72919a777161ca5bd7a130dda8d35dd83a83b7342591664c189c02201b406be214874db96383a3fb7f7e0d0ad5ed2d072540bc4438640ea10d02b8ab014730440220710edbb4c4b2375ece87b02d6827fb343c7427dbf70b42a1759cd079bfbe33f402204057984c1a86c00c9dc9672c805095969f382a3b1ff2387bda39ce557e9ccd58014d13015421036c40f8f7a97335b1713531f42a05476eac39af23ec26bb3dd011091435d11a942103ccd465527a9894e44a74ff04bb02278d9d30d14b9e41bee82084da9c2dbdbb032103776d11513ec1f19d7c59635d0e6ecb836e3f3346597ac91f946f7822204bc4b3210236b1e478b47125ea500dad619f368564752587305385a6f42d60d4e1d1934d5f2103168b14fa71340812475b894262b933faf919f11dfc5b2ab02f4418b42fcdbd652103c7e5df9e6bb70b0defac4dcc4728290c951a716c6409342c4f6d65a92f02608a2102702a29f314f22fb314e2b184fae957ba0ec24cc2ea87c1f2228bbe6031e583f22103075aff5eedaa71963dfd6ec9daa925a5e52999d676de456a000ed7ca4ea2d04d58aeffffffff361efe6ca0d5276678ae5285926c92f241bd84cb9b9bdb615d68155d599dda550d000000fd37020047304402203d34bfd12822c735218e6f46719d116cd9e22b80207f3dd87c0936bd21e157b102206cd2589f19f57bb8b88bd0bdca3a178224fd3c91e18c9bddf388f1fd7225b3fa0147304402207569a65f8f600310054944430df61e2b379a463db78b8b36e26e1f18511b014b02203a8e593e8b89ee744be6260097cb33e70759688f83091f64620660ab12dd3ab00147304402200cd961a7052539e4442dc02b9617426022f785afe450cde1b84c5558b8a1345d0220119475c43bbab35ed904925fc4b94dcc1ddea648710bb8dcacce415cfebd484801473044022022578f93c80c22fee731b5133dbf5221226fbdd7af3d04176694b7ae0a84eb0502200f90e1624e45a6df1c1b2ad9c424cc31339988a02a851befdbf2483ba75560d6014d13015421036c40f8f7a97335b1713531f42a05476eac39af23ec26bb3dd011091435d11a942103ccd465527a9894e44a74ff04bb02278d9d30d14b9e41bee82084da9c2dbdbb032103776d11513ec1f19d7c59635d0e6ecb836e3f3346597ac91f946f7822204bc4b3210236b1e478b47125ea500dad619f368564752587305385a6f42d60d4e1d1934d5f2103168b14fa71340812475b894262b933faf919f11dfc5b2ab02f4418b42fcdbd652103c7e5df9e6bb70b0defac4dcc4728290c951a716c6409342c4f6d65a92f02608a2102702a29f314f22fb314e2b184fae957ba0ec24cc2ea87c1f2228bbe6031e583f22103075aff5eedaa71963dfd6ec9daa925a5e52999d676de456a000ed7ca4ea2d04d58aeffffffff0d01005039278c0400001600149e53ffd029e0baf893f3c9f49c5b0165afbca53c010030ef7dba020000160014c08e58191c008fe1f787d30756aee051d95f1d410100409452a30300001600148ef4c2922349cd464a64ef0dd56ff765e4ee07f20100409452a3030000160014d9927bd8f0886237ac3694a43ee92da1f4dca80901005039278c0400001600149772c09b7a457e1f12068d94200ca8d7b5130d510100b841e82e03000016001465bd4a49c2896f8d8344ea37c67658108ac3abf70100a89c1346020000160014fc49f2e6e6495167765ac1c04caa4e949e03bdec0100a89c1346020000160014222ced570d48bec1ceebc9f1531e8676be9b76090100b841e82e030000160014300c11b1cc7c6dd4b8fa2f65cc9b99c4c71297b1010030ef7dba020000160014c0cdd6244e94a501854f75231884c8ef2f7546600100409452a3030000160014920b3177894707d1c77c27a7c059b6a94feca3670100b841e82e03000016001446e8084bf959b7084b86279466dcc5c63bda56050180e0d9dbcb63000017a9142e39b5d4e6b30f08f3285b8037e285e74299321887" false false

I have altered the particular raw transaction above so that it will not decode, as you only need an example, but take note of the " false false" at the end. This is firstly to avoid a high fee that might occur due to a mistake forming the transaction, and secondly, to avoid using "dandelion protocol" in the broadcast, to ensure that it actually is broadcast immediately.


See also: