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")
  • 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: bitcoin.stackexchange.com/questions/32628/… - hope this helps. – pebwindkraft Feb 25 '18 at 19:52
  • @pebwindkraft hope it's clear now! – Adam Feb 26 '18 at 2: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 2 '18 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.