Crypto Academy Season 3 | Advanced course - Task 5: Multisig Wallet(Electrum)-- "m of n" Combinations

in SteemitCryptoAcademy3 years ago (edited)

005.png

sap204.png

Background

A wallet is a dApp on top of Blockchain to enable you to send/receive and/or manage your crypto assets. All of us are familiar with a wallet and sending a transfer to another peer is a very basic necessity/use-case in the crypto ecosystem.

In Week 3 we covered how to send multiple outputs in a single click. So when we consider a transaction, the various parameters we come across are input, output(s), Txn ID, etc. To make a transfer we need to sign it.

This week we will discuss in detail about Mutlisig wallet and will practically explore sending a transaction which would require multiple signatures to broadcast it. We will keep it central to BTC(Electrum Multisig Wallet).

sap204.png

Multi-signature wallet

In general, a transaction requires the sender(owner of the private key) to sign it and broadcast it to the network. When we say this, we refer to a single owner who has exclusive access to the fund. So technically only one private key is needed to sign & broadcast a transaction.

By contrast, a Multi-signature wallet is one that requires two or more signatures to sign and broadcast, so technically here you need two or more private keys to sign the transaction.

A Multisig wallet generally comes in "m of n" combinations where:-

  • m refers to the number of signatures or authorization
  • n refers to the number of cosigners

"m of n" combinations can be 2 of 3, 3 of 5, 5 of 7, and so on.

For spending in a Multisig wallet[m of n] you need at least m signatures to broadcast a transaction.

screenshot - 2021-07-25T172003.227.png

For instance, in a 2 of 3 wallet, you need 2 out of three cosigners to sign that transaction and broadcast it to the network. In other words, we can say at least 2 out of 3 co-owners must agree to spend.

sap204.png

Single key, Mutlisig & Use-Case

A single key wallet always has a very limited and restricted business use-case, mostly signifies an individual owner of the wallet.

Multisig wallet brings a wide variety of business-use to the table and in addition to that, the use-case of a Multisig wallet can also make an individual owner more secure, as a Multisig wallet can also be used like 2-factor authenticator(in a decentralized way) just like the OTP, 2 FA in centralized Exchange Wallet.

A single key wallet can be easy prey for malicious elements with phishing attacks, whereas a multisig wallet shields the owner(s) from such risks. Because the malicious elements have to hack "m" nos of keys to spend the fund.

From an organization/business perspective, a single key wallet is undesirable as that could be a single point failure. Further, with a single key wallet, the execution of distributed decision-making process is not possible.

From the security point of view, A Multisig wallet always adds an additional layer of security to the funds.

For organizations, a Multisig wallet can be used to reach a consensus.

So the potential use-cases of Multisig wallet are:-

(1) Escrow:-

With [2 of 3] Multisig wallet the buyer and seller can trade in a decentralized way for the exchange of goods/services, they can bring in a third party as arbiter into the loop, only in the case of a dispute.

  • If the Buyer and Seller agree, then they can easily spend the fund in a 2 of 3 Multisig wallet
  • In the case of a dispute, either arbiter, and the buyer or arbiter and the seller can spend the fund

(2) Joint Account in Family

Husband, Wife, Kid (or any other Members) can create a [m of n] Multisig wallet for the Family, and they can spend based on the collective decision within the family.

(3) Additional Layer of Security

By default, a Multisig wallet enhances the security features as multiple keys are required to spend the fund. So apart from being an Enterprise solution, it has its use for the individual owners too.

Setting up a 2 of 3 Multisig wallet can act as Two-Factor Authentication.

For example-

  • Wallet 1- Desktop
  • Wallet 2- Smartphone
  • Wallet 3- Paper Wallet(Offline)

So every time a user needs to spend, it requires to sign it from at least two wallets. So he/she has to sign it both on the desktop and Smartphone. In case, he lost his Smartphone, he can use a paper wallet or should restore the wallet to a fresh device.

(4) Consensus/Decision Making

Let's say a company has 7 board of directors, and as per the constitution of the company, 5 out of 7 need to sign to reach a consensus.

So they can set up a [5 of 7] Multisig wallet and only when the majority agrees(at least 5 out of 7) they can spend the fund. So it will be more fair and transparent for the business process too.

sap204.png

How does it work

Contruct a Multisig Wallet

Customer Journey Map (Timeline) (19).jpg

sap204.png

Send a Transaction using [2 of 3] Multisig Wallet

Customer Journey Map (Timeline) (20).jpg

sap204.png

Setting up of a 2 of 3 Multi-sig wallet

Some of the best and reliable Multisig wallets are Electrum, Coinbase, Bitgo, etc, but we will practically explore it in Electrum today.

Go to https://electrum.org/#download

Click on Window Installer (for Windows 7 and higher). For Android it is available on Google Playstore,(you can also download it from here).

screenshot (67).png


After the download is completed, install it.

screenshot (68).png


Then go to File, create a New Wallet file. Name it as Wallet file-1(or Cosigner 1). Click on Next.

screenshot (69).png

screenshot (70).png


Select the Wallet Type-- Multisignature Wallet. Click on Next.

screenshot (71).png


Now specify the combination (m of n-- Signature/Co-signer), as we are setting up a 2 of 3 Multisig wallet, there will be 3 co-signers and a minimum of 2 signatures needed to spend. Adjust the slider to set 3 co-signer and 2 signatures. Click on Next.

screenshot (72).png


Select Create a new seed. Click on Next.

screenshot (73).png


Now it will display the seed key, write down the 12 words phrase(seed key) on your notebook/diary/paper, keep it safe, preferably offline. Click on Next.

screenshot (74).png


Confirm the seed key by entering the 12 words phrase in the correct order. Click on Next.

screenshot (75).png


Now it displays the MPK(Master Public Key). It always starts with the letter Z. Copy the MPK, and share it with your co-signers. Click on Next.

screenshot (76).png


You are not done yet, Now you need to follow up with your co-signers to receive the MPKs. As we are setting up a [2 of 3] Multisig wallet, you need the other two MPKs from your cosigners to construct this Multisig wallet.

So basically your Co-signer will repeat the process as we did until now and they will also ask you for the MPK to construct 2 of 3 Multisig wallet. Never share the seed key. You only need to share the MPK with your co-singers.

You should also note down your MPK as well as the MPKs of your co-signers on a piece of paper, or you can also print it.

Now it will ask you to add the co-signers( 2 of 3). You can add them by entering their MPKs. For that select Enter Cosigner Key. Click on Next.

screenshot (77).png


Now paste the MPK of your Cosigner in the designated box. Click on Next.

screenshot (78).png


Again it will ask you to enter the MPK of the Cosigner(3 of 3). Simply paste the MPK of the third Co-signer in the designated box. Click on Next.

screenshot (79).png

screenshot (80).png


Now set a password to encrypt the Wallet keys. Click on Next.

screenshot (81).png


You are good to go now. Your [2 of 3] Multisig wallet has been constructed.

Important Note- You Cosigners have to follow the same process to construct the [2 of 3] Multisig wallet.

Now the very first thing you should do is to check whether the receiving address is showing as same in all three wallets or not. Ask your co-signers to verify the Address.

You should generate New Address first, for that click on the Receive tab, then set Expiry as Never. Generate New Address.

screenshot (82).png

Now ask your Cosigners to do the same and cross-check whether the receiving Address is the same or not. It should be the same for all three cosigners.

screenshot (83).png

sap204.png

Receive

If you click on Receive Tab, you can notice a number of addresses with two types: Receiving & Change. Always share an address with Type as Receiving, the Change Addresses are for the internal purpose of the wallet.

screenshot (87).png

What is the difference between "Receiving" & "Change Addresses"?

Let's say there are three receiving addresses in your wallet with three different amounts, 0.1 BTC, 0.2 BTC, and 0.15 BTC. And you want to send 0.4 BTC to someone, and in three addresses you have a total of (0.1+0.2+0.15) BTC means 0.45 BTC.

So when you send 0.4 BTC to someone, it will send the entire 0.1 BTC(of Address 1), the entire 0.2 BTC (of Address 2), and 0.1 BTC of 0.15 BTC(of Address 3).

But it does not happen like that. Recall the double-spending issue. In Bitcoin, it prevents you to spend unspent transaction outputs partially.

So technically what happens, when you spend a UTXO, it becomes an input for a new transaction and now it can be sent to a number of outputs, but it has to be spent in full. So what Electrum will do is that it will send the 0.4 BTC to the designated address entered by you, and then for the remaining 0.05 BTC it will create another Address within the wallet, which is known as Change Address.

You have nothing to do with Change Addresses, just leave them as they are; they will be utilized as another input when you make the next transaction.

UTXO- Unspent Transaction Output.

Let me explain in the simplest possible way. Let's say you walked down to a Superstore to buy the essential commodities. The billing amount is 450 INR. You hand out a 500 INR denomination at the billing counter, which means you can not divide a denomination of 500, that has to be spent in full, in return, the cashier will return a change of 50 INR to you(because the billing amount is only 450 INR).

So the 500 INR is the UTXO here, it has to be spent in full. Depending on the billing amount, the Sender will receive a change of 50 INR. So 50 INR is the change address here.

sap204.png

Send

Close the wallet. Open it again.

Go to File. Click on Open. Select Wallet_1(or Cosigner-1). If you have named it differently, then accordingly select yours.

screenshot (84).png


Enter the Password, Click on Next.

screenshot (85).png


So now we would perform a transaction from Multisig Wallet[2 of 3]. Please note that at least 2 signatures are needed to spend.

Click on the Send tab, enter the recipient Address(output Address) against "Pay to".

Enter Description(Optional).

Then enter Amount in mBTC.(I have a balance of 0.33585 mBTC, and I will send 0.27 mBTC, so I am sending a partial amount)

Click on Pay.

screenshot (88).png


Now you need to Enter the password to Send. Click on Send.

You can also adjust the fee by clicking Advanced, and set the rate per byte you are willing to pay for this transaction.

Now pay attention to the Outputs. Interestingly I entered only one output, but here it is displaying two outputs, however, it has earmarked one as yellow and specified as Change Address. That means the UTXO of 0.33585 mBTC will be spent in full and via a change Address, Electrum will route the partial amount back to my Wallet.

screenshot (91).png


You are not done yet, recall it's a [2 of 3] Multisig wallet, so you need one more signature at least. So first export this Transaction to File. Click on Export to File, and save it. (Alternatively, you can also Copy to Clipboard, or use QR code)

We will go to Wallet_2(or Cosigner 2) now.

Click on File, then Open, then select Wallet_2. Enter the password, Click on Next.

screenshot (90).png


Now from Wallet_2(Cosigner 2) click on Tool, then Load Transaction, from File. Then select the transaction file, click on Open.

screenshot (92).png

screenshot (93).png


You can now sign this transaction, pay attention to the status on top left, it's showing as partially signed with (1/2), 1 signifies one co-signer has already signed, 2 means at least 2 signatures are needed to broadcast this transaction, so now, you can proceed to Sign it. Click on Sign.

screenshot (94).png

screenshot (100).png


Enter the password, Click on OK. Status changed to Signed now. Finally, click on Broadcast.

screenshot (96).png


Now click on the Addresses tab, you can notice a Change Address is reflecting the remaining balance of your wallet.

Go to Block explorer now(Blockchain.com or Blockchair) and input the transaction ID or Address.

screenshot (97).png


Now you will notice that the input is one but the outputs are two, you must be wondering how come another output get into the picture whereas I entered only one output, the second one is the Change Address automatically created by Electrum to route the remaining balance back to your wallet again because UTXO can't be spent partially.

Backup Seed & Export Private Keys of Individual Addresses

Open your Electrum Wallet.

For Seed-- Click on Wallet, then Seed, then enter Password, Click on OK.

screenshot (98).png


Export Private Keys

Click on Wallet, then Private Keys, then Export, enter Password, Click on OK.

screenshot (99).png


Please note that in a standard HD wallet, all the private keys are rooted to a single seed key.


mBTC= One thousandth of BTC, so 1 BTC= 1000 mBTC

sap204.png

Homework Task (Season 3/Week-5)

(1) What is a Multi-sig wallet? How is it different from a Single key wallet? What are the different uses of a Multisig wallet?

(2) Download, install & set up a 2-of-3 BTC Multisig wallet(Electrum)? What is the difference between Seed key and MPK? Would you share the seed key or MPK with your co-signer and Why? (Screenshots Needed)

(3) How many different "m of n combinations" Multisig wallet you can construct in Electrum? How do you Export your Seed & Private Key(Electrum) in a Multi-sig wallet? (Screenshots needed)

(4) Perform a real transaction(Send BTC) to another Address using a 2 of 3 Multisig wallet? (You can perform a micro-transaction for this Task, also send a partial amount to demonstrate your experience with Change Address, screenshots needed).

(5) What is the difference between Receiving Address & Change Address? Demonstrate your experience with a Change Address?

Important Note-

Please note that BTC transaction fee is not that high(that is expensive only when you use Centralized Exchanges), So I would suggest you using ChanngeNOW to exchange your Altcoin to BTC if you don't have BTC(It is indeed very cost-effective, costs less than $0.4 for 15 USD worth exchange).

changenow1.png

Further, ChangeNOW might not support a Multisig wallet address, in that case first create a standard wallet in Electrum, and then use that address for the exchange in ChangeNOW. From the standard address, you can transfer the BTC to your Multisig wallet. Then you can perform the transactions for this Task. If you still need any help on this, join me in the comment section.

Guidelines

  • Your article should be at least 300 words.
  • It is always better to gain sufficient user experience before submitting your article.
  • Refrain from spam/plagiarism. This task requires screenshot(s) of your own experience. Use images from copyright-free sources and showcase the source, if any.
  • This homework task will run until 31st July'2021, Time- 11:59 PM UTC.
  • Users having a reputation of 60 or above, and having a minimum SP of 500(excluding any delegated-in SP) are eligible to partake in this Task. (Must not be powering it down)
  • Add tag #sapwood-s3week5 #cryptoacademy in your post and should be among the first five tags. You can also use other relevant tags like #electrum #wallet #multisig #blockchain or any other relevant tag. And also make sure you post in the Steemit Crypto Academy community.
  • Those who include the real transactions/screenshots will score better.
  • Always hide sensitive info.

(Please feel free to join the comment section if you have any doubt on Homework-Task)

Thank you.

sap204.png

Cc:-
@steemitblog
@steemcurator01
@steemcurator02

sap204.png

Unless otherwise stated, all the images, infographics, charts, tables, etc(if any) are my original works. The screenshots are taken from Electrum & ChangeNOW.

sap204.png

Sort:  

I sincerely want to cease this opportunity to apologize for my unjustifiable mistake of not putting source to the images used during one of the tasks in the academy hence not sticking to one of the rules guiding this amiable community. It was quite unintentional and clear case of omission as some were seen to have source in them and some missing. I appeal that I'm given a better chance to be back and plead that the ban on me be lifted so that I can continue to study in the community and keep broadening my intellectual horizons. I am well guided and pledge to add extra care so as not to fall victim on this anymore. Thanks for your understanding and best regards.

Cc:.
@whitestallion
@bright-obias
@yohan2on
@lenonmc21
@sapwood
@endingplagiarism

Thank you. We will check it out and update the sheet accordingly.

Dear prof. I have some confusion in the description under the heading

What is the difference between "Receiving" & "Change Addresses"?

There is a total of 0.55BTC instead of 0.45, please confirm.
Thanks!

Corrected Now.

Thanks for the proofreading.

Hello prof, there is a problem in receiving BTC in Electrum as receiving address is not accepted by the exchanges and shows the error invalid format. What to do in such a case? Please guide me. Thanks!

This concept is very new to me. Not use those wallets in before. Thanks for making great lecture on it.

I try my best to Participate and provide my post soon.

Yes, we get to learn new things through Crypto Academy.

Thank you.

Agree. Very useful for learning about Market.

without having to go to the company? We have put together a very simple tutorial that can help you with this!

curso de desenho em Nova Iguaçu

https://epic-photo.org/curso-de-desenho-em-nova-iguacu-rj/

Simply explained and I look forward to submitting my homework but please professor regarding question 4 where we are supposed to perform real transaction, can you please give us the minimum amount.

Any smallest possible amount; it can be even as low as $1 worth BTC.

If you dont have BTC I would suggest you exchanging your alts for BTC using ChangeNOW, that's very cost-effective. And first create standard BTC account(in Electrum) if you want to exchange with ChangeNOW, then transfer the fund from standard to Multisig, then using Multusig perform a transaction required for this Task.

Thank you.

Thank you for this explanation.

How about blockchain fees for the BTC transactions?

 3 years ago (edited)

Yes, you would incur fees, but the actual fee charged by the BTC network is low(not like centralized exchanges).

You can also set/customize your own fee in Electrum, which will be even more cost-effective for you.

Thank you.

 3 years ago 

Wow, what a knowledge. Well explained!! Thanks for sharing this piece.

Thank you.

hi, professor @sapwood can I participate in the lectures of the crypto academy.

Coin Marketplace

STEEM 0.15
TRX 0.12
JST 0.025
BTC 56208.10
ETH 2476.58
USDT 1.00
SBD 2.26