1
I'm creating a program (for an altcoin I'm developing) that should make it easy to create OP_RETURN transactions. Currently I'm having some trouble with actually creating the script pythonically (I can do it by hand but no idea how to program it).
As an example, the program takes an OP_RETURN script (eg. 6a4c0a0102030405060708090a) and creates a transaction with that script, by itself. However, currently you need to input the actual hex script instead of the string you want to send to the blockchain.
My question is - what's the best way to take a string/int and convert it into a transaction-friendly hex-encoded script? For example:
String: OP_RETURN 12345678910
Output: 6a4c0a0102030405060708090a
Thanks a bunch to anyone who helps. I'll you all some bitcoin if you manage to find a good solution.
This is more of a programming question than a bitcoin-specific question – MeshCollider – 2017-10-07T07:53:16.997
All the bitcoin-related information you need is in the spec: https://en.bitcoin.it/wiki/Script Other than that, you will need to learn about converting values to binary/hex in python, which is more of a general programming question based asked on the main Stack Overflow site.
– Jestin – 2017-10-10T14:42:27.847