- Janapareddy Vidya Varshini - 230041013
- Korubilli Vaishnavi - 230041016
- Mullapudi Namaswi - 230041023
This project demonstrates the creation and validation of Bitcoin transactions using:
- Legacy (P2PKH) Transactions
- SegWit (P2SH-P2WPKH) Transactions
We use Bitcoin Core (bitcoind) in regtest mode and Python scripts to interact with it via RPC calls. The project includes:
- Setting up a Bitcoin regtest network.
- Creating wallets and generating addresses.
- Funding transactions and analyzing scripts.
- Comparing transaction sizes between Legacy and SegWit formats.
Ensure you have the following installed:
- Bitcoin Core (bitcoind & bitcoin-cli): Download Bitcoin Core
- Python3 (if not installed, install via
sudo apt install python3orbrew install python3) - Required Python Libraries
pip install python-bitcoinrpc
- Locate the
bitcoin.conffile (usually found in~/.bitcoin/bitcoin.confon Linux/macOS orC:\Users\YourUser\AppData\Roaming\Bitcoin\bitcoin.confon Windows). - Add the following configuration for regtest mode:
regtest=1 server=1 rpcuser=your_rpc_user rpcpassword=your_rpc_password rpcport=18443 txindex=1
- Start bitcoind in regtest mode:
bitcoind -regtest -daemon
bitcoind -regtest -daemonpython legacy_transactions.pyThis will:
- Create a wallet
- Generate addresses A, B, C
- Fund address A
- Create a transaction from A → B
- Create a transaction from B → C
- Decode and analyze transactions
python segwit_transactions.pyThis follows the same process as above but using P2SH-SegWit addresses.
- Check decoded transactions in the output.
- Use Bitcoin Debugger to verify script execution.
Upon running the scripts, you should see:
- Wallet and Address Creation
- Transaction IDs for A → B and B → C
- Decoded Scripts (locking & unlocking mechanisms)
- Transaction size comparison between Legacy and SegWit