mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2026-04-12 16:12:55 +00:00
Compare commits
23 Commits
5d9871f733
...
8c763b42ef
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c763b42ef | ||
|
|
8c8e649251 | ||
|
|
6759d6b44c | ||
|
|
c6b827e202 | ||
|
|
37f3704e9e | ||
|
|
eb37d01a49 | ||
|
|
d60d3e7b84 | ||
|
|
6ee262de9d | ||
|
|
61bbc29499 | ||
|
|
88e2ed14e3 | ||
|
|
592a45359f | ||
|
|
57ad616eb0 | ||
|
|
56f0d24e27 | ||
|
|
147de4c238 | ||
|
|
be62d14995 | ||
|
|
3112235e4b | ||
|
|
2a01c8d60f | ||
|
|
c4636266f3 | ||
|
|
8b4f84502e | ||
|
|
f2961f7a45 | ||
|
|
b4c89bbd73 | ||
|
|
65b70612dc | ||
|
|
8e1111a6fb |
@ -4,7 +4,7 @@ You understand your wallet now, but there's still the question of the addresses
|
||||
|
||||
## Understand Addresses
|
||||
|
||||
As you know, each Bitcoin address is a storage area for Bitcoin funds. Funds are sent from one address to another address as a _transaction_; the transaction matches the address that it was sent from. But an address is more than just a storage area: it's a lockbox. The specifics of the address define how that lockbox is actually opened up. The default is to use a private key associated with the public key that was used to create the address, but that's not the only way that Bitcoin addresses work.
|
||||
As you know, each Bitcoin address is a storage area for Bitcoin funds. Funds are sent from one address to another address as a _transaction_. But an address is more than just a storage area: it's a lockbox. The specifics of the address define how that lockbox is actually opened up. The default is to use a private key associated with the public key that was used to create the address, but that's not the only way that Bitcoin addresses work.
|
||||
|
||||
Different types of Bitcoin addresses change all of this. In general they may change:
|
||||
|
||||
@ -16,35 +16,36 @@ Different types of Bitcoin addresses change all of this. In general they may cha
|
||||
|
||||
### The Segwit Address(es)
|
||||
|
||||
The most common sort of address actively used in the modern Bitcoin world is called by two different names that both mean the same thing: the Bech32 address (which names its encoding method, and technically includes other address types that are also encoded that way) or the SegWit address (which stands for "Segregated Witness" and describes how transactions sent to it must be formed). All Bitcoin addresses also have a "Pay-to" name, and Segwit addresses are called P2WPKH, which stands for "Pay to Witness Public Key Hash," which is a mouthful that will make more sense when you've met the older address types.
|
||||
All Bitcoin addresses have a "Pay-to" name, and Segwit addresses are called P2WPKH, which stands for "Pay to Witness Public Key Hash," which is a mouthful that will make more sense when you've met the older address types. It's also called a Bech32 address (to describe its encoding method) or a SegWit address (to describe how its signature is stored), but there are other types of addresses that are also Bech32-encoded or SegWit.
|
||||
|
||||
Segwit came out of the Blocksize War of the '10s, where Bitcoin developers and users were trying to figure out a way to speed up the Bitcoin blockchain by allowing more transactions to be sent in less time. The result was the segwit soft fork. It solved the problem by moving the signatures (which are the key you use to unlock most Bitcoin transactions) from the middle of the transaction to the end, and then making that end space into increased space to store transactions, that could also be ignored by older servers. This allowed for an increase in the space to store transactions that was phased in gradually.
|
||||
SegWit came out of the Blocksize War of the '10s, where Bitcoin developers and users were trying to figure out a way to speed up the Bitcoin blockchain by allowing more transactions to be sent in less time. The result was the SegWit soft fork. It solved the problem by moving the signatures (which are the key that you use to unlock most Bitcoin transactions) from the middle of the transaction to the end, and then making that end space into increased space to store transactions, but space that could also be ignored by older servers. This allowed for a "blocksize increase" that was phased in gradually. The original version of SegWit used by P2WPKH is now called SegWit v0, with SegWit standing for "Segregated Witness", which describes that separation between the main part of the transaction and the signature.
|
||||
|
||||
The specifics aren't that important. What is important is that Segwit addresses (or Bech32 addresses or P2WPKH address) are the default type of address; when you created an address in [§3.3](03_3_Setting_Up_Your_Wallet.md), this is what you created.
|
||||
The specifics aren't that important. What is important is that P2WPKH, and a few other SegWit addresses that we'll meet shortly, are the default type of address; when you created an address in [§3.3](03_3_Setting_Up_Your_Wallet.md), you created a P2WPKH.
|
||||
|
||||
> :book: **What is a fork?** A fork is a change to the Bitcoin protocol. This isn't just a change to how one application (like Bitcoin Core) works, it's a change to how all of the members of the Bitcoin network agree to interact with each other. A hard fork makes new transactions incompatible with old transactions. It essentially two versions of Bitcoin (and most often has been used to actually create a new cryptocurrency). A soft fork ensures that old transactions remain compatible.
|
||||
> :book: **What is a fork?** A fork is a change to the Bitcoin protocol. This isn't a change to how one application (like Bitcoin Core) works, it's a change to how all of the members of the Bitcoin network agree to interact with each other. A hard fork makes new transactions incompatible with old transactions. It essentially creates two versions of Bitcoin (and most often has been used to actually create a new cryptocurrency). A soft fork ensures that old transactions remain compatible.
|
||||
|
||||
### The Rest of the Addresses
|
||||
|
||||
Here's a comprehensive listing of the address types, with the ❌ addreses largely deprecated (meaning don't worry about them!) and the ✅ addresses being the current ones (meaning that they will be relevant to your use of Bitcoin).
|
||||
Here's a comprehensive listing of all the address types that have existed in Bitcoin's history, with the ❌ addreses largely deprecated (meaning don't worry about them!) and the ✅ addresses being the current ones (meaning that they will be relevant to your use of Bitcoin). Don't be overwhelmed by this list! If it looks like too much, just scan the ✅ addresses, which will be the only one used in this course, and come back and look at some of the other varieties if they come up and you want to figure out what they do exactly.
|
||||
|
||||
Don't be overwhelmed by this list! If it looks like too much, just scan the ✅ addresses, which will be the only one used in this course, and come back and look at some of the other varieties if they come up and you want to figure out what they do exactly.
|
||||
The addresseses commonly in use for new Bitcoin addresses today are:
|
||||
|
||||
The addresseses commonly in use for Bitcoin today are:
|
||||
* **✅ P2WPKH (Pay to Witness Public Hash).** P2WPKH is a SegWit address that can be unlocked with a single key. This is the default address type for Bitcoin Core, and what you'll mostly be using. P2WPKH deprecates P2PKH.
|
||||
* **✅ P2WSH (Pay to Witness Script Hash).** P2WSH is a SegWit address that can be unlocked by a script (rather than one or more private keys doing so). Scripts are described in [Chapter 11](11_0_Introducing_Bitcoin_Scripts.md) (and afterward). P2WSH deprecates P2SH.
|
||||
* **✅ P2TR.** Taproot is the newest Bitcoin address type, but it was soft forked back in 2021, so it should have wide acceptance at this point. It's considered to be SegWit v1. Due to its use of Schnorr signatures, it can produce smaller transactions for multisigs, has privacy advantages, and can also combine singular signatures with scripts. It hasn't been widely adopted yet. We'll examing Taproot transcations starting in [Chapter 9](09_0_Expanding_Bitcoin_Transactions_with_Schnorr.md).
|
||||
|
||||
* **✅ P2WPKH (Pay to Witness Public Hash).** P2WPKH is a SegWit address that can be unlocked with a single key. This is the default address type for Bitcoin core, and what you'll mostly be using. P2WPKH deprecates P2PKH.
|
||||
* **✅ P2WSH (Pay to Witness Script Hash).** P2WSH is a SegWit address that can be unlocked a script (rather than one or more private keys doing so). Scripts are described in [Chapter 11](11_0_Introducing_Bitcoin_Scripts.md) (and afterward). P2WSH deprecates P2SH
|
||||
* **✅ P2TR.** Taproot is the newest Bitcoin address type, but it was soft forked back in 2021, so it should have wide acceptance at this point. It's considered the next iteration of SegWit. It can produce smaller transactions for multisigs, has privacy advantages, and can also combine singular signatures with scripts. It hasn't been widely adopted yet.
|
||||
The following two address types are not in wide use, but still hold large amounts of old funds:
|
||||
|
||||
The addresses that have been deprecated are:
|
||||
|
||||
* **❌ P2PK (Pay to Public Key).** This address type was used in the earliest days of Bitcoin and quickly deprecated. Revealing your public key can actually be dangerous since quantum computing or other future processor improvements might be able to brute force a private key given a public key. That's why modern addresses are based on a hash of your public key, instead of the public key itself, and why P2PK was quickly phased out.
|
||||
* **❌ P2MS (Pay to Multisig).** Most Bitcoin transactions are signed by a single key, which allows a single person to decide to send the Bitcoin. Multisigs instead allow multiple people to do so. P2MS was the initial attempt to support this, but it exposed public keys (like P2PK). It was quickly replaced by P2SH scripts, and more recently by P2WSH and P2TR.
|
||||
* **❌ P2PKH (Pay to Public Key Hash).** The P2PKH address was the predominent address type prior to the introduction of SegWit, which replaced it with P2WKH. Most new addresses are now created with P2WPKH, since their transactions are cheaper, but many older P2PKH addresses still hold funds, since it was in use for roughly a decade.
|
||||
* **❌ P2SH (Pay to Script Hash).** P2SH was the first type of scripting address, before signatures got reached for SegWit, resulting in P2WSH.
|
||||
* **❌ P2SH (Pay to Script Hash).** P2SH was the first type of scripting address, before signatures got revamped for SegWit, resulting in P2WSH.
|
||||
|
||||
These last four address types are more totally deprecated:
|
||||
|
||||
* **❌ P2PK (Pay to Public Key).** This address type was used in the earliest days of Bitcoin and soon phased out. It pays directly to a public key, rather than the hash of a public key. Revealing your public key can actually be dangerous since quantum computing or other future processor improvements might be able to brute force a private key given a public key. That's why modern addresses moved to those hashes, which can't be reversed.
|
||||
* **❌ P2MS (Pay to Multisig).** Most Bitcoin transactions are signed by a single key, which allows a single person to decide to send the Bitcoin. Multisigs instead allow multiple people to do so. P2MS was the initial attempt to support this, but it exposed public keys (like P2PK did) and only allowed a maximum of three signatures. It was quickly replaced by P2SH scripts, and more recently by P2WSH and P2TR.
|
||||
* **❌ P2SH-P2WPKH and ❌P2SH-P2WSH.** When SegWit was being deployed, people wanted to send to it even before their wallets had been upgraded. These two "Nested Segwit" or "Wrapped Address" types offered the opportunity to do so by using a classic P2SH (scripting) address to incorporate the SegWit mechanics. These are actually just P2SH addresses with specific scripts, not a proper address type, and they're no longer needed since the SegWit upgrade is long past.
|
||||
|
||||
[Unchained Capital](https://www.unchained.com/blog/bitcoin-address-types-compared) has conducted a survey of address types that they most recently updated in 2025. Besides giving more details on all of address types, it also listed how much of the Bitcoin supply was held in each address type. Though some deprecated addresses (mainly P2PKH) still hold large amounts of Bitcoin, that's a historic artifact. Some funds may be forever lost (due to lost keys) while others may be being held for the long term.
|
||||
[Unchained Capital](https://www.unchained.com/blog/bitcoin-address-types-compared) conducted a survey of address types back in 2023. Besides giving more details on all of the address types, it also lists how much of the Bitcoin supply is held in each address type. Though some deprecated addresses (particularly P2PKH and P2SH) still hold large amounts of Bitcoin, that's a historic artifact. Some of those funds may be forever lost (due to lost keys) while others may be being held for the long term.
|
||||
|
||||
| Type | Description | Fund % |
|
||||
|------|-------------|--------|
|
||||
@ -58,7 +59,7 @@ The addresses that have been deprecated are:
|
||||
|
||||
## Understand Address Prefixes
|
||||
|
||||
Each different type of address is formed in a different way. An address can be derived in a different way, encoded in a different way, or formatted in a different way. As a result, addresses have different lengths and look different. Part of that formatting tends to be a prefix, which helps to identify an address type at a glance. Sometimes that prefix is different for mainnet and for the various testing networks (signet, testnet, regtest) so that you don't confuse fake funds and real funds.
|
||||
Each different type of address is formed in a different way. An address can be derived in a different way, encoded in a different way, or formatted in a different way. As a result, addresses have different lengths and look different. Part of that formatting tends to be a prefix, which helps to identify an address type at a glance. The prefix is always different for mainnet and for the various testing networks (signet, testnet, regtest) so that you don't confuse fake funds and real funds.
|
||||
|
||||
The following chart lists out the prefixes and encoding methods for each address type:
|
||||
|
||||
@ -71,3 +72,48 @@ The following chart lists out the prefixes and encoding methods for each address
|
||||
| P2WPKH | bc1q... | tb1q...| bech32 |
|
||||
| P2WSH | bc1q... | tb1q...| bech32 |
|
||||
| P2TR | bc1p... | tb1p...| bech32m |
|
||||
|
||||
## Create More Addresses
|
||||
|
||||
Though you'll stick with the default P2PWKH addresses most of the time, you may want to create other sorts of addresses. The `getnewaddress` RPC actually offers four types:
|
||||
|
||||
| Flag | Type | Notes |
|
||||
|------|------|-------|
|
||||
| bech32 | P2PKH | Default |
|
||||
| bech32m | P2TR | |
|
||||
| legacy | P2PK | Deprecated |
|
||||
| p2sh-segwit | P2SH-PWPKH | Deprecated |
|
||||
|
||||
Missing from this is P2WSH, but that's because it has its own methods for creation, as are described later in the book.
|
||||
|
||||
The following commands use `getnewaddress` to generate an address with no label `""` for each of the four types:
|
||||
```
|
||||
$ bitcoin-cli getnewaddress "" bech32
|
||||
tb1quqv4shd6ts0t6ew5l8kcqvvxgvr8drtr7ajew2
|
||||
|
||||
$ bitcoin-cli getnewaddress "" bech32m
|
||||
tb1pps29f3evn5lscg82a2wceyl8p6s0wckjvp3zllw2myn6xg6xxvxqcekkxd
|
||||
|
||||
$ bitcoin-cli getnewaddress "" legacy
|
||||
mueEcK86JTvMrge7qibsRdMes6ET5oAGgd
|
||||
|
||||
$ bitcoin-cli getnewaddress "" p2sh-segwit
|
||||
2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq
|
||||
```
|
||||
Note that the address prefixes match each of the expected types, with `p2sh-segwit` revealing itself as actually being a P2SH transaction.
|
||||
|
||||
It seems likely that the `legacy` and `p2sh-segwit` flags will be sunset some time in the future, as they were added to support the transition to SegWit that began in 2017.
|
||||
|
||||
|
||||
## Summary: Understanding the Address
|
||||
|
||||
Addresses come in many types, and there have been several over the history of Bitcoin. However, you really only need to know about three:
|
||||
|
||||
* **P2WPKH.** Pay to Witness Public Key Hash. A SegWit v0 Bech32 address. This is the standard address for receiving funds, and what you'll use through most of this course.
|
||||
* **P2WSH.** Pay to Witness Script Hash. A SegWit v0 Bech32 address. This is an address for receiving more complex transactions that can be spent by meeting the conditions of a script.
|
||||
* **P2TR.** Pay to Tap Root. A Segwit v1 Bech32m address. Besides using Schnorr signatures, this is a sort of hybrid script that allows both single signing and the use of a Merkelized Alternative Script Tree.
|
||||
|
||||
## What's Next?
|
||||
|
||||
Continue "Understanding Your Bitcoin Setup" with [§3.6: Creating QR Codes for Addresses](03_6_Creating_QR_Codes_for_Addresses.md).
|
||||
|
||||
|
||||
@ -1,5 +1,95 @@
|
||||
TODO:
|
||||
# 3.6: Creating QR Codes for Addresses
|
||||
|
||||
To date we've been displaying addresses as little bits of bech32- and base58-encoded data. That's great if you can cut and paste them or if you can store them in shell variables. But what if you're trying to transmit an address between devices that aren't on the same network, or that don't have a direct connection even if they are? That's where QR Codes come into play.
|
||||
|
||||
## The Power of Airgaps
|
||||
|
||||
When you have two devices that don't directly talk to each other you have an [airgap](https://developer.blockchaincommons.com/airgap/). It could be created purposefully, it could be a result of a device's limitations, or it could be part of a designed architecture. Here are some common situations that involve airgaps:
|
||||
|
||||
* _Your mobile device tends to be airgapped from other devices._ Sure, it can talk to the internet, and it's been taught to talk to your printers, but the ways in which you can talk to your computer or your tablet tend to be extremely restricted.
|
||||
* _Your mobile device tends to be airgapped from other peoples' mobile devices._ Again, there may be a few ways they can talk, such as exchanging contact information, but they're limited.
|
||||
* _Hardware wallets tend to be airgapped from everything._ Some older wallets allowed you to connect up to a computer with a single cord, but many newer wallets have done away with even that.
|
||||
|
||||
This isn't just an annoyance (though it often is!). It's also a powerful security feature. Airgaps constrain transmission, they eliminate interactivity, and they highlight user agency. These are advantages that make it much harder for a device to be attacked by a virus or an active adversary. For that reason, many self-sovereign wallets, which allow users to safely hold their own funds rather than trusting an exchange, are airgapped.
|
||||
|
||||
## The Power of QR Codes
|
||||
|
||||
The practice of airgapping raise an obvious question: how do you get data to and from an airgapped device? Traditionally this was done with "sneakernet", which meant copying the data onto a floppy disk and carrying it across the airgap. More recently, the same effect can be accomplished with an SD card or an NFC card.
|
||||
|
||||
QR Codes can also be used to transmit content across airgaps. A QR Code, or Quick Response code, is simply a two-dimensional bar code. It contains data in its lines and dots and has three squares at three of the corners, which cameras can use to figure out the edges of the QR Code and flatten it out, so that it can be read correctly. These QR Codes can contain a surprising amount of information: 2,953 bytes that can be freely input. You put all of that together and you have an excellent mechanism for transmitting Bitcoin information across airgaps: you just show a QR Code on one device, and you read that code with a camera on the other.
|
||||
|
||||
## Set Up qrencode
|
||||
|
||||
One of the simplest methods for encoding data as a QR Code is the `qrencode` program, which is available for a variety of playforms from the internet.
|
||||
|
||||
If you set up your machine with the Bitcoin Standup Scripts, as we suggest, you already have it.
|
||||
```
|
||||
$ which qrencode
|
||||
/usr/bin/qrencode
|
||||
```
|
||||
|
||||
> 🍎 **OTHER OSES.** Mac and Windows both have access to `qrencode` as well. If you're using a Mac, you can install [Homebrew](https://brew.sh/) and then brew up `qrencode`. If you're using Windows, versions are available for download.
|
||||
|
||||
## Encode Addresses with qrencode
|
||||
|
||||
One of the most common uses of QR Coins in Bitcoin is to encode addresses. This can be as simple as outputting your `getnewaddress` command to `qrencode` and then outputting (`-o`) that to a file:
|
||||
```
|
||||
$ bitcoin-cli getnewaddress | qrencode -o newaddress.jpg
|
||||
$ ls -la newaddress.jpg
|
||||
-rw-r--r-- 1 standup sudo 404 Feb 19 16:04 newaddress.jpg
|
||||
```
|
||||
Here's what that code looks like:
|
||||
|
||||

|
||||
|
||||
## Test Every QR
|
||||
|
||||
Working with digital currency means never trusting anything. That's because there are no take-backs. If you make a mistake, no one can correct it for you. Often that means that you lose funds. For that reason, you should always be sure of any QR code you're given.
|
||||
|
||||
First, decode it and see what it really says. This can often be done with a mobile device: scan the code and most modern devices should show you what it says:
|
||||
|
||||
<a href="/images/03-qraddress-photo.jpg"><img src="/images/03-qraddress-photo.jpg" width=250></a>
|
||||
|
||||
Second, check the text of the QR with the person who sent it to you. For addresses, checking the first several and last several addresses can be enough. In this case, if asked, the QR sender could verify the address against their wallet with `getaddressesbylabel` and see that `tb1qguyxx...93xk3nhu` is indeed in there.
|
||||
|
||||
```
|
||||
$ bitcoin-cli getaddressesbylabel ""
|
||||
{
|
||||
"mueEcK86JTvMrge7qibsRdMes6ET5oAGgd": {
|
||||
"purpose": "receive"
|
||||
},
|
||||
"2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq": {
|
||||
"purpose": "receive"
|
||||
},
|
||||
"tb1qguyxx0e50kvsc8a73dh2tpatk4kqlg93xk3nhu": {
|
||||
"purpose": "receive"
|
||||
},
|
||||
"tb1quqv4shd6ts0t6ew5l8kcqvvxgvr8drtr7ajew2": {
|
||||
"purpose": "receive"
|
||||
},
|
||||
"tb1pps29f3evn5lscg82a2wceyl8p6s0wckjvp3zllw2myn6xg6xxvxqcekkxd": {
|
||||
"purpose": "receive"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Other Uses for QRs
|
||||
|
||||
QRs can have other uses in Bitcoin work.
|
||||
|
||||
The [Quick Connect](https://developer.blockchaincommons.com/quickconnect/) protocol allows a network coordinator (that's the `bitcoin-cli` or other server that actually talks to the Bitcoin network) to securely link to a Seed Vault (that's the airgapped hardware device where seeds or keys are actually stored). Though we'll be doing a lot of work in this course where we're just passing variables around on the command line, a real-world Bitcoin setup requires much more sophisticated separation of data of this sort for security.
|
||||
|
||||
QRs can also be used to pass complex transactions called PSBTs among multiple members of a multisig. However, PSBTs are very large, so they require a different sort of QR called [animated QRs](https://developer.blockchaincommons.com/animated-qrs/). There's more on PSBTs and animated QRs in [chapter 7](07_0_Expanding_Bitcoin_Transactions_PSBTs.md).
|
||||
|
||||
Fundamentally, any time you have non-human-readable data that you want to transmit between two devices without a direct connection, a QR Code is a great option. (But, it's one that we largely won't see again in this course, because we're of course working on the _command line_.)
|
||||
|
||||
## Summary: Creating QR Code for Addresses
|
||||
|
||||
You won't be creating more QR Codes in this course (except when we briefly touch upon Animated QR Codes). However, QR Codes are a vital part of the larger Bitcoin ecosystem because they allow you to transmit data across airgaps, which could be important for distributing addresses to people sending you money or for collecting together signatures for a PSBT. And, as it happens, you can create them right from the command line with the `qrencode` tool.
|
||||
|
||||
## What's Next?
|
||||
|
||||
Conclude "Understanding Your Bitcoin Setup" with [§3.7: Receiving a Transaction](03_7_Receiving_a_Transaction.md).
|
||||
|
||||
|
||||
|
||||
1. New Interlude: Creating QR Codes (after 3.3)
|
||||
* New Subsection: Creating a QR
|
||||
* New Subsection: Creating a Quick Connect QR
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
# 3.4: Receiving a Transaction
|
||||
# 3.7: Receiving a Transaction
|
||||
|
||||
You're now ready to receive some money at the new address you set up.
|
||||
You're now ready to receive some money at an address you created.
|
||||
|
||||
## Get Some Money
|
||||
|
||||
To do anything more, you need to get some money. On signet this is done through faucets. Since the money is all pretend, you just go to a faucet, request some money, and it will be sent over to you. We suggest using the faucet at [https://signetfaucet.com/](https://signetfaucet.com/) or [https://signet257.bublina.eu.org/](https://signet257.bublina.eu.org/). If they're not available for some reason, search for "bitcoin signet faucet", and you should find others.
|
||||
|
||||
To use a faucet, you'll usually need to go to a URL and copy and paste in your address. Note that this is one of those cases where you won't be able to use command-line variables, alas. Afterward, a transaction will be created that sends money from the faucet to you.
|
||||
To use a faucet, you'll usually need to go to a URL and copy and paste in your address. Afterward, a transaction will be created that sends money from the faucet to you.
|
||||
|
||||
> :book: ***What is a transaction?*** A transaction is a bitcoin exchange. The owner of some bitcoins uses his private key to access those coins, then locks the transaction using the recipient's public key.
|
||||
> :book: ***What is a transaction?*** A transaction is a bitcoin exchange. The owner of some bitcoins uses his private key to access those coins, then locks the transaction using the recipient's public key, at least for a P2WPKH transaction.
|
||||
|
||||
> :link: **SIGNET vs MAINNET:** Sadly, there are no faucets in real life. If you were playing on the mainnet, you'd need to go and actually buy bitcoins at a bitcoin exchange or ATM, or you'd need to get someone to send them to you. Signet life is much easier.
|
||||
|
||||
@ -25,31 +25,32 @@ Welcome to the world of Bitcoin latency. The problem is that your transaction ha
|
||||
|
||||
> :book: ***What is a block?*** Transactions are transmitted across the network and gathered into blocks by miners. These blocks are secured with a mathematical proof-of-work, which proves that computing power has been expended as part of the block creation. It's that proof-of-work (multiplied over many blocks, each built atop the last) that ultimately keeps Bitcoin secure.
|
||||
|
||||
> :book: ***What is a miner?*** A miner is a participant of the Bitcoin network who works to create blocks. It's a paying job: when a miner successfully creates a block, he is paid a one-time reward plus the fees for the transactions in his block. Mining is big business. Miners tend to run on special hardware, accelerated in ways that make it more likely that they'll be able to create blocks. They also tend to be part of mining pools, where the miners all agree to share out the rewards when one of them successfully creates a block.
|
||||
> :book: ***What is a miner?*** A miner is a participant of the Bitcoin network who works to create blocks. It's a paying job: when a miner successfully creates a block, they are paid a one-time reward plus the fees for the transactions in his block. Mining is big business. Miners tend to run on special hardware, accelerated in ways that make it more likely that they'll be able to create blocks. They also tend to be part of mining pools, where the miners all agree to share out the rewards when one of them successfully creates a block.
|
||||
|
||||
Fortunately, `bitcoin-cli getunconfirmedbalance` should still show your updated balance as long as the initial transaction has been created:
|
||||
You might have to wait patiently for those funds. Some faucets have a waiting queue before they'll distribute funds, and in any case it takes 10 minutes to make every block, even if a faucet sent a transaction immediately, it might take 10 minutes to arrive. Eventually, however, you should see funds:
|
||||
```
|
||||
$ bitcoin-cli getunconfirmedbalance
|
||||
0.01010000
|
||||
$ bitcoin-cli getbalance
|
||||
0.00500090
|
||||
```
|
||||
If that's still showing a zero too, you're probably moving through this tutorial too fast. Wait a second. The coins should show up unconfirmed, then rapidly move to confirmed. Do note that a coin can move from unconfirmedbalance to confirmedbalance almost immediately, so make sure you check both. However, if your `getbalance` and your `getunconfirmedbalance` both still show zero in ten minutes, then there's probably something wrong with the faucet, and you'll need to pick another.
|
||||
|
||||
> :book: **Is Ten Minutes the Rule?** Ten minutes is the average amount of time it should take to generate a Bitcoin block. On Signet, it's pretty close to the rule, because the whole point of Signet is to have a regular, reliable testing environment. On Mainnet, the block time depends on when someone can randomly solve the tough proof-of-work problem that allows them to create a block. Sometimes it might take 30 minutes to generate a block, and then suddenly two more arrive a few minutes later each. Over time, the difficulty of the proof-of-work problem is moved up or down to bring the average back to 10 minutes per block.
|
||||
|
||||
### Gain Confidence in Your Money
|
||||
|
||||
You can use `bitcoin-cli getbalance "*" [n]`, where you replace `[n]` with an integer, to see if a confirmed balance is 'n' blocks deep.
|
||||
|
||||
> :book: ***What is block depth?*** After a block is built and confirmed, another block is built on top of it, and another ... Because this is a stochastic process, there's some chance for reversal when a block is still new. Thus, a block has to be buried several blocks deep in a chain before you can feel totally confident in your funds. Each of those blocks tends to be built in an average of 10 minutes ... so it usually takes about an hour for a confirmed transaction to receive six blocks deep, which is the measure for full confidence in Bitcoin.
|
||||
> :book: ***What is block depth?*** After a block is built and confirmed, another block is built on top of it, and another ... Because this is a stochastic process, there's some chance for reversal when a block is still new. Therefore, a block has to be buried several blocks deep in a chain before you can feel totally confident in your funds. Since each of those blocks tends to be built in an average of 10 minutes, it usually takes about an hour for a confirmed transaction to receive six blocks deep, which is the measure for full confidence in Bitcoin.
|
||||
|
||||
The following shows that our transactions have been confirmed one time, but not twice:
|
||||
```
|
||||
$ bitcoin-cli getbalance "*" 1
|
||||
0.01010000
|
||||
$ bitcoin-cli getbalance "*" 2
|
||||
$ bitcoin-cli getbalance "*" 1
|
||||
0.00500090
|
||||
$ bitcoin-cli getbalance "*" 2
|
||||
0.00000000
|
||||
```
|
||||
Obviously, every ten minutes or so this depth will increase.
|
||||
|
||||
Of course, on the signet, no one is that worried about how reliable your funds are. You'll be able to spend your money as soon as it's confirmed.
|
||||
Of course, on the Signet, no one is that worried about how reliable your funds are. You'll be able to spend your money as soon as it's confirmed.
|
||||
|
||||
## Verify Your Wallet
|
||||
|
||||
@ -59,18 +60,26 @@ $ bitcoin-cli getwalletinfo
|
||||
{
|
||||
"walletname": "",
|
||||
"walletversion": 169900,
|
||||
"balance": 0.01010000,
|
||||
"unconfirmed_balance": 0.00000000,
|
||||
"immature_balance": 0.00000000,
|
||||
"txcount": 2,
|
||||
"keypoololdest": 1592335137,
|
||||
"keypoolsize": 999,
|
||||
"hdseedid": "fdea8e2630f00d29a9d6ff2af7bf5b358d061078",
|
||||
"keypoolsize_hd_internal": 1000,
|
||||
"format": "sqlite",
|
||||
"txcount": 3,
|
||||
"keypoolsize": 3997,
|
||||
"keypoolsize_hd_internal": 4000,
|
||||
"paytxfee": 0.00000000,
|
||||
"private_keys_enabled": true,
|
||||
"avoid_reuse": false,
|
||||
"scanning": false
|
||||
"scanning": false,
|
||||
"descriptors": true,
|
||||
"external_signer": false,
|
||||
"blank": false,
|
||||
"birthtime": 1771543118,
|
||||
"flags": [
|
||||
"last_hardened_xpub_cached",
|
||||
"descriptor_wallet"
|
||||
],
|
||||
"lastprocessedblock": {
|
||||
"hash": "000000012b1a2e0d5df2eeba0aa678f69ced5cf036c67299547f0894afbbdf8a",
|
||||
"height": 292310
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -81,110 +90,104 @@ Your money came into your wallet via a transaction. You can discover that transa
|
||||
$ bitcoin-cli listtransactions
|
||||
[
|
||||
{
|
||||
"address": "mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE",
|
||||
"category": "receive",
|
||||
"amount": 0.01000000,
|
||||
"label": "",
|
||||
"vout": 1,
|
||||
"confirmations": 1,
|
||||
"blockhash": "00000000000001753b24411d0e4726212f6a53aeda481ceff058ffb49e1cd969",
|
||||
"blockheight": 1772396,
|
||||
"blockindex": 73,
|
||||
"blocktime": 1592600085,
|
||||
"txid": "8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9",
|
||||
"walletconflicts": [
|
||||
"address": "2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq",
|
||||
"parent_descs": [
|
||||
"sh(wpkh([1091501a/49h/1h/0h]tpubDCsAfCNPzp1BvrL8u6rdgD693s9MjcPvswzwkdzRT24BBHVc4cRNH13Z9yKTtdEcg4kmZLUa3FxZgwKfr6LVMoPfKB6x5xMz9HietddEcaX/0/*))#0xkvj5k7"
|
||||
],
|
||||
"time": 1592599884,
|
||||
"timereceived": 1592599884,
|
||||
"bip125-replaceable": "no"
|
||||
},
|
||||
{
|
||||
"address": "mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE",
|
||||
"category": "receive",
|
||||
"amount": 0.00010000,
|
||||
"amount": 0.00500090,
|
||||
"label": "",
|
||||
"vout": 0,
|
||||
"vout": 48,
|
||||
"abandoned": false,
|
||||
"confirmations": 1,
|
||||
"blockhash": "00000000000001753b24411d0e4726212f6a53aeda481ceff058ffb49e1cd969",
|
||||
"blockheight": 1772396,
|
||||
"blockindex": 72,
|
||||
"blocktime": 1592600085,
|
||||
"txid": "ca4898d8f950df03d6bfaa00578bd0305d041d24788b630d0c4a32debcac9f36",
|
||||
"blockhash": "000000012b1a2e0d5df2eeba0aa678f69ced5cf036c67299547f0894afbbdf8a",
|
||||
"blockheight": 292310,
|
||||
"blockindex": 28,
|
||||
"blocktime": 1771548933,
|
||||
"txid": "8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c",
|
||||
"wtxid": "96f40640ad3242b593de502fc47a7633a0be8c7eb5996dd843fb1ad4a0ada46c",
|
||||
"walletconflicts": [
|
||||
"078bfa57116a7a5fbc8119606a054f34fa0dce0d90d15df0b6aebfa817010d94",
|
||||
"a69f25e4bf09ae1eebf3bdae56744f02c2d5a0dfed4f8d078ee99ee3a22571e9"
|
||||
],
|
||||
"time": 1592599938,
|
||||
"timereceived": 1592599938,
|
||||
"mempoolconflicts": [
|
||||
],
|
||||
"time": 1771548914,
|
||||
"timereceived": 1771548914,
|
||||
"bip125-replaceable": "no"
|
||||
}
|
||||
]
|
||||
|
||||
```
|
||||
This shows two transactions (`8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9`) and (`ca4898d8f950df03d6bfaa00578bd0305d041d24788b630d0c4a32debcac9f36`) for a specific amount (`0.01000000` and `0.00010000`), which were both received (`receive`) by the same address in our wallet (`mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE`). That's bad key hygeine, by the way: you should use a new address for every single Bitcoin you ever receive. In this case, we got impatient because the first faucet didn't seem to be working.
|
||||
This shows one transaction (`8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c`) for a specific ammount (`0.00500090`) which was received by a specific address in your wallet (`2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq`).
|
||||
|
||||
You can access similar information with the `bitcoin-cli listunspent` command, but it only shows the transactions for the money that you haven't spent. These are called UTXOs, and will be vitally important when you're sending money back out into the Bitcoin world:
|
||||
```
|
||||
$ bitcoin-cli listunspent
|
||||
[
|
||||
{
|
||||
"txid": "ca4898d8f950df03d6bfaa00578bd0305d041d24788b630d0c4a32debcac9f36",
|
||||
"vout": 0,
|
||||
"address": "mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE",
|
||||
"txid": "8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c",
|
||||
"vout": 48,
|
||||
"address": "2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq",
|
||||
"label": "",
|
||||
"scriptPubKey": "76a9141b72503639a13f190bf79acf6d76255d772360b788ac",
|
||||
"amount": 0.00010000,
|
||||
"confirmations": 1,
|
||||
"redeemScript": "001461a3a217641fdea3b3ff444b4f582763ea949132",
|
||||
"scriptPubKey": "a914c29d2f62bb6593e01719ada872a779f4f2990e7087",
|
||||
"amount": 0.00500090,
|
||||
"confirmations": 2,
|
||||
"spendable": true,
|
||||
"solvable": true,
|
||||
"desc": "pkh([d6043800/0'/0'/1']02fd5740996d853ea51a6904cf03257fc11204b0179f344c49739ec5b20b39c9ba)#62rud39c",
|
||||
"safe": true
|
||||
},
|
||||
{
|
||||
"txid": "8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9",
|
||||
"vout": 1,
|
||||
"address": "mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE",
|
||||
"label": "",
|
||||
"scriptPubKey": "76a9141b72503639a13f190bf79acf6d76255d772360b788ac",
|
||||
"amount": 0.01000000,
|
||||
"confirmations": 1,
|
||||
"spendable": true,
|
||||
"solvable": true,
|
||||
"desc": "pkh([d6043800/0'/0'/1']02fd5740996d853ea51a6904cf03257fc11204b0179f344c49739ec5b20b39c9ba)#62rud39c",
|
||||
"desc": "sh(wpkh([1091501a/49h/1h/0h/0/0]038f833378b831969986212fcb557ac18c5e0001e1ae9066423c2376dd9d451513))#a2fumkh9",
|
||||
"parent_descs": [
|
||||
"sh(wpkh([1091501a/49h/1h/0h]tpubDCsAfCNPzp1BvrL8u6rdgD693s9MjcPvswzwkdzRT24BBHVc4cRNH13Z9yKTtdEcg4kmZLUa3FxZgwKfr6LVMoPfKB6x5xMz9HietddEcaX/0/*))#0xkvj5k7"
|
||||
],
|
||||
"safe": true
|
||||
}
|
||||
]
|
||||
```
|
||||
Note that bitcoins are not just a homogeneous mess of cash jammed into your pocket. Each individual transaction that you receive or that you send is placed into the immutable blockchain ledger, in a block. You can see these individual transactions when you look at your unspent money. This means that bitcoin spending isn't quite as anonymous as you'd think. Though the addresses are fairly private, transactions can be examined as they go in and out of addresses. This makes privacy vulnerable to statistical analysis. It also introduces some potential non-fungibility to bitcoins, as you can track back through series of transactions, even if you can't track a specific "bitcoin".
|
||||
|
||||
> :book: ***Why are all of these bitcoin amounts in fractions?*** Bitcoins are produced slowly, and so there are relatively few in circulation. As a result, each bitcoin over on the mainnet is worth quite a bit (~ $9,000 at the time of this writing). This means that people usually work in fractions. In fact, the .0101 in Signet coins would be worth about $9000 if they were on the mainnet. For this reason, names have appeared for smaller amounts of bitcoins, including millibitcoins or mBTCs (one-thousandth of a bitcoin), microbitcoins or bits or μBTCs (one-millionth of a bitcoin), and satoshis (one hundred millionth of a bitcoin).
|
||||
> :book: ***Why are all of these bitcoin amounts in decimals?*** Bitcoins are produced slowly, and so there are relatively few in circulation. As a result, each bitcoin over on the mainnet is worth quite a bit (~ $67,000 at the time of this writing). This means that people usually work in fractional amounts. In fact, the .005 in Signet coins would be worth about $300 if they were on the mainnet. For this reason, names have appeared for smaller amounts of bitcoins, including millibitcoins or mBTCs (one-thousandth of a bitcoin), microbitcoins or bits or μBTCs (one-millionth of a bitcoin), and satoshis (one hundred millionth of a bitcoin).
|
||||
|
||||
## Examine Your Transaction
|
||||
|
||||
You can get more information on a transaction with the `bitcoin-cli gettransaction` command:
|
||||
```
|
||||
$ bitcoin-cli gettransaction "8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9"
|
||||
$ bitcoin-cli gettransaction 8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c
|
||||
{
|
||||
"amount": 0.01000000,
|
||||
"amount": 0.00500090,
|
||||
"confirmations": 1,
|
||||
"blockhash": "00000000000001753b24411d0e4726212f6a53aeda481ceff058ffb49e1cd969",
|
||||
"blockheight": 1772396,
|
||||
"blockindex": 73,
|
||||
"blocktime": 1592600085,
|
||||
"txid": "8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9",
|
||||
"blockhash": "000000012b1a2e0d5df2eeba0aa678f69ced5cf036c67299547f0894afbbdf8a",
|
||||
"blockheight": 292310,
|
||||
"blockindex": 28,
|
||||
"blocktime": 1771548933,
|
||||
"txid": "8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c",
|
||||
"wtxid": "96f40640ad3242b593de502fc47a7633a0be8c7eb5996dd843fb1ad4a0ada46c",
|
||||
"walletconflicts": [
|
||||
"078bfa57116a7a5fbc8119606a054f34fa0dce0d90d15df0b6aebfa817010d94",
|
||||
"a69f25e4bf09ae1eebf3bdae56744f02c2d5a0dfed4f8d078ee99ee3a22571e9"
|
||||
],
|
||||
"time": 1592599884,
|
||||
"timereceived": 1592599884,
|
||||
"mempoolconflicts": [
|
||||
],
|
||||
"time": 1771548914,
|
||||
"timereceived": 1771548914,
|
||||
"bip125-replaceable": "no",
|
||||
"details": [
|
||||
{
|
||||
"address": "mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE",
|
||||
"address": "2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq",
|
||||
"parent_descs": [
|
||||
"sh(wpkh([1091501a/49h/1h/0h]tpubDCsAfCNPzp1BvrL8u6rdgD693s9MjcPvswzwkdzRT24BBHVc4cRNH13Z9yKTtdEcg4kmZLUa3FxZgwKfr6LVMoPfKB6x5xMz9HietddEcaX/0/*))#0xkvj5k7"
|
||||
],
|
||||
"category": "receive",
|
||||
"amount": 0.01000000,
|
||||
"amount": 0.00500090,
|
||||
"label": "",
|
||||
"vout": 1
|
||||
"vout": 48,
|
||||
"abandoned": false
|
||||
}
|
||||
],
|
||||
"hex": "0200000000010114d04977d1b0137adbf51dd5d79944b9465a2619f3fa7287eb69a779977bf5800100000017160014e85ba02862dbadabd6d204fcc8bb5d54658c7d4ffeffffff02df690f000000000017a9145c3bfb36b03f279967977ca9d1e35185e39917788740420f00000000001976a9141b72503639a13f190bf79acf6d76255d772360b788ac0247304402201e74bdfc330fc2e093a8eabe95b6c5633c8d6767249fa25baf62541a129359c202204d462bd932ee5c15c7f082ad7a6b5a41c68addc473786a0a9a232093fde8e1330121022897dfbf085ecc6ad7e22fc91593414a845659429a7bbb44e2e536258d2cbc0c270b1b00"
|
||||
"hex": "02000000000101653...733fd5750400",
|
||||
"lastprocessedblock": {
|
||||
"hash": "0000001058c350b95ba1dc2b689ad905a9907091255b28396b6eeb0e9d4ab167",
|
||||
"height": 292311
|
||||
}
|
||||
}
|
||||
```
|
||||
The `gettransaction` command will detail transactions that are in your wallet, such as this one, that was sent to us.
|
||||
@ -198,92 +201,143 @@ Get detailed information about in-wallet transaction <txid>
|
||||
|
||||
Arguments:
|
||||
1. txid (string, required) The transaction id
|
||||
2. include_watchonly (boolean, optional, default=true for watch-only wallets, otherwise false) Whether to include watch-only addresses in balance calculation and details[]
|
||||
2. include_watchonly (boolean, optional, default=false) (DEPRECATED) No longer used
|
||||
3. verbose (boolean, optional, default=false) Whether to include a `decoded` field containing the decoded transaction (equivalent to RPC decoderawtransaction)
|
||||
|
||||
```
|
||||
By setting these two true or false, we can choose to include watch-only addresses in the output (which we don't care about) or look at more verbose output (which we do).
|
||||
|
||||
Here's what this data instead looks at when we set `include_watchonly` to `false` and `verbose` to `true`.
|
||||
```
|
||||
$ bitcoin-cli gettransaction "8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9" false true
|
||||
$ bitcoin-cli gettransaction 8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c false true
|
||||
{
|
||||
"amount": 0.01000000,
|
||||
"confirmations": 3,
|
||||
"blockhash": "00000000000001753b24411d0e4726212f6a53aeda481ceff058ffb49e1cd969",
|
||||
"blockheight": 1772396,
|
||||
"blockindex": 73,
|
||||
"blocktime": 1592600085,
|
||||
"txid": "8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9",
|
||||
"amount": 0.00500090,
|
||||
"confirmations": 2,
|
||||
"blockhash": "000000012b1a2e0d5df2eeba0aa678f69ced5cf036c67299547f0894afbbdf8a",
|
||||
"blockheight": 292310,
|
||||
"blockindex": 28,
|
||||
"blocktime": 1771548933,
|
||||
"txid": "8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c",
|
||||
"wtxid": "96f40640ad3242b593de502fc47a7633a0be8c7eb5996dd843fb1ad4a0ada46c",
|
||||
"walletconflicts": [
|
||||
"078bfa57116a7a5fbc8119606a054f34fa0dce0d90d15df0b6aebfa817010d94",
|
||||
"a69f25e4bf09ae1eebf3bdae56744f02c2d5a0dfed4f8d078ee99ee3a22571e9"
|
||||
],
|
||||
"time": 1592599884,
|
||||
"timereceived": 1592599884,
|
||||
"mempoolconflicts": [
|
||||
],
|
||||
"time": 1771548914,
|
||||
"timereceived": 1771548914,
|
||||
"bip125-replaceable": "no",
|
||||
"details": [
|
||||
{
|
||||
"address": "mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE",
|
||||
"address": "2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq",
|
||||
"parent_descs": [
|
||||
"sh(wpkh([1091501a/49h/1h/0h]tpubDCsAfCNPzp1BvrL8u6rdgD693s9MjcPvswzwkdzRT24BBHVc4cRNH13Z9yKTtdEcg4kmZLUa3FxZgwKfr6LVMoPfKB6x5xMz9HietddEcaX/0/*))#0xkvj5k7"
|
||||
],
|
||||
"category": "receive",
|
||||
"amount": 0.01000000,
|
||||
"amount": 0.00500090,
|
||||
"label": "",
|
||||
"vout": 1
|
||||
"vout": 48,
|
||||
"abandoned": false
|
||||
}
|
||||
],
|
||||
"hex": "0200000000010114d04977d1b0137adbf51dd5d79944b9465a2619f3fa7287eb69a779977bf5800100000017160014e85ba02862dbadabd6d204fcc8bb5d54658c7d4ffeffffff02df690f000000000017a9145c3bfb36b03f279967977ca9d1e35185e39917788740420f00000000001976a9141b72503639a13f190bf79acf6d76255d772360b788ac0247304402201e74bdfc330fc2e093a8eabe95b6c5633c8d6767249fa25baf62541a129359c202204d462bd932ee5c15c7f082ad7a6b5a41c68addc473786a0a9a232093fde8e1330121022897dfbf085ecc6ad7e22fc91593414a845659429a7bbb44e2e536258d2cbc0c270b1b00",
|
||||
"hex": "02000000000101653...733fd5750400",
|
||||
"decoded": {
|
||||
"txid": "8e2ab10cabe9ec04ed438086a80b1ac72558cc05bb206e48fc9a18b01b9282e9",
|
||||
"hash": "d4ae2b009c43bfe9eba96dcd16e136ceba2842df3d76a67d689fae5975ce49cb",
|
||||
"txid": "8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c",
|
||||
"hash": "96f40640ad3242b593de502fc47a7633a0be8c7eb5996dd843fb1ad4a0ada46c",
|
||||
"version": 2,
|
||||
"size": 249,
|
||||
"vsize": 168,
|
||||
"weight": 669,
|
||||
"locktime": 1772327,
|
||||
"size": 3563,
|
||||
"vsize": 3512,
|
||||
"weight": 14048,
|
||||
"locktime": 292309,
|
||||
"vin": [
|
||||
{
|
||||
"txid": "80f57b9779a769eb8772faf319265a46b94499d7d51df5db7a13b0d17749d014",
|
||||
"vout": 1,
|
||||
"txid": "c550ee29fdc62e1d42c966bd67282e7db922773945344ddeef699db875603c65",
|
||||
"vout": 0,
|
||||
"scriptSig": {
|
||||
"asm": "0014e85ba02862dbadabd6d204fcc8bb5d54658c7d4f",
|
||||
"hex": "160014e85ba02862dbadabd6d204fcc8bb5d54658c7d4f"
|
||||
"asm": "",
|
||||
"hex": ""
|
||||
},
|
||||
"txinwitness": [
|
||||
"304402201e74bdfc330fc2e093a8eabe95b6c5633c8d6767249fa25baf62541a129359c202204d462bd932ee5c15c7f082ad7a6b5a41c68addc473786a0a9a232093fde8e13301",
|
||||
"022897dfbf085ecc6ad7e22fc91593414a845659429a7bbb44e2e536258d2cbc0c"
|
||||
"f2183e5e3f233bb9e11f33a2c6c1691bea3b4bb2f19a8674cff8dfecdda4685789eba8745609a560e827b8e0eb9909772baa00a76d23c1faac72c40b83bd733f"
|
||||
],
|
||||
"sequence": 4294967294
|
||||
"sequence": 4294967293
|
||||
}
|
||||
],
|
||||
"vout": [
|
||||
{
|
||||
"value": 0.01010143,
|
||||
"value": 1256.11643555,
|
||||
"n": 0,
|
||||
"scriptPubKey": {
|
||||
"asm": "OP_HASH160 5c3bfb36b03f279967977ca9d1e35185e3991778 OP_EQUAL",
|
||||
"hex": "a9145c3bfb36b03f279967977ca9d1e35185e399177887",
|
||||
"reqSigs": 1,
|
||||
"type": "scripthash",
|
||||
"addresses": [
|
||||
"2N1ev1WKevSsdmAvRqZf7JjvDg223tPrVCm"
|
||||
]
|
||||
"asm": "1 aac35fe91f20d48816b3c83011d117efa35acd2414d36c1e02b0f29fc3106d90",
|
||||
"desc": "rawtr(aac35fe91f20d48816b3c83011d117efa35acd2414d36c1e02b0f29fc3106d90)#au3flvfu",
|
||||
"hex": "5120aac35fe91f20d48816b3c83011d117efa35acd2414d36c1e02b0f29fc3106d90",
|
||||
"address": "tb1p4tp4l6glyr2gs94neqcpr5gha7344nfyznfkc8szkreflscsdkgqsdent4",
|
||||
"type": "witness_v1_taproot"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.01000000,
|
||||
"value": 0.00000000,
|
||||
"n": 1,
|
||||
"scriptPubKey": {
|
||||
"asm": "OP_DUP OP_HASH160 1b72503639a13f190bf79acf6d76255d772360b7 OP_EQUALVERIFY OP_CHECKSIG",
|
||||
"hex": "76a9141b72503639a13f190bf79acf6d76255d772360b788ac",
|
||||
"reqSigs": 1,
|
||||
"type": "pubkeyhash",
|
||||
"addresses": [
|
||||
"mi25UrzHnvn3bpEfFCNqJhPWJn5b77a5NE"
|
||||
]
|
||||
"asm": "OP_RETURN 616c742e7369676e65746661756365742e636f6d207c203930207c205468697320697320612074657374206e6574776f726b2e20436f696e732068617665206e6f2076616c75652e207c2076623962383365",
|
||||
"desc": "raw(6a4c52616c742e7369676e65746661756365742e636f6d207c203930207c205468697320697320612074657374206e6574776f726b2e20436f696e732068617665206e6f2076616c75652e207c2076623962383365)#zz3mwpqc",
|
||||
"hex": "6a4c52616c742e7369676e65746661756365742e636f6d207c203930207c205468697320697320612074657374206e6574776f726b2e20436f696e732068617665206e6f2076616c75652e207c2076623962383365",
|
||||
"type": "nulldata"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"value": 0.00500090,
|
||||
"n": 2,
|
||||
"scriptPubKey": {
|
||||
"asm": "0 02b9d2f57dd3fadbbeb100d49a686e06b2b43ce5",
|
||||
"desc": "addr(tb1qq2ua9ata60adh043qr2f56rwq6etg089xshs0g)#lwpdnyre",
|
||||
"hex": "001402b9d2f57dd3fadbbeb100d49a686e06b2b43ce5",
|
||||
"address": "tb1qq2ua9ata60adh043qr2f56rwq6etg089xshs0g",
|
||||
"type": "witness_v0_keyhash"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.00500090,
|
||||
"n": 3,
|
||||
"scriptPubKey": {
|
||||
"asm": "0 0bec08492d89e0a5ff6947f57e58b10793e1c3f6",
|
||||
"desc": "addr(tb1qp0kqsjfd38s2tlmfgl6huk93q7f7rslkcl50fl)#nkve3qrw",
|
||||
"hex": "00140bec08492d89e0a5ff6947f57e58b10793e1c3f6",
|
||||
"address": "tb1qp0kqsjfd38s2tlmfgl6huk93q7f7rslkcl50fl",
|
||||
"type": "witness_v0_keyhash"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.00500090,
|
||||
"n": 4,
|
||||
"scriptPubKey": {
|
||||
"asm": "0 0c618d8a36ed23cc13e1f92f880f879918aaa815",
|
||||
"desc": "addr(tb1qp3scmz3ka53ucylplyhcsru8nyv242q4ucf9lt)#6lm9vhtp",
|
||||
"hex": "00140c618d8a36ed23cc13e1f92f880f879918aaa815",
|
||||
"address": "tb1qp3scmz3ka53ucylplyhcsru8nyv242q4ucf9lt",
|
||||
"type": "witness_v0_keyhash"
|
||||
}
|
||||
},
|
||||
{
|
||||
"value": 0.00500090,
|
||||
"n": 5,
|
||||
"scriptPubKey": {
|
||||
"asm": "0 0ca3037bc9d5dfdbd11aac2055445049c11d569b",
|
||||
"desc": "addr(tb1qpj3sx77f6h0ah5g64ss923zsf8q3645musu6jd)#u9q7ehwz",
|
||||
"hex": "00140ca3037bc9d5dfdbd11aac2055445049c11d569b",
|
||||
"address": "tb1qpj3sx77f6h0ah5g64ss923zsf8q3645musu6jd",
|
||||
"type": "witness_v0_keyhash"
|
||||
}
|
||||
},
|
||||
...
|
||||
"lastprocessedblock": {
|
||||
"hash": "0000001058c350b95ba1dc2b689ad905a9907091255b28396b6eeb0e9d4ab167",
|
||||
"height": 292311
|
||||
}
|
||||
}
|
||||
```
|
||||
Now you can see the full information on the transaction, including all of the inputs ("vin") and all the outputs ("vout). One of the interesting things to note is that although we received .01 BTC in the transaction, another .01010143 was sent to another address. That was probably a change address, a concept that is explored in the next section. It is quite typical for a transaction to have multiple inputs and/or multiple outputs.
|
||||
Now you can see the full information on the transaction, including all of the inputs ("vin") and all the outputs ("vout). One of the interesting things to note is that although we received .00500090 BTC in the transaction, the same amount was sent to dozens of additional addresses (the full list was cut down to just the first several). It is quite typical for a transaction to have multiple inputs and/or multiple outputs.
|
||||
|
||||
There is another command, `getrawtransaction`, which allows you to look at transactions that are not in your wallet. However, it requires you to have an unpruned node and `txindex=1` in your `bitcoin.conf` file. Unless you have a serious need for information not in your wallet, it's probably just better to use a Bitcoin explorer for this sort of thing ...
|
||||
|
||||
@ -295,13 +349,13 @@ Currently, our preferred block explorer is [https://mempool.space/](https://memp
|
||||
|
||||
You can use it to look up transactions for an address:
|
||||
|
||||
[https://mempool.space/signet/address/tb1pffsyra2t3nut94yvdae9evz3feg7tel843pfcv76vt5cwewavtesl3gsph](https://mempool.space/signet/address/tb1pffsyra2t3nut94yvdae9evz3feg7tel843pfcv76vt5cwewavtesl3gsph)
|
||||
[https://mempool.space/signet/address/2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq](https://mempool.space/signet/address/2NAzFNuopaor2YnqVA2QC4KYme6HxWTk7jq)
|
||||
|
||||
You can also use it to look at individual transactions:
|
||||
|
||||
[https://mempool.space/signet/tx/e5b8940b2dd5a1bbb032228dedd85cd8c21f0ce5cf4b76c959f71d967de626b3](https://mempool.space/signet/tx/e5b8940b2dd5a1bbb032228dedd85cd8c21f0ce5cf4b76c959f71d967de626b3)
|
||||
[https://mempool.space/signet/tx/8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c](https://mempool.space/signet/tx/8954c067d0d3b47825300effeff9501a584c9644bfd58764a6af08a1f084f67c)
|
||||
|
||||
A block explorer doesn't generally provide any more information than a command line look at a raw transaction; it just does a good job of highlighting the important information and putting together the puzzle pieces, including the transaction fees behind a transaction — another concept that we'll be covering in future sections.
|
||||
A block explorer doesn't generally provide any more information than a command line look at a raw transaction; it just does a good job of highlighting the important information and putting together the puzzle pieces, including the transaction fees behind a transaction, another concept that we'll be covering in future sections.
|
||||
|
||||
## Summary: Receiving a Transaction
|
||||
|
||||
@ -309,7 +363,9 @@ Faucets will give you money on the testnet. They come in as raw transactions, wh
|
||||
|
||||
## What's Next?
|
||||
|
||||
For a deep dive into how addresses are described, so that they can be transferred or made into parts of a multi-signature, see [§3.5: Understanding the Descriptor](03_5_Understanding_the_Descriptor.md).
|
||||
For an aside on using command-line variables that will be vital to the rest of this course, read [Interlude: Using Command-Line Variables](03_7a_Interlude_Using_Command-Line_Variables.md).
|
||||
|
||||
If you're already comfortable with them, continue on to [Chapter Four: Sending Bitcoin Transactions](04_0_Sending_Bitcoin_Transactions.md).
|
||||
|
||||
|
||||
But if that's too in-depth, continue on to [Chapter Four: Sending Bitcoin Transactions](04_0_Sending_Bitcoin_Transactions.md).
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Interlude: Using Command-Line Variables
|
||||
|
||||
The previous section demonstrated a number of command-line commands used without obfuscation or interference. However, that's often not the best way to run Bitcoin from the command line. Because you're dealing with long, complex, and unreadable variables, it's easy to make a mistake if you're copying those variables around (or, satoshi forfend, if you're typing them in by hand). Because those variables can mean the difference between receiving and losing real money, you don't _want_ to make mistakes. For these reasons, we strongly suggest using command-line variables to save addresses, signatures, or other long strings of information whenever it's reasonable to do so.
|
||||
This chapter demonstrated a number of command-line commands used without obfuscation or interference. However, that's often not the best way to run Bitcoin from the command line. Because you're dealing with long, complex, non-human-readable variables, it's easy to make a mistake if you're copying those variables around (or, satoshi forfend, if you're typing them in by hand). Because those variables can mean the difference between receiving and losing real money, you don't _want_ to make mistakes. For these reasons, we strongly suggest using command-line variables to save addresses, signatures, or other long strings of information whenever it's reasonable to do so.
|
||||
|
||||
If you're using `bash`, you can save information to a variable like this:
|
||||
```
|
||||
@ -17,7 +17,7 @@ This commands fills the NEW_ADDRESS_1 variable with the results of the `bitcoin-
|
||||
You can then use your shell's `echo` command to look at your (new) address:
|
||||
```
|
||||
$ echo $NEW_ADDRESS_1
|
||||
tb1q0psqqqgy0fv5928wmk86ntu7hlax8dva7nl82p
|
||||
tb1qhed3ausdjr6crntypcqjv6l2n2vtv2qv7dednu
|
||||
```
|
||||
You can then use this variable in other commands which require the address (or do similar for any other complex output). The rest of this tutorial will use this style of saving information to variables when it's practical.
|
||||
|
||||
@ -29,4 +29,4 @@ Shell variables can be used to hold long Bitcoin strings, minimizing the chances
|
||||
|
||||
## What's Next?
|
||||
|
||||
See how to store information in a different way with [Interlude: Creating QR Codes](03_3b_Interlude_Creating_QR_Codes.md).
|
||||
Continue on to [Chapter Four: Sending Bitcoin Transactions](04_0_Sending_Bitcoin_Transactions.md).
|
||||
|
||||
@ -36,8 +36,8 @@ If you'd like to make your own translation, please see [Contributing](https://gi
|
||||
* [3.3: Setting Up Your Wallet](03_3_Setting_Up_Your_Wallet.md)
|
||||
* [3.4: Understanding the Descriptor](03_4_Understanding_the_Descriptor.md)
|
||||
* [3.5: Understanding the Address](03_5_Understanding_the_Address.md)
|
||||
* [3.6: Creating QR Codes for Addresses](03_6_Creating_QR_Codes_for_Addresses.md) [**TO WRITE**]
|
||||
* [3.7: Receiving a Transaction](03_7_Receiving_a_Transaction.md) [**TO REVISE**]
|
||||
* [3.6: Creating QR Codes for Addresses](03_6_Creating_QR_Codes_for_Addresses.md)
|
||||
* [3.7: Receiving a Transaction](03_7_Receiving_a_Transaction.md)
|
||||
* [Interlude: Using Command-Line Variables](03_7a_Interlude_Using_Command-Line_Variables.md)
|
||||
* [4.0: Sending Bitcoin Transactions](04_0_Sending_Bitcoin_Transactions.md) [**TO UPDATE FOR SEGWIT**]
|
||||
* [4.1: Sending Coins the Easy Way](04_1_Sending_Coins_The_Easy_Way.md) [**TO UPDATE FOR SEGWIT**]
|
||||
@ -47,8 +47,8 @@ If you'd like to make your own translation, please see [Contributing](https://gi
|
||||
* [4.4: Sending Coins with Raw Transactions](04_4_Sending_Coins_with_a_Raw_Transaction.md) [**TO UPDATE**]
|
||||
* [Interlude: Using Curl](04_4a_Interlude_Using_Curl.md)
|
||||
* [4.5: Sending Coins with Automated Raw Transactions](04_5_Sending_Coins_with_Automated_Raw_Transactions.md) [**TO UPDATE FOR SEGWIT**]
|
||||
* [4.6: Creating a Segwit Transaction](04_6_Creating_a_Segwit_Transaction.md) [**TO REMOVE MAYBE**]
|
||||
* [4.6: Sending Other Types of Transactions](04_6_Sending_Other_Types_of_Transactions.md) [**TO WRITE**]
|
||||
* [4.6: Creating a Segwit Transaction](04_6_Creating_a_Segwit_Transaction.md) [**TO REMOVE**]
|
||||
* [4.6: Sending Other Types of Transactions](04_6_Sending_Other_Types_of_Transactions.md) [**TO WRITE MAYBE**]
|
||||
* [5.0: Controlling Bitcoin Transactions](05_0_Controlling_Bitcoin_Transactions.md)
|
||||
* [5.1 Watching for Stuck Transactions](05_1_Watching_for_Stuck_Transactions.md)
|
||||
* [5.2: Resending a Transaction with RBF](05_2_Resending_a_Transaction_with_RBF.md) [**TO UPDATE**]
|
||||
|
||||
34
TODO.md
34
TODO.md
@ -2,29 +2,19 @@
|
||||
|
||||
The following TODO items are intended for a 3.0 version of Learning Bitcoin from the Command Line
|
||||
|
||||
## Immediate TODO (for 2/19): Segwit
|
||||
## Immediate TODO (for 2/19): Sending Transactions
|
||||
|
||||
1. <strike>Reorg of Chapter 3</strike>
|
||||
2. Edit Updated Content in §3.3+3.4
|
||||
2. Write New Chapter §3.5
|
||||
3. Write QR Code Interlude (§3.5a)
|
||||
* Lay out new table of all the address types
|
||||
* Demonstrate how to send legacy & wrapped Segwit transactions
|
||||
4. Update §3.6 to fit into new flow
|
||||
5. Change §4.1-4.5 to use Bech32 (incorporate existing §4.6)
|
||||
6. Remove legacy address references from the rest of the course
|
||||
1. Change §4.1-4.5 to use P2WPKH (incorporate existing §4.6)
|
||||
2. Remove legacy address references from the rest of the course
|
||||
3. Add Freezing Coins to §4.4
|
||||
4. Remove §4.6 on Segwit
|
||||
5. Add Info On Sending to Other Addresses (no biggie)
|
||||
6. Full Review of §4.1-4.5
|
||||
|
||||
## Longer-Term TODO (Small Tasks)
|
||||
|
||||
The following updates involve updates or the creation of new chapters, but their additions are generally bounded and known.
|
||||
|
||||
1. Big changes to defaults
|
||||
* <strike>Signet</strike>
|
||||
* SEGWIT
|
||||
* Talk about address types: https://www.unchained.com/blog/bitcoin-address-types-compared
|
||||
* <strike>Descriptor Wallets</strike>
|
||||
1. Revise 4.4
|
||||
* freezing coins
|
||||
1. New Interlude: Creating Animated QR Codes (after 7.1)
|
||||
* New Subsection: Understanding Uniform Resources
|
||||
* New Subsection: Creating an Animated QR
|
||||
@ -240,6 +230,15 @@ See [release notes](https://bitcoincore.org/en/releases/0.21.0/).
|
||||
|
||||
# Progress Log
|
||||
|
||||
## Immediate TODO (for 2/19): Segwit
|
||||
|
||||
1. <strike>Reorg of Chapter 3</strike>
|
||||
2. <strike>Edit Updated Content in §3.3+3.4</strike>
|
||||
3. <strike>Write new Understanding Addresses (§3.5)</strike>
|
||||
4. <strike>Write new QR Code Interlude (§3.6)</strike>
|
||||
5. <strike>Update §3.7 to fit into new flow</strike>
|
||||
6. <strike>Update §3.7a to fit into new flow</strike>
|
||||
|
||||
## Immediate TODO (for 2/5): Descriptor Wallets
|
||||
|
||||
1. <strike>Edit §3.1-3.2, esp. for any references to legacy addresses</strike> (Still need to update `bitcoin-cli -getinfo` command)
|
||||
@ -249,7 +248,6 @@ See [release notes](https://bitcoincore.org/en/releases/0.21.0/).
|
||||
6. <strike>Remove all references to things appearing at certain versions (they're all pretty standardized now)</strike>
|
||||
7. <strike>But write a note early on about potential missing features</strike>
|
||||
|
||||
|
||||
## Immediate TODO (for 1/22): Signet
|
||||
|
||||
1. <strike>Update Stackscripts to support/default signet</strike>
|
||||
|
||||
BIN
images/03-qraddress-photo.jpg
Normal file
BIN
images/03-qraddress-photo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
BIN
images/03-qraddress.jpg
Normal file
BIN
images/03-qraddress.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 404 B |
Loading…
x
Reference in New Issue
Block a user