1

I want to create a raw transaction with python and i found the script Makes a transaction from the inputsoutputs is a list of [redemptionSatoshis, outputScript]

def makeRawTransaction(outputTransactionHash, sourceIndex, scriptSig, outputs):

def makeOutput(data):redemptionSatoshis, outputScript = datareturn (struct.pack("<Q", redemptionSatoshis).encode('hex') +'%02x' % len(outputScript.decode('hex')) + outputScript)

formattedOutputs = ''.join(map(makeOutput, outputs)) 
return ( "01000000" +  "01" + outputTransactionHash.decode('hex')[::-1].encode('hex') + 
outputTransactionHash struct.pack('<L', sourceIndex).encode('hex') + '%02x' % 
len(scriptSig.decode('hex')) + scriptSig + "ffffffff" + "%02x" % len(outputs) +formattedOutputs + "00000000")
Tailer
  • 3,669
  • 1
  • 14
  • 36
  • 1
    welcome to bitcoin.SE! Your post is a bit unformatted, as such it is not really clear, what you are asking. Anyhow, the way to create a tx is well described by amaclin's answer here: https://bitcoin.stackexchange.com/questions/32628/redeeming-a-raw-transaction-step-by-step-example-required?rq=1 - hope this helps. – pebwindkraft Feb 25 '18 at 19:52
  • @pebwindkraft hope it's clear now! – Tailer Feb 26 '18 at 02:58
  • Yup, one day I will learn as well, how to edit/correct the layout :-) – pebwindkraft Feb 26 '18 at 20:45
  • Even with the edits, I don't understand what the question is. – Mine Mar 02 '18 at 17:13

0 Answers0