0

I simply want to store one small string in the blockchain. That's it. I am reading here a step by step guide but there is little in terms of explanation beyond the code snippets. What I would like to know is if essentially the problem is this...

There are two parties: me and someone else. I need to somehow get that "someone else's" address, and can figure out the rest from there.

But the main problem is, I don't have any "someone else" I would like to send the money to (or even need to send money to). I simply want to place something in the blockchain.

How are people doing this in their tutorials? Who are they sending the money to? Are they just creating a "dummy transaction" against a "dummy address" of some sort, and then getting a refund of the money? That way it seems the data would still be in the blockchain, but then no money would be spent (other than a potential processing tax fee).

If so, how do I do that? Am I supposed to setup two bitcoin networks, and send data from one to the other? That is, create a transaction of sending money from one to the other? Or perhaps even easier (though not possible?), I can get two addresses from my bitcoin node, and then send money from one of those addresses to another. Is that possible?

  • Why do you want to store data on the blockchain? It is not designed for that. OP_RETURN is for attaching data to transactions. If you have no transaction to make, what do you need to store along with it? Many of your misunderstandings seem to based on the fact that you're trying to do something the system wasn't designed for. – Pieter Wuille Oct 28 at 15:38
1

Nothing prevents you to send bitcoins to one of your own addresses. I guess I'd just create a new address on my node with bitcoin-cli getnewaddress, and then create a transaction with 2 outputs :

  • one to the address I just got with my whole input amount (minus mining fees)
  • another to a "dummy" address (can be one you generated with the same method, you can't spend it anyway!) with OP_RETURN + [your_data], and of course 0 as amount

As for the exact way to do this, the post you linked too seems like it could work, but I never tested it myself. The idea is to create the transaction first with the createrawtransaction method from bitcoin-cli, and then modify a piece of the data with yours.

As I said I never did that, I highly suggest you try it out on testnet first, there are many things that could just go wrong.

  • Why the need for the dummy address? – Lance Pollard Oct 28 at 11:08
  • If you use the createrawtransaction method, you need to give it an address to add an ouput. But actually you're right, there's no address in a OP_RETURN output, it's precisely what you will remove when you will put your own data in. See this transaction for example, the 2 OP_RETURN output indeed don't have any addresses associated – Sosthène Oct 28 at 11:13
0

You send the change (any amount left over from your input after the fee) to any address you own. You can send it to the same address that is initiating the transaction, or to any other address in your wallet.

  • Do I need a second dummy address, as other examples sometimes show? – Lance Pollard Oct 28 at 11:10
  • The example only calls it that so that you know to replace it with an address you own. Any address from your wallet will work. – Raghav Sood Oct 28 at 11:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.