Bitcoin Forum
May 14, 2024, 07:25:48 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: Making transaction in python using pybitcointool / pycryptotool on: July 25, 2020, 10:54:14 PM
Thank you for your answer Smiley

So when I create a transaction, i need to sign x times for the x UTXOs in the inputs and increment the index. Am I right?
2  Bitcoin / Development & Technical Discussion / Making transaction in python using pybitcointool / pycryptotool on: July 24, 2020, 01:35:12 PM
Hello,

I'm currently trying to understand how to make and sign bitcoin transaction in python using pycryptotool library (https://github.com/primal100/pybitcointools). There's an example explaining how to use this library but I don't quite understand the signing part :

Quote
Code:
> tx = c.mktx(inputs,outs)
> tx
{'locktime': 0, 'version': 1, 'ins': [{'outpoint': {'hash': '3be10a0aaff108766371fd4f4efeabc5b848c61d4aac60db6001464879f07508', 'index': 0}, 'amount': 180000000, 'script': '483045022100fccd16f6....']}
> tx2 = c.sign(tx,0,priv)
> tx2
{'locktime': 0, 'version': 1, 'ins': [{'outpoint': {'hash': '3be10a0aaff108766371fd4f4efeabc5b848c61d4aac60db6001464879f07508', 'index': 0}, 'amount': 180000000, 'script': '483045022100fccd16f619c5f8b8198f5a00f557f6542afaae10b2992733963c5b9c4042544c022041521e7ab2f4b58856e8554c651664af92f6abd58328c41bc652aea460a9a6a30141041f.....']}
> tx3 = c.sign(tx2,1,priv)
> tx3
{'locktime': 0, 'version': 1, 'ins': [{'outpoint': {'hash': '3be10a0aaff108766371fd4f4efeabc5b848c61d4aac60db6001464879f07508', 'index': 0}, 'amount': 180000000, 'script': '483045022100fccd16f619c5f8b8198f5a00f557f6542a...]}
> tx4 = c.serialize(tx)
> tx4
'01000000020875f07948460160db60ac4a1dc648b8c5abfe4e4ffd71637608f1af0a0ae13b000000008b483045022100fccd16f619c5f8b8198f5a00f557f6542afaae10b2992733963c5b9c4042544c022041521e7ab2f4b58856e8554c651664af92f6abd58328c41bc652aea460a9a6a30141041f763d81010db8ba3026fef4ac3dc1ad7ccc....'
> c.pushtx(tx4)

Why is the transaction signed 2 times ? And why is tx serialized and pushed instead of tx2 and tx3 which are signed ?

Thank you in advance for your time and your help,
your fellow beginner,

NathNath
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!