Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Memo to be added to transaction #58

Open
stuartwk opened this issue Dec 19, 2020 · 4 comments
Open

Allow Memo to be added to transaction #58

stuartwk opened this issue Dec 19, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@stuartwk
Copy link

Is your feature request related to a problem? Please describe.
Memos can be attached to Bitcoin transactions, but at the moment Rosetta Bitcoin doesn't have code to handle OP_RETURN.

Describe the solution you'd like
Allow a memo to be added to a Bitcoin transaction as an additional output operation.
A very simple idea would be to add a Memo field to Operation.Metadata. Then in the construction_service payloads function, do a check if the output is a memo and use txscript.NullDataScript([]byte(metadata.Memo)) instead of txscript.PayToAddrScript(addr).

Would gladly give this a shot at doing a PR. If you think it should go in a different direction, please share, any guidance more than welcome.

@stuartwk stuartwk added the enhancement New feature or request label Dec 19, 2020
@patrick-ogrady
Copy link
Contributor

I think the biggest consideration is whether we should add a different Operation.Type for OP_RETURN (instead of just using OUTPUT) now that it could be used during construction. Right now, we just treat OP_RETURN as OUTPUT with no amount (we also don't parse memo out of operations returned in /block...might be nice to scope with this work).

How do you feel about a new type instead of OUTPUT? I'm still thinking about which abstraction I prefer...Right now, I'm leaning towards your strategy because I don't like the inconsistency of calling all output types other than OP_RETURN OUTPUT.

@stuartwk
Copy link
Author

Creating a new OP_RETURN operation type sounds good to me.

@patrick-ogrady
Copy link
Contributor

Sorry for the delay here (holiday break). This ticket is in our internal system and we will try to respond soon!

@stuartwk
Copy link
Author

stuartwk commented Jan 7, 2021

Great. There were a couple things we were considering.

The simplest way we can see to implement it is to handle OP_RETURN operations as OUTPUT in the construction service, and let the user parse the OP_RETURN from block and block/transaction or do a separate PR for it.

If we create an OP_RETURN operation type, would the intention be that the new type and decoded memos are saved to the DB, requiring everyone to resync?

Or would all of this be handled on the fly? For example, no changes to the DB, on block and block/transaction requests, it checks for an OP_RETURN, updates the return type from OUTPUT -> OP_RETURN, and decodes the memo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants