Last active
February 16, 2024 12:15
-
-
Save Daymannovaes/494b6d87d2fe511cda191eb675902f1f to your computer and use it in GitHub Desktop.
A fake bitcoin transaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"hash": "b657e22827039461a9493ede7bdf55b01579254c1630b0bfc9185ec564fc05ab", | |
"block_height": 477230, | |
"inputs": [ | |
{ | |
"n": 0, | |
"address": "1GLctvTi81GDYZF5F6nif2MdbxUnAGHATZ", | |
"value": 2000, | |
"signature": "473044022036be6403aeb4e0e6fd54720b328d9da1bea32fb79684da0288a43668fb5ef3ee02202023a71ef7217061fb9b4f35a05143de71447032e5a35b39c3d14b3210bad10b0121032725846bb7bc2e47b7b5a50670d77c8268f4d7f3243bdcf1b22174a67faaf528" | |
}, | |
{ | |
"n": 1, | |
"address": "328d9d81bea32fb79684da0288743668fb", | |
"value": 3000, | |
"signature": "288743668fb5ef3ee022473044022036be6493ede7bdf55b01579254c1630b0bfc91859684da0288743668fb5ef3ee02202023a71ef7217061fb9b4f35a05143de71447032e5a35b39c3d14b3210bad10b0121032725846bb7bc2e47b7b5a50670d77c8268f4d7f3243b" | |
} | |
], | |
"outputs": [ | |
{ | |
"n": 0, | |
"address": "1AG24pctoCpEMfSvEKfUZqaGYnz8ey8BfF", | |
"value": 2000, | |
"script": "76a914659042e01e864e2f29641ea3a213c51a956d33c788ac" | |
}, | |
{ | |
"n": 1, | |
"address": "18Gj3unkApi17yh24JF6WwhN635SfABFMj", | |
"value": 1000, | |
"script": "76a9144fc238bcda3f884ff6ce8d9feeb89b50dfd3da8888ac" | |
} | |
] | |
} |
yes
from bitcoinlib.wallets import Wallet
def create_bitcoin_transaction(private_key, inputs, outputs):
wallet = Wallet(private_key=private_key)
transaction = wallet.send_to(outputs, fee=0.0001, absolute_fee=True, combine=True, message=None, sign=True)
return transaction
Example usage
private_key = "your_private_key_goes_here"
inputs = [
{
"address": "input_address_1",
"value": 2000
},
{
"address": "input_address_2",
"value": 3000
}
]
outputs = [
{
"address": "output_address_1",
"value": 2000
},
{
"address": "output_address_2",
"value": 1000
}
]
real_transaction = create_bitcoin_transaction(private_key, inputs, outputs)
print(real_transaction)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
contact me on kkobtk@gmail.com I got what you need.