I am using golang’s btcd as a basis for creating some server-side tools for handling transactions. I found a good example for creating a basic one-input-one-output transaction to get me started on the implementation, and I have also read the documentation heavily on the technical specifics here. I have also looked at the other btcsuite libraries pretty heavily to try to gain more insight. To be clear, I am NOT expecting any of these tools to issue the transaction or anything like that; I understand that this was written out of btcd in particular for very, very good reasons. I am just trying to use these tools to create valid transactions that I can issue later.
I am still incredibly confused on the particulars in implementing multiple input, multiple output transactions and the scripts that we use on them. A few topics:
- I’m familiar with the script tools in btcd, the link goes to the most common one used, but all of these scripts are used for one specific output. There seems to be absolutely no documentation anywhere about how to provide scripting for multiple outputs. If I’m doing a normal P2PK or P2PKH transaction, do I simply concatenate the scripts for all the various outputs, or what?
In the create Transaction example in the HelloBitcoin example I’ve linked above, the overall magic happens near the end with:
buffer.Write(version) buffer.Write(inputs) buffer.Write(inputTransactionBytesReversed) buffer.Write(outputIndexBytes) buffer.WriteByte(byte(scriptSigLength)) buffer.Write(scriptSig) buffer.Write(sequence) buffer.Write(numOutputs) buffer.Write(satoshiBytes) buffer.WriteByte(byte(scriptPubKeyLength)) buffer.Write(scriptPubKey) buffer.Write(lockTimeField)
And I feel like there are a lot of unanswered questions on how to expand this to handle multiple inputs and multiple outputs. For the inputs, is it as simple as taking all the input transactions into little-endian, noting the correct number in
inputs, and going from there? For outputs, do you just have an individual block of to
scriptPubKey? I can’t find in the documentation how this is supposed to all glue together, and at this point I feel like I need some help with the nuts and bolts of this. Thanks in advance for any help – if we can get these two points answered I might end up making more questions from the stuff that will inevitably result from this.
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!