CPSC 3640 / CPSC 5400

Decentralized Payments, Contracts, and Finance for Humans and AI

Hands-On Component: Bitcoin Core and Bitcoin Addresses

Lecture 4 · Monday, September 14, 2026

Complete this hands-on component during Lecture 4.

Safety: Never share your private keys or seed phrase. Testnet4 bitcoin is for testing and has no monetary value.

Summary

  • Install Bitcoin Core and configure it to use Testnet4.
  • Create a wallet and legacy address, then request test bitcoin.
  • Inspect your address and decode its locking script.
  • Send Testnet4 bitcoin.
  • Decode the transaction and relate an input to the previous output it spends.

Step 1: Install and configure Bitcoin Core

Bitcoin Core is software that runs a Bitcoin node: it downloads and validates blocks and transactions, and includes a wallet and a console for interacting with the node.

In this tutorial, Bitcoin Core will connect to Testnet4, a separate public Bitcoin network created for testing. Testnet4 has its own blockchain and coins; it is not connected to the Bitcoin mainnet.

1.1 Install Bitcoin Core

  1. Visit the official Bitcoin Core download page.
  2. Download the macOS arm64 zip if About This Mac lists an Apple chip, or the x86_64 zip if it lists an Intel processor.
  3. Double-click the downloaded zip file to unpack it.
  4. Drag Bitcoin Core into your Applications folder, then open it from there.

Optional alternative: If you already have Homebrew, you can install Bitcoin Core with:

brew install --cask bitcoin-core
  1. Visit the official Bitcoin Core download page.
  2. Download the Windows exe installer.
  3. Run the installer and follow its prompts.

Choose the appropriate release from the official Bitcoin Core download page.

1.2 Start Bitcoin Core

Open Bitcoin Core. Your operating system may ask you to confirm that you want to open the application.

Bitcoin Core welcome screen showing the default data directory and a blockchain storage limit
Choose the default data directory and limit blockchain storage.

You can use the default data directory and limit blockchain storage. You can also ignore the warning about synchronization load because Testnet4 has a much smaller blockchain than the main Bitcoin network.

1.3 Configure Testnet4 mode

Click Preferences → Open Configuration File, then copy and paste the following:

# Connect to Testnet4
testnet4=1

# Do not accept incoming connections
listen=0

# Allow the Bitcoin Core GUI and daemon to accept JSON-RPC commands
server=1

Save the file and restart Bitcoin Core for the new configuration to take effect.

Step 2: Create a wallet and legacy address

2.1 Create a wallet

Click Create a Wallet and give it a name.

Bitcoin Core dialog for creating a new wallet
Create a wallet for this course.

2.2 Create a legacy address

Create a legacy address for this hands-on component:

Bitcoin Core receive tab configured to create a legacy address
Create a Base58 legacy receiving address.

For example, I created the address myofnF2NWgLAwZ6rDhx66LhA7eJkqs3FHZ. Click an address to open a window with more details. In Step 3, you will use the Bitcoin Core console to inspect your address in greater depth.

Bitcoin Core window showing the details of a receiving address
Bitcoin Core shows the details of a created address.

Record this address. You will use it for take-home Lab 1.

2.3 Request test bitcoin

Visit the Testnet4 faucet. Paste the legacy receiving address you just recorded, complete the CAPTCHA, and submit the request.

Test coin faucet form
Request test coins from a faucet.

Your Bitcoin Core node is likely still synchronizing. The payment may not appear in your wallet until your node reaches the block that confirms it. Continue to Step 3 while you wait.

Step 3: Inspect the address and its script

The Bitcoin Core console is a powerful interface for interacting directly with your node. Open it by selecting Window → Console.

Bitcoin Core Console
Open the Bitcoin Core console to inspect your address.

Run each command in the Bitcoin Core console. Replace placeholders in capital letters with the value returned by an earlier command.

3.1 Look up the legacy address

getaddressinfo "ADDRESS"

Bitcoin Core returns a JSON object with information about the address. Find scriptPubKey: the locking script that a transaction output uses to pay this address, encoded in hexadecimal.

Record its scriptPubKey. You will decode it next.

3.2 Decode its locking script

decodescript "SCRIPTPUBKEY"

Record the asm, type, and public-key hash in the decoded script.

Step 4: Send and inspect a Testnet4 transaction

4.1 Send test bitcoin

After your node finishes synchronizing and the faucet payment appears in your wallet, use the Send tab to send 0.0001 tBTC to the course address:

myofnF2NWgLAwZ6rDhx66LhA7eJkqs3FHZ

If a recommended fee is not available, select Custom and use 0.00001 BTC/kB.

Bitcoin Core transaction fee settings with a custom fee selected
Choose a transaction fee before sending.

Record the transaction ID (txid) after sending.

4.2 Decode the transaction you sent

Use the Bitcoin Core console to retrieve the transaction from your wallet:

gettransaction "TXID"

Copy the hex field from the result, then decode the raw transaction:

decoderawtransaction "HEX"

Examine vin[0] and record its public key (pk). Find the public key in scriptSig.asm: it is the second value pushed onto the stack, after the signature.

Paste that public key into the calculator below:

HASH160 calculator

Compare the calculator’s result with the public-key hash you recorded in Step 3.2. They should be identical: OP_EQUALVERIFY checks this match, then OP_CHECKSIG checks the signature. This is why the input satisfies the locking script.

End of assignment.


Payments received

by `myofnF2NWgLAwZ6rDhx66LhA7eJkqs3FHZ` since 09-14-26.

Loading payments…