Bitcoin Ordinals: Testnet & Regtest Guide
🔶 Overview
This readme contains CLI commands to interact with the bitcoind and ord libraries to create inscriptions on both testnet and regtest. Scripts are included to demonstrate interacting with the bitcoin-cli interface via JavaScript.
Repository: https://github.com/ecorey/Ordinals-Overview-Testnet-Regtest
⚠️ Important Note
TO RUN ORD WALLET CLOSE THE ORD SERVER - It needs to self index.
START TESTNET
Start bitcoind in testnet mode
Using the D drive to store the blockchain:
.\bitcoind -testnet -datadir="D:\BitcoinData" -txindex
Check testnet sync status
Compare block number to bitcoin testnet:
.\bitcoin-cli --testnet --datadir="D:\BitcoinData" getblockchaininfo
Check block count
.\bitcoin-cli --testnet --datadir="D:\BitcoinData" getblockcount
You can check block against ordinals.com testnet
Testnet Wallet Operations
List wallets
.\bitcoin-cli --testnet --datadir="D:\BitcoinData" listwallets
Create taproot wallet
.\bitcoin-cli --testnet --datadir="D:\BitcoinData" createwallet "ord" false false "" false true
Get wallet receive address
.\bitcoin-cli --testnet --datadir="D:\BitcoinData" -rpcwallet="taproot_wallet1" getnewaddress "" "bech32m"
Example output: tb1pk0vfpp7jf6cv0j926gqr2d39uy292y9l5yc904p7vcq5jthktjrscz24vf
List descriptors
.\bitcoin-cli --testnet --datadir="D:\BitcoinData" listdescriptors
Start ord server with testnet
ord --testnet --bitcoin-data-dir="D:\BitcoinData" --cookie-file="D:\BitcoinData\testnet3.cookie" server --http-port 8080 --address 127.0.0.1
Create ord wallet
ord --testnet --bitcoin-data-dir="D:\BitcoinData" --cookie-file="D:\BitcoinData\testnet3.cookie" wallet create
Create ord wallet receive address
ord --testnet --bitcoin-data-dir="D:\BitcoinData" --cookie-file="D:\BitcoinData\testnet3.cookie" wallet receive
Load/Unload wallet operations
# Load wallet named "ord" .\bitcoin-cli -testnet -datadir="D:\BitcoinData" loadwallet "ord" # Unload wallet named "ord" .\bitcoin-cli -testnet -datadir="D:\BitcoinData" unloadwallet "ord"
Get addresses and balances
# Get addresses .\bitcoin-cli -testnet -datadir="D:\BitcoinData" listaddressgroupings # Get balance by address .\bitcoin-cli -testnet -datadir="D:\BitcoinData" getreceivedbyaddress "tb1pk0vfpp7jf6cv0j926gqr2d39uy292y9l5yc904p7vcq5jthktjrscz24vf" # Get ord wallet balance ord --testnet --bitcoin-data-dir="D:\BitcoinData" --cookie-file="D:\BitcoinData\testnet3.cookie" wallet balance
Testnet Inscriptions
Inscribe text from .txt file
ord --testnet --bitcoin-data-dir="D:\BitcoinData" --cookie-file="D:\BitcoinData\testnet3\.cookie" wallet inscribe --fee-rate 10 --file "C:\Users\[USERNAME]\Documents\ord\text_file.txt"
Inscribe an image
ord --testnet --bitcoin-data-dir="D:\BitcoinData" --cookie-file="D:\BitcoinData\testnet3\.cookie" wallet inscribe --fee-rate 10 --file "C:\Users\[USERNAME]\Documents\ord\image.png"
Get testnet bitcoin
Use a swap service to obtain testnet bitcoin
Open testnet GUI
Need to close bitcoind first as it has a lock:
./bitcoin-qt -testnet -datadir="D:\BitcoinData" -wallet=ord
Stop testnet
.\bitcoin-cli --testnet --datadir="D:\BitcoinData" stop
RUNES (Testnet)
Need to reindex runes by first deleting the original .redb file and running the index run or index update command
Index runes
ord --index-runes --testnet --bitcoin-data-dir="D:\\BitcoinData" --cookie-file="D:\\BitcoinData\\testnet3\\.cookie" index update
Index info
ord --index-runes --testnet --bitcoin-data-dir="D:\\BitcoinData" --cookie-file="D:\\BitcoinData\\testnet3\\.cookie" index info
Etch a rune
ord --index-runes --testnet --bitcoin-data-dir="D:\\BitcoinData" --cookie-file="D:\\BitcoinData\\testnet3\\.cookie" wallet etch --divisibility 0 --fee-rate 1 --rune AAAAAAAAAAAAAAAAA --supply 100 --symbol z
Get runes
ord --testnet --bitcoin-data-dir="D:\\BitcoinData" --cookie-file="D:\\BitcoinData\\testnet3\\.cookie" --index-runes runes
REGTEST
Start regtest
.\bitcoind -regtest -datadir="D:\BitcoinRegtest" -txindex -listen=0
Get regtest info
.\bitcoin-cli --regtest -datadir="D:\BitcoinRegtest" getblockchaininfo
Regtest Operations
Create ord wallet on regtest
ord --regtest --bitcoin-data-dir="D:\BitcoinRegtest" --cookie-file="D:\BitcoinRegtest\regtest.cookie" wallet create
Receive ord wallet on regtest
ord --regtest --bitcoin-data-dir="D:\BitcoinRegtest" --cookie-file="D:\BitcoinRegtest\regtest.cookie" wallet receive
Example output: bcrt1pj5c2dlkspvkcj2nq7amv0r2sqxw4vtjtrxhlf3c6mqkyaa7452vsa9xjn2
Generate to address
Needs to be more than 101 for first rewards:
.\bitcoin-cli -regtest -datadir="D:\BitcoinRegtest" generatetoaddress 101 'bcrt1pj5c2dlkspvkcj2nq7amv0r2sqxw4vtjtrxhlf3c6mqkyaa7452vsa9xjn2'
Get balance operations
# Get balance of address .\bitcoin-cli -regtest -datadir="D:\BitcoinRegtest" getbalance # Index ord ord --regtest --bitcoin-data-dir="D:\BitcoinRegtest" --cookie-file="D\BitcoinRegtest\regtest.cookie" index update # Get ord balance ord --regtest --bitcoin-data-dir="D:\BitcoinRegtest" --cookie-file="D\BitcoinRegtest\regtest.cookie" wallet balance
Regtest inscriptions
# Inscribe text from .txt file ord --regtest --bitcoin-data-dir="D:\BitcoinRegtest" --cookie-file="D\BitcoinRegtest\regtest.cookie" wallet inscribe --fee-rate 10 --file "C:\Users\[USERNAME]\Documents\ord\text_file.txt" # Inscribe an image file ord --regtest --bitcoin-data-dir="D\BitcoinRegtest" --cookie-file="D\BitcoinRegtest\regtest.cookie" wallet inscribe --fee-rate 10 --file "C:\Users\[USERNAME]\Documents\ord\image.jpg"
Start ord server with regtest
ord --regtest --bitcoin-data-dir="D:\BitcoinRegtest" --cookie-file="D\BitcoinRegtest\regtest.cookie" server --http-port 8080 --address 127.0.0.1
Stop regtest
.\bitcoin-cli -regtest -datadir="D\BitcoinRegtest" stop
Example Inscription Formats
Example Inscription for Text
File: inscribed.txt
OP_FALSE OP_IF OP_PUSH "ord" OP_PUSH 1 OP_PUSH "text/plain;charset=utf-8" OP_PUSH 0 OP_PUSH "some text to inscribe" OP_ENDIF
Fee Estimation
Fee Calculation Formula
To estimate fees: divide the content size by four and multiply by the fee rate
Troubleshooting
Sync Issues
If ord and bitcoind are not in sync:
- 1. Navigate to:
C:\\Users\\[USERNAME]\\AppData\\Roaming\\ord
- 2. Delete the regtest folder
- 3. Run:
ord -r index run
Additional Resources
- • Check block count against ordinals.com testnet for verification
- • Use JavaScript scripts included in the repo for programmatic interactions
- • Ensure proper wallet management when switching between testnet and regtest
- • Remember to close ord server before running wallet operations