Files
Lee Hanken 7c8efd2228 Initial commit: HPR Knowledge Base MCP Server
- MCP server with stdio transport for local use
- Search episodes, transcripts, hosts, and series
- 4,511 episodes with metadata and transcripts
- Data loader with in-memory JSON storage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 10:54:13 +00:00

432 lines
28 KiB
Plaintext

Episode: 2866
Title: HPR2866: Intro to Bitcoin for techies
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2866/hpr2866.mp3
Transcribed: 2025-10-24 12:30:44
---
This is HPR Episode 2866 entitled Intro to BitCoin for Tekken, it is posted by Mightbe Mike
and is about 32 minutes long and carrying a clean flag.
The summary is Survey of BitCoin, BlockChains, Blocks, Transactions, Miners, Pro-W, Hashing, Addresses, Wallets.
This episode of HPR is brought to you by archive.org.
Support universal access to all knowledge by heading over to archive.org forward slash donate.
Hello again, this is Mightbe Mike.
Last time I talked about BitCoin's game, a game built with tokens on top of the Bitcoin
blockchain.
There was a lot there, and if you didn't have the background to give it context, it was
probably difficult to understand, but I thought I would just start out by covering the foundation,
the basics of Bitcoin.
So what do we want to talk about for Bitcoin?
Well, this is going to be like a survey course, if you've ever taken one of those, we're
going to cover a very wide range of topics very shallowly.
So we're going to talk about pretty much everything that is the basics of Bitcoin without
going very deep on any of it.
And for some of you, that'll be totally useless because you know about Bitcoin.
But hopefully for a lot of you, this will at least fill in some missing pieces or get
you familiar with the basics of Bitcoin.
This is like Survey of Bitcoin course.
And of course, I'm going to avoid talking in any detail about any other cryptocurrency
projects.
So let's get started.
So Bitcoin, what is it?
Some people would tell you Bitcoin is financial freedom, or maybe Bitcoin is programmable money.
And they're right at a high level from a philosophical point of view, but we want a technical answer.
We want a more practical answer that we can explore a little bit.
So Bitcoin is a protocol.
It's a network protocol.
And so there's a bunch of Bitcoin nodes that comprise a network.
This is distributed around the world.
There's thousands of nodes.
And of course, what makes a network is collection of nodes running the same software.
They're running this Bitcoin D software that implements the protocol.
So this protocol defines a currency, if you will, a digital money.
And it needs to store all the history of that money.
The transaction history is what gets stored.
So the money started in one place.
It moves somewhere else.
It moves somewhere else.
And currently it's sitting here.
That's done using a data structure that looks a lot like a linked list that's distributed
across the network.
And it's called a block chain.
Block chain is a great name for this thing because it's literally a chain of blocks.
So once again, I'll just remind you I'm speaking only about Bitcoin.
Bitcoin is kind of the reference pattern that you use to understand all these other ones.
So a block chain, the main data structure in Bitcoin, a chain of blocks, like I said,
which begs the question, what is a block?
The tip of the block chain, the latest block that's put on there, is always going to have
a pointer back to the previous block where it's been appended.
That pointer is actually a hash of the previous block.
So I guess I'm getting ahead of myself.
A block has stuff in it.
So it has a header, which has some stuff we don't really care about, like the version and
a timestamp.
The main thing that a block has, transactions, could be a lot of transactions.
Could be empty, but typically they're packed full of transactions.
It also has something called a nons, which we'll just put off for now because we're
going to get back to that.
Then we talk about hashing, and we will talk about hashing.
So if these blocks are full of transactions, what's a transaction?
Now miners are the ones who construct these blocks, and we're going to say more about
miners in a moment.
But the miner instructs the block and fills it up with transactions if there's a lot
waiting, and if he feels like it, you could have an empty block.
The first transaction they put in there is kind of special.
It's a coin-based transaction, which means money is being created out of thin air.
So this is the miners reward.
There's a block reward that a miner gets for successfully, depending on a block onto
the blockchain.
It started out as 50 bitcoins, and it's cut in half every four years.
So far it's been cut in half twice.
So right now, if you mine a block, you get 12 and a half bitcoins.
Pretty nice take, huh?
So the first transaction you would put in that block is a transaction to yourself.
Presumably you send this to your own address, and the amount you send is the block reward
amount, which is 12 and a half, plus any fees.
These transactions have fees associated with them, and a miner picks out the transactions
based on whatever they want, but the criterion that's usually used is the fee.
The miner could decide to maximize the fees they're going to collect by picking out the
transactions from a mempool.
Mempool is where all these pending transactions sit waiting to get included in a block.
Miners can rummage through there, pick out the ones with the biggest fees, and include
them in the block.
So that first transaction is the block reward, currently 12 and a half bitcoins, plus
the sum of all the fees of the other transactions that are getting included in the block.
So for miners, mining blocks.
What we need to talk about mainly is their function in the Bitcoin system and the transactions
that they're including.
There's a couple things to say about both of those.
So miners are critically important in Bitcoin.
Miners are how transactions get included in the Bitcoin block chain, in the case that
wasn't evident.
You don't get your transaction included unless a miner decides to put it into a block,
and typically they're not going to include it unless you add a little additional amount
called a fee, a miner fee.
It's not necessarily the case.
Back in the old days, people would sometimes submit transactions with no fee.
I did it.
And they get included in blocks, but I think if you did that today, you might not even
get it included in a block.
Because why should they?
They're there to maximize their profits.
People mind to make a profit, and the way to do that is to be picky and include the
ones with the biggest fees.
So that's the first function of mining is to get transactions included in the official
record, in the block chain.
But miners, remember I talked about the Coinbase Transaction, the first one.
This is the issuance mechanism for Bitcoins.
The Bitcoins are created as blocks are mined.
That's the issuance mechanism for the currency itself.
People of work basically describes the race that these miners are engaged in to add a
block onto the end of the blockchain.
It's a contest, if you will.
In Bitcoin, miners are using a SHA-256 hashing algorithm.
So what the miner does is they take the entire contents of the block, plus this one field
called a nonce, which I mentioned earlier.
So what is this nonce?
The nonce is the variable part.
The entire block doesn't vary, but every time the miner hashes this thing, there's a little
bit appended onto the end that he keeps changing.
You could try one, and then two, and then three, and keep trying different tries for this
nonce value until the hash result starts with a certain number of leading zeros.
Now there's a difficulty target, and suggested the goal of this difficulty target is to keep
the average block discovery times at about 10 minutes.
So the average time that it takes to add another block to the Bitcoin blockchain is 10 minutes,
eventually.
It's never exactly 10 minutes, or rarely so.
What happens is if the blocks are getting added a little too quickly on average, the difficulty
is ratcheted up, and vice versa.
So over time, it gets suggested a little longer, a little shorter, based on this difficulty
target.
The difficulty target is the number of leading zeros.
If I hash this entire block with my nonce, whatever that is at the given moment, and remember
they're doing this very, very fast, over and over and over and over again, really quickly.
So I hash this block full of transactions and the other little fields and this nonce
that I keep varying, and then I expect the hash and look, it started with eight leading
zeros.
Look at that.
But the difficulty target is 10 leading zeros.
So I didn't win.
I have to try it again.
As soon as I hit that, as soon as I get 10 and more leading zeros, that's it.
I have the right to add that block onto the blockchain, and what I do is right away,
I broadcast that thing out onto the network to my peers and let it propagate against across
the network.
Because the way this protocol works is the longest blockchain is adopted.
So miners adding blocks onto the blockchain need to reach consensus.
Every node on the network needs to agree about the entire history of every coin in the
system.
So a node on the network, it has a copy of what it thinks is the most recent blockchain,
but it's checking with its peers.
And suddenly a longer chain appears.
Its neighbor has a chain that's longer by one block.
It's not going to waste any more time mining on that whole blockchain.
This new one is longer, and that's the one it should immediately drop what is doing
and start mining on this newer longer chain.
So this is how all the nodes agree on the whole history of Bitcoin.
This is the consensus mechanism in other words.
So it's very difficult for a network of untrusted nodes to come to consensus.
And that's what we have here.
Anyone can stand up a Bitcoin node.
You don't have to go through a screening process or be qualified in some way.
You just have to run the same software, and you can be a part of the network.
So the other thing I need to explain a little bit is the hashing.
The hashing functions we all know and love in computer science, they're really mathematical
functions, and they're functions that are deterministic one-way functions.
While these functions, first of all, they take an arbitrary length input and produce
a fixed length output.
So for given input A to a hashing function, I will always get the same output B.
I can do it 100 times in a row.
Always going to get B when the input is A. That means it's deterministic.
The one-way part of it is referring to the fact that given the output B, I can't tell
you for sure what the input A was.
And the reason I can't, even if I can find an example A that works, I can't be sure
that's the A you used.
Because of the other thing that I said, that for arbitrary length inputs, I'm producing
a fixed length output.
That means every hashing algorithm will always have another keyword coming here, collisions
will always be possible.
Which means there are multiple inputs that will produce the same output.
That's just the way it goes when you have a fixed length output.
If your output is 256 bits long, well, guess what?
There are multiple inputs.
If you can find them, that will produce that same fixed length output.
But in that case, that's a pretty long length.
And just sitting around on a computer, you're not going to find a multiple input.
You're not going to find a collision, in other words.
So another word about the transactions.
Transactions intuitively, this is easy, right?
I've got a Bitcoin, and I'm going to send it to you, that's a transaction.
So what happens is the Bitcoin that I've got is sitting at an address.
And there's a send transaction, where I send it from my address to your address.
So conceptually, this transaction consists of addresses, right?
There's an input address, that's my address.
In this example, there's an amount, which is one Bitcoin.
And there's an output, which is your address.
A couple of important things about transactions.
One is when miners include transactions in blocks, they're not just blindly putting something
in there.
They actually validate these transactions.
So what does that mean?
So part of that validation is making sure people can't cheat, preventing inflation specifically.
What I mean by that is I can't just create money out of thin air.
So part of it is a simple arithmetic check.
The outputs cannot be greater than the inputs.
The inputs to a transaction are 1.3 bitcoins.
The outputs cannot be more than that, or I've gotten away with creating free money.
Bitcoin has a fixed money supply.
I forgot to mention before when I was talking about the issuance mechanism.
There's only going to be 21 million ever.
Most of those have already been mined, some 17.7 something million of them.
Maybe 17.8 by the time you hear this, I don't know.
A lot of those, the private keys, were lost.
And so there's not that many insurculation, but that's how many have been mined.
There's 21 million total ever that are going to be mined.
So anyway, back to the transactions.
The other thing they check is that I was really allowed to send you that bitcoin.
So the way they do that is the transaction itself is more than just addresses that are inputs
and outputs.
And by the way, there's usually more than one of these.
I'm just keeping this one real simple.
There's one whole bitcoin.
That's an unspent transaction output, a UTXO, that's sitting at my address, and I'm sending
that one bitcoin in the entirety, who you at your address.
Now when I construct this transaction, before I submit this pending transaction, remember
this transaction is going to sit in the mempool until a minor includes it in a block, the
thing that I do is I sign the transaction.
I need to mention a little bit about bitcoin addresses here.
A bitcoin address is essentially a public key.
And if I sound like I'm hedging there a little bit, it's not exactly.
There's a process it goes through.
The bitcoin address is derived from the public key.
It goes through a process.
Now what happens is I sign a transaction with my private key.
The minor can validate this, the transaction that I've signed by using that public key to
check.
In the same way that if I sign a message and send it to you with my private key and
send it to you by email, you can take my public key and prove that I was the one that constructed
the message.
Also the minor can check the bitcoin address against that public key.
At the end of the process, the minor can tell that the transaction is legitimate.
Because the private key that signed the transaction goes with that bitcoin address.
In other words, I had the right to spend that money at that address since I am the holder
of the private key.
So those are the two main things the minor does, right?
He makes sure I had the right to spend that unspent transaction output and make sure I
didn't get away with creating any free money.
So the addresses and the keys brings me to the next, maybe the last thing I need to mention
for the basics of bitcoin.
It's very important to talk about wallets.
Wallets wallets, there are so many kinds of wallets and so much to say about wallets.
We could make an entire episode all about wallets.
But let's just skim the surface here and we'll put that off to another day.
So the wallet word is a misdomer or at least there's a bad analogy there.
A real-world wallet that I put in my pocket is a container for money and a bitcoin wallet
is not a container for bitcoin.
So what a wallet really contains is private keys.
Technically, a wallet can be simply a private key.
That matches an address that you have bitcoin at.
Realistically though, when people talk about wallets, they're usually talking about an
HD wallet, hierarchical, deterministic wallet.
An HD wallet has a seed phrase.
So this seed phrase is used to generate a tree full of key pairs.
So a lot of addresses and private keys that match those and all these private keys are
managed by the wallet software.
The HD hierarchical deterministic part of the wallet, the hierarchy refers to that tree
of key pairs because every time you put in that seed phrase, you're going to generate
the exact same tree structure of key pairs.
That's the deterministic part and that's the beauty of this.
I can take my seed phrase and go to a completely different wallet software and put it in there
and generate the exact same key pairs.
And that new wallet software is going to scan all the addresses and find all the balances
where my private keys match.
And that's going to be transparent to me as the user of the wallet is just going to show
me a number.
Hey, you've got 2.6 bitcoins.
Really, those 2.6 bitcoins don't live at a single place.
They're probably spread across any number of bitcoin addresses and your wallet software
has generated the private keys that match all of those addresses from your seed phrase.
So it scanned the blockchain, came up with that total and it's keeping track of all the
little addresses where that stuff lives.
And if I send a transaction to you for a bitcoin, it may have to use the unspent transaction
outputs at 6 different addresses to come up with an amount of one bitcoin to send you.
It's going to handle that stuff behind the scenes making life easy for me.
So let's talk about the types of different wallets.
Now I mentioned software wallets and I want to get back to that because there's more
to be unpacked there.
But right off the bat, in contrast to software wallets, there are hardware wallets.
Hardware wallets are very secure and this is the recommended option for anyone that
wants to store a significant amount of bitcoin.
Now if you have $10 worth and $10 worth doesn't mean a lot to you, then just keep it on
any wallet.
Just keep it on a software wallet running on your phone because it's convenient to
go spend it.
A software wallet running on your phone, it's low security because you want convenience.
In the same way that you put some money in your pocket when you leave the house because
it's convenient, you can easily spend that money knowing that it's not that secure.
So you wouldn't put your life savings in your front pocket every day that you walk out
of your house.
You just put money in that you might want to spend.
So in the same way, you can keep a small balance on your phone to spend and if you had a
significant amount, you might want to store that on a hardware wallet.
The reason a hardware wallet is very secure is that the private key never leaves that hardware
wallet under normal circumstances.
So you can construct the transaction somewhere else like on a computer but to sign the transaction,
remember we sign these and then the miner verifies that and remember signing it requires
the private key which is the thing you want to safeguard.
That private key is secured by always remaining on your hardware wallet and they go to great
lengths to protect that.
So you've got software wallets, hardware wallets, there's another kind of wallet called
a brain wallet and conceptually all this is is the seed phrase for your wallet.
Was never recorded anywhere except in your brain.
You remember this and the reason that's a cool idea is because you could walk across a
border with a brain wallet so you could literally take a million dollars worth of Bitcoin across
a border with nothing physical to indicate that.
Just the seed phrase in your mind, that's a brain wallet, not recommended for use except
in very specific circumstances.
For obvious reasons I mean for one thing human memory is not that reliable and if you forget
it by definition it's gone right you didn't write it down you just kept it in your brain
and once forgotten this is not like a bank account where you could go through a procedure
to recover money even though you lost your debit card.
Another type of wallet is a paper wallet.
Now a paper wallet they're not that popular but they're worth mentioning because they're
very interesting.
Now a paper wallet can be the most secure way to store a significant amount of Bitcoin.
There are experts that will disagree and there are experts that will agree.
I guess I'll start with the disagree camp.
The critics of paper wallets say that proper operational security is extremely difficult
and that's true.
It's very difficult to do this very securely although to be fair securing any of these
things is very difficult.
Hardware wallets are not absolutely secure by any stretch of the imagination.
They are very secure compared to software wallets generally speaking but nothing is perfect.
And there are numerous ways you can compromise the security of your setup with paper wallets.
People that aren't that familiar with them point out risks but the risks can be mitigated.
So first of all what do I mean by a paper wallet?
Well at the simplest level you simply print out or write down a private key that's a paper
wallet and there's a couple of things wrong with what I just said.
One is from an operational security standpoint you do not want to print out a private key.
If you think about it that means you have the private key on your computer but you send
the private key across a wire maybe across a network to a printer if you send it across
a network maybe it's intercepted also maybe it resides in the printer's memory.
Anyway let's say you handwrite this thing down on a piece of paper a lot of times critics would
say well the piece of paper is pretty risky isn't it? That paper is that risk to fire, theft,
loss, water damage and so on. And that's true a very simple mitigating strategy would be
to laminate the piece of paper or something like that. A more secure strategy obviously is to
throw it in a fireproof safe at home or put it in a safe deposit box. Another risk that's a very
real risk that people point out is somebody sees it somebody probably can't memorize it but maybe
they can take a picture of it with cell phone. That risk can be mitigated very easily as well.
There's a great technique called Shamir Secret Sharing that I won't go into detail with here.
The math involved here like the hashing Shamir Secret Sharing and other stuff.
Merkel trees I didn't even mention. The math of Bitcoin could and should be its own episode
because there's a lot that can be said about that stuff but at the highest level Shamir Secret Sharing
is basically thing. Let's break this private key up into N number of pieces of which you need
K number of pieces to reconstruct the key. So for example I break it up into five pieces and you
must have three of those five pieces to reconstruct the private key. Could be any three of the five
and those two numbers can be any numbers. It could be four out of seven. It could be three out of four.
It can be anything. Look this up on the web if you're interested in the math.
There's scripts that people have written. You can easily get a Python script to do this for you.
To generate this stuff it's a lot of fun to actually read what it means. Run the Python script
and do this and generate five pieces three of which are needed and separate them. Put one in a
safe deposit box. Put one in your home safe. Put one in your car glove compartment. Put one at
your mom's house. Send one somewhere to a post office box. How many did I do already? Anyway you
get the point. So that's the idea of not having the private key all in one piece on a paper wallet.
I also would be remiss if I didn't address the paper part of paper wallets. You know there's no
reason that you couldn't just etch this into a piece of metal. Burn it into a piece of wood or
something like that. The paper wallet is just the way people talk about this general technique.
The other thing to say is I mentioned software wallets. The truth is what people think of as software
wallets are really different things. They're a web based wallets. A web based wallet you'll
typically go to a website. Enter in your seed phrase and it will generate the keys. Needless to say
this is not the most secure thing in the world. You don't want to do this with a significant
amount of money or anything really valuable because obviously you're trusting that website
and you're trusting that you have or not being man in the middle attacked and so on.
Another kind of software wallet is a piece of software you're running on a local computer. So for
example in bitcoin there's the bitcoin reference client. Originally the mythical creator of bitcoin
Satoshi Nakamoto he published not just the protocol but the reference wallet. So the software
that he put out there was the software to run on a bitcoin node. That's the network software
and there was also the wallet software that you would run. Now the reference wallet is not so
slick in terms of user interface. It's just there to give an example of implementing all the
functionality that the protocol supports. There are much slicker wallets out there but at the end
of the day they have the same properties. They're running on your machine and are very vulnerable.
So you do not really want to run a software wallet with any significant amount of bitcoin
on a machine that you're using for everything in your life. If you have one computer and you play
games on it you go on Facebook your kids use it. That's not the machine you want to be running a
bitcoin wallet that has a significant amount of bitcoin in it because there's a lot of malware
these days that looks for bitcoin wallets. There's a lot of malware that watches memory so as soon
as you use it and try to send money somewhere remember the only way you can send bitcoin
is to construct a transaction and sign it which means that private key is in memory and available
to be stolen by malware. That's watching for that and there's a lot of malware these days that do
just that. They watch for bitcoin private keys. What they actually do varies. They may just steal it
and send it to the command and control center. They may actually substitute a different public
address at the last second as you paste right you maybe you copied the send address that you're
trying to send to and the malware substitutes a different address into the paste buffer at the last
second. There's some that does that. At any rate you don't want to do this. If you're going to run
software wallet the best way obviously is to use an air gap computer. A computer that's not
connected to the network and therefore is not going to be so prone to downloading malicious software.
Plenty of stuff we didn't get to but we're running a little long so let's try to wrap it all up now
and summarize what we briefly talked about. We mentioned bitcoin as a protocol. It keeps track of
the transaction history in a blockchain. That's like the data structure that's distributed across
all the nodes on the network. All the nodes run the same software. The blockchain is just a chain
of blocks. The blocks are these containers that have some information. Most significant of which
are a collection of transactions. That include the transaction where the miner pays himself. The
miner being the person that adds the block to the chain. The transaction that the miner pays
himself with is the issuance mechanism for bitcoin the currency. Miners include transactions which
have addresses. They have inputs and outputs and the inputs come from a UTXO set. These are the
unspent outputs from previous transactions and it's the miner's job to check that the address
that's an input for a transaction really had the right to send that bitcoin to the output
address and that the sender is not creating any new money. What else? There's addresses,
wallets we covered. Remember a wallet just manages private keys. It doesn't contain bitcoins.
So that's a high level view of bitcoin. That's a survey. I talked about pretty much all the important
stuff in bitcoin without going too deep into any of it, hopefully. And let me know what you want
to talk about next. Thanks for listening. Might be my key with a basics of bitcoin for HBR.
Thanks for hanging in there with a long podcast and we'll talk to you soon.
You've been listening to Hecker Public Radio at Hecker Public Radio dot org.
We are a community podcast network that releases shows every weekday Monday through Friday.
Today's show, like all our shows, was contributed by an HBR listener like yourself.
If you ever thought of recording a podcast and click on our contributing to find out how easy it
really is. Hecker Public Radio was founded by the digital dog pound and the infonomicon computer club
and is part of the binary revolution at binwreff.com. If you have comments on today's show,
please email the host directly, leave a comment on the website or record a follow-up episode yourself.
Unless otherwise stated, today's show is released under Creative Commons,
Attribution, ShareLight 3.0 license.