I'm trying to make a simple program that can reliably upload an OP_RETURN transaction. I have found some examples online, but so far they don't work consistently. The ones that go through seem to be random. Here are the transactions that went through
https://blockchain.info/address/1Eoo7G7u97EMwptSxjYjpvdx9zYcqJBn9y
It is very hit or miss every time I try. I have been entirely unable to upload any transactions using the script, however once in a while if I upload the raw transaction using blockchain they go through. Any ideas? Here is the error message.
Traceback (most recent call last):
File "/Users/JC/Documents/DevelopmentStuff/programming /Python/bit/op-return_test2.py", line 51, in <module>
print(pushtx(tx))
File "/Library/Python/2.7/site-packages/bitcoin/bci.py", line 237, in pushtx
return f(*args)
File "/Library/Python/2.7/site-packages/bitcoin/bci.py", line 192, in bci_pushtx
return make_request('https://blockchain.info/pushtx', 'tx='+tx)
File "/Library/Python/2.7/site-packages/bitcoin/bci.py", line 23, in make_request
raise Exception(p)
Exception: None Standard Script Output OP_RETURN 48656c6c6f
Here is the code. I would really appreciate any help. Thanks
# coding: utf-8
from bitcoin import *
import binascii
from test import *
priv = "Private key"
pub = "1Eoo7G7u97EMwptSxjYjpvdx9zYcqJBn9y"
addr= "1Eoo7G7u97EMwptSxjYjpvdx9zYcqJBn9y"
inputs = unspent(addr)
message = "Hello"
FullLen = format(len(message)+2,'x').rjust(2,'0')
MessageLen = format(len(message),'x').rjust(2,'0')
ID = binascii.hexlify(str(message))
#snd = "6a4c28"+ID
snd = "6a"+MessageLen+ID
print hexlify(chr(len(message)))
print MessageLen
print snd
#snd = "6a4c"+MessageLen+ID
#print snd
newScriptPubKey = "6a" + hexlify(chr(len(message)))+ hexlify(message)
#print newScriptPubKey
outputs = [{'value': 50000, 'address': addr}, {'value': 0, 'script': snd}]
fee = 10000
tx = mksend(inputs, outputs, addr, fee)
dt = deserialize(tx)
ins = dt['ins']
#print addr
#print ins
print tx
for ind, elm in enumerate(ins):
print elm
tx = sign(tx, ind, priv)
print tx
print(pushtx(tx)) # Error is raised on this line