Add option to finalize and post transactions separately (for air-gap wallets) #255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR add?
This PR adds the ability to finalize a transaction without posting the transaction to the chain, and separately post a finalized slate to the chain.
Why is this useful?
For air-gapped wallets: Currently there is no easy way to send transactions from an offline/air-gapped wallet. To finalize a transaction, the wallet requires a connection to a running node. With this feature, it is now possible to generate a finalized slate on an offline machine (without posting to chain), copy that slate file to another machine (with a connected Grin node), and post the transaction on that machine.
For sender privacy: Currently, the sender must reveal his IP to the network (or at least to one connected node) during transaction finalization. With this feature, a transaction sender no longer needs to reveal his/her IP to the network. The sender may simply generate a finalized transaction slate, and give that slate to the recipient, allowing the recipient to reveal his/her IP instead.
Testing
I have functionally tested this change on Mainnet. I tested the new segregated finalize/post transaction method, as well as the original combined finalize+post method. Both transaction methods work as expected.
I am unclear about the test process for this project. I am happy to write formal test cases, if someone can give me a bit of guidance on where/how those tests should be added.