Video - Bitcoin 101 - Multi-Signature Addresses Part 2 - Spending, Protocol and Coding

In many ways, multisig addresses are the answer to most of bitcoin's concerns and fears of theft. And now its time to scale up massive implementation for them. Originally introduced into the bitcoin client a few years ago, multisignature addresses massively more secure than regular ones. Their adoption by all wallet manufacturers is coming. But, for you techies and voyeurs, we'll jump inside the ideas of multi-sig and even program the stuff.

TRANSCRIPT

Hello this is James D'Angelo.  And welcome to the Bitcoin 101 Blackboard Series.  Today we're looking at Part Two.  The last part on Multisignature Addresses or Wallets.  And in the first part we generated a multisig address specifically this particular address right here.  And if you notice the address starts with a 3.  This makes it in a typical Bitcoin Address.  Most addresses as we spoke about in the first video start with the one.  Multisig addresses start with a 3.  And multisig addresses are better.

And we spoke a lot about that in the first video but we're just going to do a quick summary before we dive into the code and actually spend from this particular multisig address that we generated yesterday.  Okay, so we'd funded it with a dollar using Coinbase.  And today we're going to spend some of that money using the multiple signatures required.  Okay, so we're going to use the addresses we generated yesterday.  And specifically, we're going to use the private keys.  Yesterday to generate the address all we needed were the public keys.  Today we're going to use just the private keys to generate the signatures that will sign off on spending this money.

And as I first saw in a speech by Tony Gallippi 2014 can be called the year of multisig.  You're going to see a lot more multisig.  And if the coding bothers you or something like that.  Don't worry, it's going to be incorporated in your Android wallets, your online wallets, however you spend your bitcoins you're going to see lots more multisig addresses.  And as we mentioned lots more multisig security.  Multisig is exponentially more secure.  You are able to store your private keys in three different locations entirely.  You can store some offline.  You can store with different providers.  It makes hacking of Bitcoin infinitely more difficult.  And because you're using digital signatures.  You'll never actually putting those private keys together in one spot.  And that makes it vastly better than Shamir's Secret.

And so, we spoke about 3-party Escrow.  When we spoke about how you could form these trustless setups whereby you can use a wallet provider, a Mt. Gox type exchange.  But you could actually never worry about whether they're going to go out of business or whether they're going to steal your funds.  Because in those situations, you would still keep control of two of the multisig private keys that you need.  While you give the wallet provider just one.  So, they won't be able to act on your behalf unless you've already signed a transaction over to them.  And that's what we're going to be looking at doing today, okay?

 

So, what are Multisig Wallets?  Well, we discussed a lot of that in the first one.  But remember you can create a multisig address with just one line of code.  So, if you take this Bitcoin D line right here create multisig.  And just slap in three public keys.  Stuff that into your Bitcoin QT or your Bitcoin B Blammo it will reward you right away with a multi-signature wallet.  Okay and as we spoke about this number right here is key because this tells you how many of those signatures do you need to sign off.  So, you could set it up such that one signatures all you need.  Two signatures all you need or three.  Right now, with Bitcoin because a blockchain bloat and all that, it's just limited to three but in the future, we might see 5 of 7, 12 of 17.  Those types of situations might vastly improve how sort of a board of directors or a group of trustees might work together.

Other ideas, so many types of ideas that you can attack with multisig.  So, before we jump into this Python code.  Let's actually take a look at the actual transaction that was sent yesterday to this address that we generated yesterday.  And just like any Bitcoin address, you can find all the information right there and go right to blockchain.info, okay.  And here's the actual transaction.  Here's our address and notice it starts with a 3.  And here we sent a dollar and the exchange rate probably changed a little bit not much surprising for Bitcoin.  And now it's down to 99 cents, okay.  And that transaction took place yesterday, which means now it'll have enough confirmations on top of it for blockchain to reward you as sort of this green light.  You can spend those funds, okay.  And blockchains a great site for looking at your addresses.  And you can even see the transaction that was actually made in the specific details of that particular transaction.

But another great new site is called insight.  And this is an open-source sort of blockchain access right here.  And you'll see the same things here.  Okay you've got the address we had from yesterday.  And you could just type that same address right there and search for block transaction address et cetera.  And you see that the transaction took place March 13th, 2014 which was yesterday.  And insight gives you a little more sort of hardcore details than blockchain might.  And so, you see that it's already had 123 confirmations or 123 blocks on top of our transaction from yesterday.  And again, this is the address we're going to want to spend from.  And this is a 2 of 3 address.  So, we're going to dive into this code, the Python code.  And again, you can find this code on our little GitHub Repository World Bitcoin Network Wobine/ Blackboard 101.  And this particular code will be found here.  Down in WBN multisigs' part-two and yesterday's code is there.  And if you've seen some of the other videos will be posting more of that stuff in there, okay.

So, let's get busy.  Let's pull up that code, okay.  Here's the Python code for sending.  You'll see that this is a little more complex than yesterday's, okay.  Yesterday's basically all fit in one little screenshot.  But today's is a little bit longer.  And it's partly longer because I'm trying to provide some security measures.  So, people play with this coin don't run into problems.  And I'm also trying to write up everything that might lead to confusion.  So, there's a lot of comments at the top.  Okay, this one's called Multisigs Part Two.  Spending from a 2 of 3 multisig address.  We can change that little line right there.  So, we got a 2 of 3 and save, this simple wallet works with Bitcoin D and will only work with 2 of 3 Multisigs.  Okay I coded it just for one type of transaction.  And that's for educational purposes only.  Do not start risking lots of money on this.  This is not a test net.  I'm actually doing this live on the Bitcoin network.  So, if you're using wallets, please use very -- very small amounts.  And you'll see that the wallets I used have pretty small amounts, okay.

It's in Python 2.76.  And it relies on Bitcoin D and Bitcoin RPC.  If you're not familiar with these.  I'll have some links in the description about this stuff below.  And it relies on a connection file.  Connection PY file that we had to rewrite to take advantage of the newer multisig.  So, I believe it was Jeff Garzik who wrote the original Python library.  He had yet incorporated the multisig and that sort of sent from raw transaction that we're going to use.  So, I had to rewrite this a little bit.  So, if you're going to use this download my version and just slap it into his collection.  Okay, and these are calls to Garzik software.  And the last one you'll see is the connection call.  And yesterday we ran the code first and then looked at the code.  Today we're going to do it the opposite because there's some details inside the code that won't make sense when we just start running the code okay.

So, we make an object call this connect to local talks to the Bitcoin D blockchain on my laptop's hard drive.  And this is great, because I have all the transactions from all of time.  All the Bitcoin transactions in my hard drive.  You can do this too, it takes 16 to 20 gigabytes depending on how you format.  So, you need at least that amount of space.  And it's growing all the time a little bit so you got to watch that.  But if you've got the space and you like having all the transactions, you can download it and it takes a couple days on most networks and most computers.  Okay so, I have the blockchain inside and it's up-to-date.  And then this is a note right here.  This isn't code.  You need at least two of the private keys from part one.  Two of the three private keys from part one.  Link to your multisig address.  And so, I just stuffed those private keys right in the code.  This is clearly not the way you really want to work.  You want to separate your private keys but for demonstration purposes they're all there.

And if you remember from yesterday we generated three brand-new addresses.  This one this one, this one and this one.  And they came with their private keys.  And so, there's the private key.  And any time you generate a new address in Bitcoin QT or Bitcoin D it stores the private keys.  Therefore, you and your wallet.DAT file kind of hidden a little bit in your computer but it's there.  And so, you can always call up these private keys.  And so, what we did is we just copied these private keys and stuff them into the code.  And remember to send from any Bitcoin address you're going to need access to those private keys.  Okay and so here they are.

Now, one of the big deals when you're sending money in Bitcoin is making sure you at least have a change address that you can control.  We're being really lazy here.  And we're just sending the change back to the original address.  This is kind of sloppy.  You could send it to anything.  I could send it to my donation address or a number of other addresses.  But just to avoid confusion we're sending it back to our original multisig address that we generated yesterday.  If you're going to play with the software make sure to set your own personal change address.  Otherwise all end up where the public who accesses these private keys will end up with the money that was supposed to go back to your address.  And here's set transaction fee.  I actually don't even know what the transaction fee right now is in Bitcoin, it's kind of formulaic.  But I just put in the minimum transaction amount.  And the minimum transaction amount is 5,461 Satoshi's.  Okay so, I kind of wrote it like this then multiplied by a 100 million.  It's kind of foolish way to write it but that's how I did it.

And it's proper etiquette to make sure you put something aside for our friends the miners.  And then this is the big deal.  I'm actually figuring out how much money I have in my accounts.  And what's the status of all these accounts?  So, I create this variable called unspent, which looks at all the accounts in my wallet.debt and any with funds, it sort of stuffs it into an array.  And that array can now be called and you can see all the individual addresses.  And we'll see that because we're going to run the code in a second.  We're not going to go through this whole thing.  But remember you need the private keys.  You need to change address.  It's nice to put in a transaction fee.  And then you need to query your own accounts to see how much you have, okay.  And so, what this is going to do is going to print out the different transaction IDs for each output.  The script public key which you'll need to spend.  And the public address that that particular output is from.  So, let's run this now just to see kind of how this is working.  And we won't let it run the whole way.  We'll just start to get a picture.

So, your Bitcoin QTD has five unspent outputs, okay.  And these are all different outputs that I've used overtime.  And you'll notice that this one here starts with a 1.  That's not a multisig.  This one starts with a 3.  That's a multisig.  This one starts with a 1.  This starts with a 3.  And this one starts with the 1.  So, this is the address we generated yesterday and we sent a dollar to, okay.  And it says that a dollar yesterday was worth about what is that 155,300 Shatoshi's, which is the smallest possible unit you can have in Bitcoin currently.  And then it could also look like this, which is the amount it isn't Bitcoin.  So, it's much less than one bitcoin.  Okay, the transaction ID for the output is this.  The script public key is this.  And the public address as we already know is that.  And that's the output that we're interested in.  So, we're going to say we're going to spend from that output.  So, we'll just type a 4 here and hit return.

Okay, and it says the public address on that account is and we already know that that's the one we asked.  The address starts with the number 3 which makes it a multisig.  All multisig transactions need transaction ID, script, public key and this thing that is unique only to multisigs, the redeem script.  Fortunately, all of this is right there in the Bitcoin D-list unspent Jason from before so, we can just print it all out.  Okay and there it is in the Big Daddy is this redeem script.  You have and it tells me again the amount Satoshi's in this output.  How much do you want to spend?  Well, I'm aware that the minimum that you can spend on Bitcoin right now is 5,460 Satoshi.  So, any number higher than that it should form a valid transaction.

So, let's just make something small one, two, three, four 7,777 Satoshi's and we'll hit return.  Send funds to which Bitcoin address?  Okay. you could send it to any.  I actually have a default address in here to Sean's Outpost which is a charity organization in Pensacola.  So, you could leave that in there, it'll be there stuffed in the codes.  If you don't type anything there your money that you're playing with will go to a wonderful charity putting plates on the table with hot meals for some homeless individuals in Florida, amazing.  So, I'm just going to hit return which you might want to do.  And it will go to Sean's Outpost.  Okay, and it generated a lot of crap.  And we're going to go through that crap real soon because that's really the important stuff.  Send funds to which Bitcoin address?  Okay, you chose Sean's Outpost in Pensacola.  This send to and there's the actual address for the charity, will leave this amount in your accounts and a transaction fee will be sent to the miners.

So, before we move forward with raw transaction which we'll take a look at in a second.  Let's just take a step back and see what we're actually going to be doing.  Remember we've created a situation where we've got three private keys that are working together in one multisig address or one multisig wallet.  So, there's key one, key two, key three and we're using in this case this particular one.  And say we're sending a transaction to overstock.com.  And I did this a little goofy in the last video.  But let's make sure we get it right here.  So, if I put one of these keys into a safe deposit box.  And I've given another key to sort of a newfangled wallet provider that uses multisig addresses which we're going to see soon.  What I'm going to do is I'm going to shop on overstock.com and look around that they're stuff right.  And get some sort of idea of what I want to buy.  And then perhaps even on their site if they start to support multisig, I'm going to create the raw transaction.

So, I'm basically going to say I want to buy that item through the Bitcoin system.  And there's two ways that this transaction can go.  It really doesn't mean anything because it hasn't fully been signed.  But then I'm going to sign that raw transaction.  Okay, using my private key.  And then I'm going to send the signed raw transaction which will have a false ability to spend because it's only been signed by one person.  I'm going to send that forward to my wallet provider.  So, they're going to get this transaction.  That can't change anything on it, okay.  Instead of my private key you'll have an elliptic curve coded digital signature.  So, my private key can't be found.  And they won't be able to change the amount or who it's sent to or who it's from.  The only thing they can do is analyze it and decide if they agreed to sign off on it.  And the signing often it will have a lot to do with what are my spending habits?  Or whatever you decide your wallet provider to be.  Okay, again this is a layer of security.  If someone runs into your house and points a gun at you.  And says send out all your Bitcoins.  All of a sudden, your wallet provider becomes a real valid form of protection and not a risk.  Okay, we're used to them being sort of risks.  Well, they move from the risk side over to the protection side using multisig's, right.

And so, the wallet provider will go hey they like to spend on overstock.com.  This is under their daily limit.  Let's sign it.  So, they sign the transaction.  And they could send it back to you.  They could send it any which way.  But then one of you two will decide to spend the transaction.  Now, that it's been signed by two entities.  And it will have a transaction true on it.  And when that goes to overstock.com.  They will have no more encumbrances.  They'll be able to spend those bitcoins and receive those bitcoins and they'll send you the item you want.  Say you bought some nice cool of a pack of socks from the place in Massachusetts.  Okay, that are now sold on overstock.com, who knows, okay.  And you didn't even use your key which is in the safe deposit box.  And remember, this is kind of like the real punch of the whole thing.  If anything happens to your wallet provider they lose your keys.  Go out of business.  They go crazy.  Well, not to worry.  You still have the two copies you need to spend those funds.  And if they do lose your keys.  You probably want to stuff this whole thing into a brand new multisig wallet.  So, you have the three back because three is nice.

Okay so let's go back to where we were.  And what we were doing is we're looking at this first raw transaction.  And really this is just that first transaction that's created here.  This is before the transaction is even signed by yourself, okay.  And then of course since you set it up and you wanted to buy that thing.  You're going to sign the raw transaction.  This doesn't mean that those coins will be spent.  They still have to go through your wallet provider and still have to be bundled into a send transaction request.  But this is what the signed raw transaction looks like.  And this is what the code looks like to sign your raw transaction and you'll notice that you have a private key here.  But when you send out the signed transaction.  It'll look like this.  And you won't be able to find your private key in there anywhere no matter what math you run.  No matter how many computers you run for the rest of your life.  You're not going to find this private key.  This is digitally signed and it can now go on to the network as secure as anything goes out on any network ever.

So, this is kind of the idea, right.  You're sending this to your wallet provider.  You're sending this to anybody you choose.  Only wall provider can sign off on it.  So that the funds will be spend again.  So, here's the second raw transaction.  So, say you sent this to your wallet provider.  Your new blockchain.info which is incorporating multisigs they will take their private key and slap that on there and generate a whole new output.  And this output has true and recognized up here.  Well, it kind of wrapped around the screen bed maybe we can open that up a little bit.  When you signed it.  It wasn't ready to be spent because only one person had signed it.  But here you see that it's now true because it's got two signatures.  And this was set up as a 2 of 3, okay.  And this transaction I can now paste into Bitcoin D saying, "Send Raw Transaction" and the funds will be spent.  And I'm going to do that right now.  So, we need to copy the hex in here.  And then we're going to go open-up a brand-new window in our terminal and we're going to type "Bitcoin D Send Raw Transaction" and then we're going to paste that right there.  And when we hit return, cross our fingers, but the transaction should send and blip out to the network and probably get approve.  So, Sean's outpost in Pensacola, Florida will receive our very tiny amount that we sent but they'll get it.

Beep!!  And it gave me a confirmation by sending me the transaction ID.  Now, I could try and send the very same transaction.  And this time transaction, this time I'll likely get rejected because you've already sent that.  You've already taken those specific funds.  You've already generated this digitally signed transaction, okay.  And if I hit return, oh, transaction rejected.  So, the only way to send more from this particular account is by going back and running the same process.  Now, remember I used my original account as my change fund.  So, I'm likely not going to be able to send those funds right out right away.  They won't be active on the network right away.  So, that account is probably going to be down to zero.  But we've got a little time.  We're going to go through some of this code.  And maybe with a little luck we'd be able to send some more money from this multisig account to Sean's outpost.  So, let's take a look again at the code and see what's actually happening.

Okay so, here's where we actually looked at the outputs that I had, right.  So, that's at the very top.  And I had put one, output two, output three, okay.  These were all the accounts I had in my personal wallet.DAT file that had some funds in it.  So, this was this loop basically to run around and see what was in there and then to print out what was in there okay.  The script public key is well long you see the script public key over there.  Now, at the bottom, I actually summed up what all the accounts had in them.  And then multiplied it by a 100 million because the number it gave me was in Satoshi's, okay.  And the total value of unspent Satoshi's that I have in my account is 781,944.  That's not a lot of money today, that's only a few bucks.  Okay, then I query, I ask the user to tell me which of these outputs they want to spend from?  And remember I wanted to spend from number four which had a multisig.  So, it had the three right there and it had this amount of Satoshi's in it.  And remember this particular wallet basically I've made wallet providers.  This code it's just a simple wallet.  You could just adjust the code and use it for all your Bitcoin transactions.  Don't do that because it's not very well written.  But this particular code will only work with 2 of 3.  Okay so, if you don't have a 2 of 3 multi sig it'll kick your transaction out.

Okay so, which transactions that I want to use.  So, I chose number four and this basically says that if you type in a number that's not there.  Like a seven sorry not a valid input.  Really basic idiot checked you really should be doing better ones, but I'm trying to keep it simple.  And then I stuff the address that was in that output into a Temp Addy.  And then I check to see if that account started with a 1 or if it started with a 3.  If it starts with a 3 I'm going to do all this.  If it starts with a 1 I'm going to go well, it's not a multisig, I don't want to do anything with it, okay.  So, this is a very picky little wallet service I've written here.  And then I tell you the public address on the account is Temp Addy which is the address that you're going to be spending from and then output and you see that right here.  The public address on that account is right here.  Okay, and that's the Temp Addy variable.  And the address starts with a 3, I already checked for that which makes it a multisig.  Great, we can move forward.  All multisig transactions need transaction ID's, script, public key, redeem script we talked about that.

Fortunately, all of that is right here in the JSON that I already grabbed, okay.  So, right at the beginning when I did this unspent.  Well, I dumped a huge array basically a dictionary with all the script pub keys.  All the transaction ID's.  The redeemed scripts and the public keys of a number of transactions, okay.  And now I'm just querying them.  You know, because they're in a JSON format and I'm going the transaction ID of this big array which transaction while the fourth one ain't the transaction ID so print that right there okay, and that's done.  Right here the transaction ID and I do the same for redeem script and script public key.  Just kind of highlight that we have those and we don't have to worry about them anymore.  And then print, you have blank amount of Satoshi's in this output.  So, you have 155,300.  Well, we don't know, if we ran this again it'd be less because we spent some.  We sent 7,777 Sean's outpost, right.  But we're just following the code so let's move on.

So, here I ask how much do you want to spend?  And I stuff that into how much.  If that's more than what's in that account.  Well, tell me that I don't have enough funds.  That makes a lot of sense, right.  And I could just type in this code a little comment.  Check to see if there are enough funds, whatever.  Okay, if there's enough funds print, send funds to which Bitcoin address?  And if you don't type anything in there it'll go to this address.  And this is the Sean's outpost address.  So, if you didn't type anything and this ran through.  Nice, you chose to send funds to Sean's outpost in Pensacola, Florida.  And we'll see those as well right here.  Now, the other thing we want to do is figure out how much will be left in the account after we spend those funds and pay a transaction fee?  So, we set the transaction fee as a variable up at the top.  We asked how much you wanted to spend and we took how much was in the account multiplied by a 100 million because it's in Satoshi's and subtract those two numbers.  And then we tell you where you're going to send it?  How much will be left over?  And how much the transaction fee will be?  And then we tell you we're about to start to create this raw transaction.

And so here we do that.  Creating the raw transaction.  And here's the raw transaction okay.  And I just stuff these variables in here so you could copy and paste it really easily and stuff it in the terminal to check for yourself.  And if you take this particular number right here and put Bitcoin D, Decode Raw Transaction before.  It will respond just like it's on my computer.  Because you're not trying to spend anything.  So, you're just trying to look and create a raw transaction.  Your Bitcoin D will create one just with this code right here.  And you see here where I just stuffed the Bitcoin D Decode Raw Transaction inside of a print.  And then I attached the raw transaction.  The raw transactions created here with all the things you need.  So, you need the transaction ID from the JSON.  You need the Vout.  You need the script public key and you need the redeem script.  And then the real important part is where do you want to send the cash?  And how much do you want to send it to?  And how much you want return to yourself, okay?  So, here's the send address.  How much divided by a 100 million, change address.  I'm going to take the leftover.  All that's rest and divide that by a 100 million, okay.  And remember included in left over is the idea of a transaction fee.  So, we were nice and we gave the miners a little bit to munch on.  And so, then we just printed that out.  And here's that print statement right there.  And that's this thing right here.

Now, let's step into the real juice of the matter.  We need to start signing, okay.  So, you're going to see some private keys flying around.  And remember, you can do the private key on one machine then send the signed transaction to the other machine without sending the private key to someone across the world.  And then they can squirrel out their little private key on a machine that's not even online and create another sign transaction.  Never putting private keys online.  Putting them both together then sending the transaction when you're online with no private keys in it, just digitally signed.  It's beautiful, beautiful elegant stuff and so secure, okay.  And so now we'll sign the raw transaction, okay.  And the big key here as we go through and do all the same stuff.  We stuff in these JSON scripts stuff which transaction.  Transaction ID's, Script Public Key.  The whole raw transaction from before.  But the key here is we're taking in multisig private key one which we've just got at the top here remember, okay.  And then the next time we'll use this one.  And I kind of set it up so that you could copy and paste this into your own Bitcoin D or Bitcoin-QT and see these things actually doing its stuff.  But you don't need this okay.  And I didn't need to print out all these numbers.  I just thought it'd be fun if people want to learn multisigs actually see the insights of how this is all working.

And that first variable or that first thing that we've printed out here will be called signed one.  So, it's been signed once okay and print signed one.  So, here it is right here okay that's been signed.  There's no private key in that,, remember.  The private keys here it's not here okay.  But we're also the false because it's only been signed once.  Now, let's move on.  In a real-world situation, the hex part of this thing above would be sent to the second user or the wallet provider.  Remember, it's not going to be on the same computer, notice the private key is not there.  We already showed that.  It has been signed digitally.  For fun, you can paste this second signed transaction, okay.  And right after that we start to generate the second part of the signed transaction.  So, this has multisig private key two which again is all the way up here.  And as we already mentioned, you don't need the third one.  All you need is 2 of 3.  I could use this one and not this one but it doesn't matter, okay.  So, one could be in the safe deposit box hard to reach.

So, here's where we add on multisig private key two.  And there's a lot of craziness here.  Just to lay out the formatting that Bitcoin likes but if you're using it you can just copy the formatting right there because it works.  And we called this double signed raw transaction.  So, this now been signed by two individuals.  It's been successfully signed because we've got a true and a response back and this can now be spent.  But just for fun, we print the double signed raw transaction down here at the bottom.  No private keys in it and it says true.  And I didn't put in the software an automatic spend of this double signed just because I don't want anyone to lose their money.  So, I basically said you are now ready to send 7,000 blah, blah, blah, are you ready?  If you're ready to spend it just hit return, right.  And then it says no really.  If you hit return now you'll be sending funds for multisig account.  But I just couldn't do it.  So, I said sorry I won't do this.  If you want to spend these funds, you have to copy that hex thing, stuff it in your own Bitcoin D.  If you want to program it so it spends it, be my guests.  Most of the codes already there.  It's really a trivial extra line.  So, here's where I'm questioning if you really want to do it.  And then I tell you I'm not going to do it, okay.  And we don't need this crap that's from the old version.

So, we're done.  That's everything.  The fun thing is now we could go and see Sean's outpost and see if our transactions live.  So, we're going to stuff this into the blockchain.info and whoah, that 7,777 Satoshi's gave them five cents.  That's not too good but we'll send them more later.  And we were running a trial before with a different account.  And we sent them this, no, we didn't send them that.  We sent them this.  We're the guys sending the multisigs, okay.  My guess is there aren't many people sending for multisigs, right.  And this will be changing very, very soon.  You're going to see the ones at the beginning of all these go to 3s, okay.  so, we've ran a few tests.  Hopefully if you run tests.  You too will send to Sean's outpost.  And that's live there and also on this great new website called the insight.  We'll see if it's live.  And we see that it's got four confirmations.  And you could switch to U.S. dollars or Milly Bitcoins.

So there's my 5 cents okay and I returned .90 cents to myself.  Greedy but we'll make up for that in a second.  And there's our previous transaction where we're experimenting writing the code for this.  So, let's see if we can send the rest of this right now.  Let's see if I have the capability and the blockchain confirmations are enough.  4 is pretty low.  So, let's go back to our code.  And all we have to do is just run it again because all the important variables, the private keys are already in there.  So, let's hit F5 on our Python idle and it goes through our unspent outputs.

So, the good news is it looks like we can spend from output number 4 which is the multisig address we created yesterday.  And it's got one 142,062 Satoshi's.  Remember before we sent the money to Sean's outpost, it had 155,000 something.  So, let's say output number 4.  Again, okay how much do you want to spend?  So, this time let's go a little bigger.  Let's spend a 120,000 Satoshi's.  And there's great practice anyways to get used to what a Satoshi is really worth, right.  That's going to be under a dollar.  Maybe eighty cents or something like that.  So, let's hit return.  Send funds to which Bitcoin address?  We hit return and it goes to Sean's outpost.  And once again we get everything we were hoping for, right.  Create the raw transaction, boom.  That transaction gets set up to be signed, boom.  It gets signed, boom.  So, the first private key is hidden here.  And then it gets sent to be signed by your wallet provider, your second brother who knows what and they insert their private key and then you get the double signed raw transaction okay.

And again, my software will not let you spend it you'll say yes -- yes, yes and then I won't let you do it.  But if you go to the terminal pop-up a whole new window.  Type in Bitcoin D send raw transaction.  And put in this hex code that we just copied, right.  If you double click on it just selects the right stuff.  And you just paste that there o,kay.  And if you hit return I should now send about eighty cents to Sean's outpost, boom, transaction done.  We've done two sends from the very same multisig address by using two private keys.  You cannot send it with one.

And again, if you try and send that same transaction again.  Well, the Bitcoin network's pretty savvy.  Doesn't want you to double spend, right.  Send raw transaction and you don't have enough funds at this point because we spent the majority of our funds on that last one.  So, it's paste in the exact same transaction and just see what happens.  Transaction rejected.  Pretty cool stuff, and it's really cool to realize that you can be your own wallet provider.  You can run all these tools yourself.  There's a Python codes fairly simple.  The Bitcoin D is fairly simple.  So, after a little bit you could actually make your own wallets, do all kinds of complex and interesting transactions.  You can protect your bitcoins better than they've ever been protected before.  And what's really cool about this is you can just copy that transaction ID right there.  And you could turn around and go right to blockchain.infor or insight and just paste that in.

And boom, it's already there.  We sent Sean's outpost .76 cents.  Pretty cheesy but we'll keep sending as we keep making these videos.  They're going to be our charity of choice.  And this is unconfirmed transaction .87 right there.  And we can even see the little amount of change that we sent back to our original address with the three.  And we're proud because we have the three, okay.  So, I hope that helps.  I hope at this point you're feeling really comfortable with generating multisig addresses and then spending from multisig addresses okay.  So,, if you want to split up the keys between you and two other friends.  Or if you just want to provide additional security, massively better security.  Then multisig is the way to go.  Please remember to like, comment, subscribe.  Do whatever it is you do and we'll check at the next video.

(END OF AUDIO)

Written by James DeAngelo on March 15, 2014.