Cryptocurrencies Course
Python
Simple Implementation of Bitcoin Transactions

University of Tehran

We used the python-bitcoinlib library to perform transactions on the Bitcoin test network. This library has various functions for creating different types of transactions. To do this part of the project, first, we get familiar with how the Bitcoin script works. We created a transaction with one input and one output of type P2PKH. Using the codes of the Bitcoin Address Generator project, we created an address for the Bitcoin experimental network, and after receiving money from the Faucets, we entered the following transactions:

  • We created a transaction with one input and two outputs that the first output can not be spent by anyone and the second output can be spent by anyone. In another transaction, we spent the expendable output of this transaction and returned it to our original address as P2PKH output.

  • we created a transaction that has an input and an output that is P2MS or Multisig and can be expendable by 2 of these 3 addresses. In another transaction, we spent this output and return the money to our original address.

  • We created a transaction with one input and one output that output is our address in P2SH format. We returned ourself as P2PKH output.

Programming Language: Python

Course: Cryptocurrencies Course



Result:

Image
Saeed Jafari

© Creative CV. All rights reserved.