If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:11:32

Video transcript

edit score a Bitcoin is just basically a chain of digital signatures that really reflect the the coins path through the the Bitcoin ecosystem and here I think it's actually conceptually easier to think of bitcoins as collective entries into a ledger rather than as a as a physical coin because if you think about it in a ledger you have a record of transactions trees which is what happens in Bitcoin whereas it with a physical coin it's more like memoryless there's no history in a physical point of where that coin has really been in the past okay so in this context you can think of a transaction as just a a digitally signed declaration by by one party of its intent to transfer some bitcoins that they possess to another set of parties and when I say one party possesses a certain number of bitcoins I really just mean here that there's some previous transaction on record that everybody's agreed to in which the party now transferring the bitcoins was was itself the recipient of a previous transfer of those bitcoins all right now it's a bit convoluted so maybe to help better understand the mechanics of a transaction I can do an example of what would happen in the context of a of a of an actual Bitcoin transaction so let's say we have a party and let's call her Alice which is the common name we use for parties in cryptographic schemes and let's say she wants to transfer some bitcoins to Bob okay and let's say she would like has an intention of wanting to transfer 50 bitcoins bitcoins to Bob okay now remember that anybody who trans acts in the Bitcoin ecosystem is actually not transacting under their real name or their actual name but rather they are known by a very specific identity a pseudonym within the the Bitcoin ecosystem and that identity that pseudonym is actually actually corresponds to a public verification key for a digital signature scheme so in this case let's say Alice's identity in the system is really some some public verification key which we'll call view K of a so Alice is verification key and in the context of Bob let's say his public verification key is some V K sub B so these are keys that are used within digital signature schemes and so we can assume that Alice's generated this key at some point and that she made it public and then Bob did the same thing and so now they both have identities within the system and these identities are just sequences of numbers that correspond to public keys for verification in the context of a cryptographic digital signature all right now remember that these values also correspond to private values so each person who's got a public key will have a corresponding private key associated with that public key and in this case we'll call the the private key or the secret key which is in fact a signing key in this context SK of Alice and we'll say that the Bob signing key is sum SK of Bob okay and they're going to basically heat these keys private now let's say that Alice herself had received in the past three transactions of bitcoins from other party let's say she got 25 bitcoins from from Carol and we'll call a Carol VK of C to associate that with their key let's say she got I don't know 20 public or 20 bitcoins rather from from from David and let's say she got 20 more bitcoins from from Ted okay so these are these bitcoins correspond to different people that provided Alice with bitcoins in the past and so as you can see Alice now as as an aggregate of 65 which is 20 plus 20 plus 25 bitcoins and so as a result she has a sufficient number to be able to transfer 50 of those bitcoins to Bob okay so to start off with a transaction from Alice to Bob for 50 bitcoins will contain information about these previous transactions so each of these previous transactions where Alice received some bitcoins these will have been recorded in the Bitcoin ecosystem so they're going to be made public just like every other transaction and so what Alice can actually do is she can take some representation of these transactions and include them as part of the new transaction with Bob basically is it is an anchor point to say hey I received these previous bitcoins and now I'm going to transfer some portion of these bitcoins to you Bob okay so you know in this context actually she does not need to include the full transaction details in the actual transaction record - Bob what you can instead do is take the transaction details and apply a cryptographic hash function to them to get a series of digests for each transaction so in this case let's say she has a digest that corresponds to the transaction Carol she'll have a digest that corresponds to the transaction from from David and she'll have a digest that corresponds to the transaction from Ted okay she'll basically include each of these digests into the transaction record and what these classes allow you to do or really allow anyone to do for that matter is they can verify the chain of ownership of these bitcoins because they can simply take all the previous transaction records which again are made public they can apply cryptographic hash functions to the in there to these different transaction records and they can verify that these cryptographic hashes when apply to those transaction records provide you back with these values D sub C D sub D and D sub T and that in turn provides you with some type of a cryptographic guarantee because we're using cryptographic hash functions we have a traffic guarantee that that Alice was the ultimate recipient of these transactions of these different parties we have this this nice history that we can record and then we can essentially ascertain in this fashion all right and because we're using cryptographic hash functions we now have some assurance that Alice couldn't have so easily cheated the system all right so at this point in the transaction and maybe I'll kind of draw a line so you can you can kinda see where the transaction details are recorded so this part of the transaction we have details about Alice's ownership of these 65 bitcoins and she has enough information in that transaction so that anybody can verify that she possessed these coins all right so you can think of this part of the transaction really as representing the input the inputs of the transaction now in addition to the input portion of the transaction there's typically also an output portion I'm going to put that output portion up here but let me label it okay and so for starters in the output portion she has to include or Alice has to include a list of recipients for her bitcoins and since Alice wants to say transfer these bitcoins to Bob she has to specify Bob's identity in the system which in fact as you mentioned earlier was a Bob's public key so we'll say that she'll mention V sub K of B okay and she also has to record and mention at this stage how many coins she wants a transfer to Bob and as we said earlier we were going to assume that Alice wanted to transfer exactly 50 of her bitcoins to Bob okay so she's going to specify the number of 50 actually in reality she'll specify another number but it's going to represent 50 bitcoins for Bob okay now in order for Alice to get back change because she has 65 bitcoins kind of coming in and she is only given 50 back to Bob what she might then do is decide that she's going to specify 14 of those bitcoins to be returned back to her in the form of a change okay so 14 of those bitcoins are going to be reassigned back to Alice's public key all right and what else will then do is she's going to take all of this data this transaction is input in this output and she's going to digitally sign that data and she's going to use her signing key her signing key to digitally sign all this data like you would with a digital signature and she's going to append that signature to the actual contents of the the transaction record and that will effectively bind Alice's identity with the transaction record itself okay and the reason it's going to bind it is we're using a digital signature scheme and so anybody who possesses Alice's public key which again is made public can validate that that only Alice could have created this block because only Alice in theory can come up with a signature that corresponds to a public key because she's the only person who in theory should possess the private signing key corresponding to her public key all right then all of this data will actually be broadcast out so this transaction data will doesn't get broadcast out to all the different peers and the nodes in the in the Bitcoin network so everybody in the Bitcoin network will basically know now that that the case of a is trying to send 50 bitcoins to BC K sub B okay now at this point you may have noticed a slight discrepancy here that Alice started off with 65 points kind of on the input side but on the output side she only has 50 plus 14 or 64 coins that are being accounted for okay so there's this issue what happens with this one one last remaining coin there's kind of this one implicit coin hanging around that has not been accounted for and what we're going to do with that point is that coin is actually going to be used as a transaction via Alice is going to be Alice is basically saying that this one leftover coin should be provided as a transaction fee to what's known as a Bitcoin a Bitcoin miner okay and a Bitcoin miner as I mentioned in a previous video is basically a an entity in the Bitcoin system anybody can be a Bitcoin miner actually but it's a node in the Bitcoin network who engages really in the effort to help with the the broader validation of this transaction so what do I mean by broader validation well if you think about it at this point we've just used cryptographic hashing and digital signing to validate that Alice at some point possessed the the requisite bitcoins in the system and that she not only publicly announced her intention to transfer some of the bitcoins to Bob but she digitally signed that that public pronouncement if you will as a result of which her public verification key which is her identity in the Bitcoin system is now bound that transaction but what Bob doesn't know yet even though he knows all these things he can validate them what Bob doesn't know yet is whether Alice tried to let's say previously sign or assign those exact same point to somebody else like maybe there's another party let's say you know Alice has a friend named Eve okay maybe Alice decided she's gonna send these bitcoins not only to Bob but also gonna try to send these same bitcoins to Eve and Bob at this point may not have the assurance that alice is not try to engage in these types of shenanigans all right and so the tricky part here is that even though all the transactions we've talked about have been made public because Bitcoin requires all transactions to be made public we still need a mechanism and this has to be a decentralized mechanism that does not require a a trusted third party per se we need a decentralized mechanism for agreeing really on the order in which transactions actually took place so that we can resolve any disputes about someone trying to double spend their coins okay and it's that that requirement that that time stamp that decentralized time stamp if you will which is where Bitcoin miners play a very important role in the Bitcoin ecosystem and I'll talk about how that works and how we we deal with transaction time stamping in subsequent videos