Answer the question
In order to leave comments, you need to log in
How to create and sign a transaction?
I need to send crypto to an address. There is an address, there is all the data from the sender's account and there is network data
Answer the question
In order to leave comments, you need to log in
If still relevant, it seems you can import
from pycoin.networks.bitcoinish import create_bitcoinish_network
network = create_bitcoinish_network(symbol = '', network_name = '', subnet_name = '',
wif_prefix_hex="", address_prefix_hex="", pay_to_script_prefix_hex="",
bip32_prv_prefix_hex="", bip32_pub_prefix_hex="", bech32_hrp="",
bip49_prv_prefix_hex="", bip49_pub_prefix_hex="",
bip84_prv_prefix_hex="", bip84_pub_prefix_hex="",
magic_header_hex="", default_port=)
If, as I understand it, you can use this code ( Source )
pip install bit.
from bit import PrivateKey
# Приватный ключ из wif
my_key = PrivateKey(wif='L46ixenNSu8Bqk899ZrH8Y96t8DHqJ1ZyxzQBGFTbh38rLHLaPoY')
# Количество долларов перевода, можно поменять на btc
money=0.1
# Кошелек куда будут переведены деньги
wallet='17ya3bCpPioyPH8kAyFkEDBUqdjF6wwPxo'
# Коммисия перевода, если поставить слишком маленькую, то транзакцию не примут
# И чем больше коммисия, тем быстрее пройдет перевод
fee=2000
# Генерация транзакции
tx_hash = my_key.create_transaction([(wallet, money, 'usd')],fee=fee,absolute_fee=True)
print(tx_hash)
# Потом делаём это
import requests
url = 'https://blockchain.info/pushtx'
tx='0100000001fe64490fce5e85d5eb00865663a3d44f4108549fdb2840b086cfc781390d4a2d010000006a47304402202dc1496d28bb10d50d94d70870e2a79ea472c5960de8f7418bb30f9b96643efc02204691547c98edad3181a056bf6404601efe289200ba8e3073a2f5b7c0c7f4fec10121026516c551584b484ce3ca7bb71bbf24cce133bf40bdf4e2ce5a3936bc7e66a2abffffffff02e3020000000000001976a9144c83a20250ccb62ce2b3b1ea80c6082b634fdf9f88ac08f40200000000001976a9144c83a20250ccb62ce2b3b1ea80c6082b634fdf9f88ac00000000'
x = requests.post(url, data = {'tx':tx})
result = x.text
print(result)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question