Reputation: 39
I want to be able to send the minimum amount of Bitcoin required in order to write a 40 byte (roughly 80 character) message via ideally a REST API allowing me to specify a bitcoin wallet private key, the recipient bitcoin address, the fee and the message to attach to the OP_RETURN.
Thank you!
--
I wish Bitcoin allowed you to send coins without having to have an API or daemon - through http somehow would be cool. How would I create a raw transaction with a OP_RETURN in it to push to an API /tx/push using php and curl?
Upvotes: 2
Views: 2286
Reputation: 1
You can use http://www.stamping.io you can anchored a transaction in Bitcoin & Ethereum in the same time. Try it!
Upvotes: -1
Reputation: 3297
There are more options as the OP_RETURN protocol is so simple but here are the ones I recommend:
1. Blockcypher
Blockcypher API has a Data endpoint to write op return transaction but you need to register an API token with them so it's not completely under your control (they can ban your token), it supports only 40 bytes not 80 (well 75 in reality) but it's free, which is awesome!
Check it out (mainchain):
https://www.blockcypher.com/dev/bitcoin/#data-endpoint
Example from their doc (curl):
# Embedding String Data
curl -d '{"data":"I am the walrus", "encoding":"string"}' https://api.blockcypher.com/v1/btc/main/txs/data?token=YOURTOKEN
{
"data": "I am the walrus",
"encoding": "string",
"token": "YOURTOKEN",
"hash": "cb6974e0fd57c91b70403e85ef48c840eecdca4804dfc4897b1321d5328e4f18"
}
2. BlockchainPen
If you're searching for an APP (maybe to test quickly) or to get some open source code and modify it to your needs there's BlockchainPen:
This is not an API service but more a webapp. It has a client-side browser wallet where you can load some funds (1mbtc?) and write op-return messages.
Click on the address to get a QR for loading funds quickly from a mobile wallet - The UI is very basic, you need to refresh the page to see the updated balance - The funds are yours, you can export your private key at any time (check the link at the bottom of the page).
The code is open source so you could import and use the Pen class (coffeescript or js version) in your programs to write transaction via nodejs: https://github.com/makevoid/blockchain-pen/blob/master/pen.coffee
Or with something like phantomJS, selenium/webdriver or some other browser automation tool you could use the deployed version but I think it will not be clean.
There are two currently open source implementation of blockchain-pen:
1: https://github.com/makevoid/blockchain-pen (latest)
2: https://github.com/makevoid/blockchain_pen (old repo - js / ruby opal)
You can also change the fee depending on your needs, the default one is 0.1mbtc, on http://prio.blockchainpen.com (priority) is 0.3mbtc.
(p.s. disclamer: I'm the developer behind this, feel free to fork/improve the project, a new and simpler version will be released in 2017)
Upvotes: 1