Crypto Academy / Season 3 / Week 5 - Homework Post for @sapwood

in SteemitCryptoAcademy3 years ago (edited)

untitleddesign_1_original-160.png

my line.png

MULTI-SIG WALLET

A multi-sig wallet is a crypto wallet that requires more than one private key to sign a transaction. Our normal single key crypto wallet requires just one user to sign a transaction for it to be broadcasted, however, in a multi-sig wallet, there's more than one signature needed to sign a transaction, before it is broadcasted to the network.

In a multi-sig wallet, there could be an 'n' amount of cosigners but a minimum of 'm' of them is required to sign a transaction. E.g, a wallet could have 7 cosigners in total, but requires a minimum of 5 cosigners to sign a transaction. In this case, the wallet can be referred to as a 5 by 7 multi-sig wallet.

Note: an m by n multi-sig wallet requires at least m cosigners out of the total n cosigners registered. The m by n is referred to as the wallet combination

Note: cosigner(s) is a person who is registered in the multi-sig wallet and can sign a transaction

HOW MULTI-SIG WALLET DIFFERS FROM SINGLE KEY WALLET

Single key wallet requires just one private key to sign transactions. This key is held in the custody of the user for a decentralized single wallet.

A good example is the steemit wallet. To send a transaction, you enter the transaction details, including the receiver's address, memo (sometimes optional), and amount


Screenshot_20210730-170629.png

Then you confirm the details of the transaction


Screenshot_20210730-170703.png

Now you enter your private key. This private key is the only key required to sign this transaction because the steemit wallet is a single key wallet


Screenshot_20210730-170724.png

For a multi-sig wallet however, more than one private key is required to sign the transaction. The number of private keys require to sign a transaction depends on the number set in wallet combination explained earlier.

As a result of this difference, a lot more differences between the two is formed. Since multi-sig wallet requires more than one private key, it has wider applications than the single key wallet.

Also, it improves on the security of transactions as the transaction is confirmed more once. It also eliminates the issue of single point of failure in transaction security.

In summary,

Single key walletMulti-sig wallet
Requires only one key to sign a transactionRequires more than one key to sign a transaction
Has no wallet signer combinationHas wallet signer combinations e.g 5 by 7, 2 by 3
Just one confirmation which can be a mistakeRequires more than one confirmation, reducing the chance of making a mistake
Single point of failureDecentralized format

USES OF A MULTI-SIG WALLET

Multi-sig wallet has lots of use cases. Some are listed below

Security

A multi-sig wallet can be used to enhance the security of a transaction. It eliminates the incidence of a single point of failure as a transaction has to be signed by more than one cosigner. The cosigners can be the same person using different accounts on different devices, in which case multi-sig wallet is used as a two-factor authentication.

Consensus

Since cosigners are required to sign a transaction before it can be broadcasted, multi-sig wallet can be used to achieve a consensus.

E.g a case where a group of people need to vote on a decision. In such cases, the total number of eligible voters will be the total number of cosigners while the minimum required number will be set according to the rules of the cosigners (i.e 2/3 of the group can make a decision)

Escrow

Escrow is a service where a third party mediates between two transacting parties for a particular transaction. In a 2 by 3 multi-sig wallet, an escrow can be the third cosigner such that once the transaction is completed, the escrow and the seller can spend the funds and if it is cancelled, the escrow and the buyer can spend the funds.

Collective account

With multi-sig wallet, people can come together to have a single account where each of them can be a cosigner and a minimum number is set to sign a transaction. This can fit a family account where members of the family can be cosigners.

my line.png

SETTING UP ELECTRUM WALLET ON MOBILE

Here's a complete guide on downloading, installing and setting up your electrum wallet on your mobile phone (smartphone)

  • Go to google play store and search for 'electrum wallet' then download and install it.


Screenshot_20210730-182225.png

  • Open it and click on 'Next'


Screenshot_20210730-183057.png

  • Then select 'Multi-signature wallet'


Screenshot_20210730-183520.png

  • After that, set the multi-sig wallet to 2 by 3, by adjusting the upper slider. Then click on 'Next'


Screenshot_20210730-185528.png

  • Select 'Create a new seed'


Screenshot_20210730-185958.png

  • Write down the seed phrase and click on 'Next'


Screenshot_20210730-190249.png

  • Then rewrite the seed phrase in the order it was shown using the onscreen keyboard, then click next.


Screenshot_20210730-190843.png

  • Your master public key will then be shown. Copy it to an accessible location, click 'Next' and close the app.


Screenshot_20210730-190843.png

You've just created the first 2 by 3 multi-sig wallet. We'll call it cosigner 1

  • Open the app and repeat the process all over again, to create another 2 by 3 multi-sig wallet. This will be cosigner 2.

  • After creating cosigner 2, close the app and repeat the process the second time to create cosigner 3.

For each cosigner you create, copy the master public key to an easily accessible location.

Adding the cosigners

  • After you have created the 3 cosigner accounts, open the app again and click on 'Next' to create a new wallet.

  • Select Multi-sig wallet and set it to 2 by 3 then click on 'Next'

  • Then select 'I already have a seed'


Screenshot_20210801-065059.png

  • Enter your seed key generated during the wallet creation then click on 'Next'


Screenshot_20210801-064854.png

  • Your master public key will then be shown to you. Click on 'Next'

  • Click on 'Enter cosigner key'


Screenshot_20210730-194257.png

  • Paste the second cosigner key and click on next


Screenshot_20210730-205739.png

  • Click on 'Enter cosigner key'


Screenshot_20210730-194257.png

  • Paste the third cosigner key and click on next


Screenshot_20210730-205812.png

  • Then you set password to protect your wallet on the particular device.


Screenshot_20210730-194437.png

When you're done, the wallets will be synchronized and it is ready for use.

Note: we just set up the multi-sig 2 by 3 wallet for the first Cosigner.

If you're setting up multi-sig wallet for two factor authentication, you should observe the following steps but if the other cosigners are different individuals, each of them should observe the above setup step, each using their seed keys and any of the other 2 cosigner keys as cosigners 2 & 3 keys.

For two-factor authentication

  • The setup steps has to be repeated again with the seed key for cosigner 2 used, then master public key for cosigner 1 used as the master public key for cosigner 2 while cosigner 3 remains.

  • The setup steps are also repeated again with cosign seed key used, cosigner 2 remains but the master public key for cosigner 1 is used as that for cosigner 3.

At the end, you should have three different 2 by 3 multi-sig wallets created.


Screenshot_20210730-212255.png

Confirming the setup

To confirm what you just set up, check the receiving addresses of all the wallets, they should be the same.


Screenshot_20210730-194702.png


Screenshot_20210731-072043.png


20210731072214.gif

DIFFERENCE BETWEEN SEED KEY AND MASTER KEY

Seed key is used to recover an existing wallet. If an existing wallet is to be used on another device, this can be done using the seed key. The seed key is usually a random combination of 12 words or more. Whoever holds this combination can import or recover the wallet.

Master public key is a key which is used for adding a multi-sig wallet as a cosigner in another multi-sig wallet. It cannot be used to recover a wallet in another device.

Seed keyMaster public
Is a private keyIs a public key
Can be used to import an existing walletCan be used to add a multi-sig wallet as a cosigner in another multi-sig wallet

WHICH KEY IS TO BE SHARED WITH COSIGNERS AND WHY?

The master public key (MPK) of a particular multi-sig wallet is to be shared with other cosigners of other multi-sig wallets to add the particular multi-sig wallet as a cosigner to the other multi-sig wallet.

The seed key is a private key and is not to be shared with anyone at all.

my line.png

HOW MANY m by n COMBINATIONS ARE IN THE ELECTRUM MULTI-SIG WALLET?

In a multi-sig wallet like electrum, an m by n combination is used to setup the number of cosigners

Where:

m = the minimum required cosigners

n = the total number of cosigners

For electrum multi-sig wallet (android version):

The minimum value of n = 2

The minimum value of m = 1


Screenshot_20210731-120518.png

The maximum value of n = 5

The maximum value of m = 5


Screenshot_20210731-131612.png

From the above statistics, (using the format m by n) we have:

  • 1 by 2

  • 2 by 2

  • 1 by 3

  • 2 by 3

  • 3 by 3

  • 1 by 4

  • 2 by 4

  • 3 by 4

  • 4 by 4

  • 1 by 5

  • 2 by 5

  • 3 by 5

  • 4 by 5

  • 5 by 5

That gives 14 different combinations

EXPORTING SEED KEY AND PRIVATE KEY ON ELECTRUM

EXPORTING SEED KEY

Here is how to export your seed key on electrum android version.

  • Open your wallet and click on the wallet name

Note that you might have to input your password. This is the first password you ever set on your wallet.


Screenshot_20210731-145054.png

  • Then click on 'Tap to show' under 'Seed'


Screenshot_20210731-172019.png

  • You have to confirm this in a dialog box


Screenshot_20210731-172046.png

  • Then the seed key will be shown. You can copy this down or click on 'Export backup'


Screenshot_20210731-172202.png

EXPORTING PRIVATE KEY

Unfortunately, on Electrum's android version, you can't view your private key or export. I'm referring to the Electrum wallet, android version 4.1.5, the latest as at the time of writing this post.

To see and export you multi-sig wallet private key, you have to copy your seed phrase from the previous explanation and import your wallet to a desktop version.

If you have a pc, here's how to go about installing electrum on a PC


Screenshot_20210731-215732.png

  • Next, download the software and install it
  • Then run the software, when its open, click on file, and New/restore


image.png
src

  • Now set a name for the wallet so you can identify it on the pc. Don't forget we already have a wallet. After setting the name, click 'Next'


image.png
src

  • Then select 'multi-signature' wallet and click on 'Next'


image.png
src

  • The wallet we're restoring is a 2 by 3 wallet so set the combination accordingly. Then click 'Next'


image.png
src

  • Now, select 'I already have a seed', then click 'Next'

  • You will then input your seed which you must have retrieved from the mobile version, then click 'Next'

  • Now, just like in the mobile version, the Master Public Key will be shown to you. You can us it as a confirmation. Then click 'Next'

  • Also, like in the mobile version, you will add the other 2 cosigners one after the other (via their master public keys) to completely setup the wallet. You will also set a password to encrypt the keys

  • Once you're done setting up the wallet, click on the 'Wallet' tab, then click on 'private keys' and then click on 'export'.


image.png
src

  • You'll have to enter you password before you can export your private keys.

Important Notice: Because I currently have no access to a pc, I have used some of the pictures used by the professor to explain the steps, and I'm unable to provide images for the steps the professor didn't cover. All pictures taken from the professor we're duly sourced.

my line.png

REAL TRANSACTIONS VIA ELECTRUM MOBILE VERSION

I performed a real transaction via the mobile/android version of electrum. Below are the details

Open the wallet on the mobile version and click on the 'Send' tab


Screenshot_20210731-201632.png

Notice that my balance is 0.25437 mBTC

Copy the BTC address you want to send to and paste it in the bitcoin address field. Paste using the paste icon. Also enter the amount, then click 'pay'


Screenshot_20210731-203257.png

Notice that I sent a partial amount of 0.24 mBTC

Next, you have to confirm the payment. Here, you can adjust the fees by adjusting the traget (ETA) the fewer the blocks, the more the fees


Screenshot_20210731-203334.png

Then confirm that you want to send the payment


Screenshot_20210731-203438.png

After that, the first cosigner has signed the transaction, you'll need at least one more cosigner. Notice that it is indicated at the top 'partially signed (1/2)'.

Notice that I sent to a single address but a second address is receiving coins during this transaction. That is my change address receiving the mBTC not sent to the primary recipient.

When a part of the total balance is sent, the total balance is actually sent out of the wallet but only the partial amount gets to yge primary recipient, the rest is rerouted to another wallet address on your electrum account called change address.

Next, click on the QR code at the bottom of the page to the reveal the QR code for this transaction


Screenshot_20210731-205013.png

Screenshot this QR code and send it to another device, you will need to scan this code to sign the transaction with the second cosigner.

Now, close the transaction details page and click on the menu


Screenshot_20210731-205431.png

Select wallets


Screenshot_20210731-205450.png

Then choose the other cosigner who can sign this transaction. Mine is 'CO1'. Then click 'Open'


Screenshot_20210731-211500.png

On this second cosigner wallet, click on the 'Send' tab and click on 'scan'


Screenshot_20210731-211529.png

Then scan the QR code to bring up details of the transaction. Click on 'Sign'


Screenshot_20210731-211730.png

Confirm the transaction


Screenshot_20210731-211800.png

Now the transaction is completely signed, click on 'broadcast'


Screenshot_20210731-211825.png

That's it, payment will be sent.


Screenshot_20210731-211934.png


Screenshot_20210731-212005.png

Shortly after, payment was sent


Screenshot_20210731-224030.png


Screenshot_20210731-224052.png

my line.png

RECEIVING ADDRESS AND CHANGE ADDRESS

The receiving address is used to receive coins into the multisig wallet. So to fund your multisig wallet, you'll be needing your receiving address to receive funds into your multisig wallet. This receiving address is usually the same for all cosigners and can be set to expire.

Receiving addresses are coloured green


Screenshot_20210731-231249.png

Change address is the internally generated address used to reroute unspent transaction output. Take for instance:

I have 1 BTC and I want to send out 0.8 BTC, but because BTC will not permit spending unspent transaction output partially, Electrum will have to send out all the BTC in my account during the transaction.

Electrum will send the 0.8 BTC to the address I provided but the remaining 0.2 BTC will be sent to an internal address generated by my Electrum multisig wallet called a change address. Hence the transaction looks like it's has two outputs like in our example transaction


Screenshot_20210801-162247.png

Change addresses are coloured yellow.

Change addressReceiving address
Coloured yellowColoured green
Used during 'send' transactionsUsed during 'receive' transactions
Used to reroute unspent transaction outputUsed to receive coins into the multisig wallet

From the transaction I did earlier, I sent 0.24 mBTC out of 0.25437 mBTC. Thus there were still 0.01437 mBTC. Fees amounted up to 0.00237 BTC, leaving the balance in my wallet as 0.012 mBTC.

my line.png

CONCLUSION

In conclusion, a multisig wallet is an upgrade of normal single key crypto wallets. Multisig not only has more applications but is also more secured. More than one private key is required to sign a transaction in multisig wallet.

One good example of a multisig wallet is Electrum. On electrum mobile version, you can't access or export your private keys. The wallet is however, very affordable in terms of fees, though it records setbacks in transaction time.

From this lecture, I've learnt how to send BTC over the bitcoin chain at very low costs.

Thanks for reading.

Cc:
@sapwood

Coin Marketplace

STEEM 0.17
TRX 0.16
JST 0.029
BTC 74698.65
ETH 2837.65
USDT 1.00
SBD 2.46