[Feature] Enable building valid transactions without submitting them to the network #808
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.
Motivation
This PR adds the ability to build valid execution transactions without immediately submitting them to the network. This allows transactions to be built beforehand and then later submitted to the network.
The following methods have been introduced to build transactions offline. Each will return a
Transaction
object which is awasm
object representing an Aleo transaction. Users can use thetoString()
method on this object to get a human readable string representation of the Transaction.buildExecutionTransaction
- Build an execution transaction for an arbitrary executionbuildTransferTransaction
- Build an transfer transaction for any of the 4 transaction typesbuildTransferPublicTransaction
- Build a transfer public transactionbuildBondPublicTransaction
- Build a bond public transaction to bond as a delegator or validator to the networkbuildUnbondPublicTransaction
- Build an unbond public transactionbuildClaimUnbondPublicTransaction
- Build a transaction to claim unbonded stakeIf the fee for a transaction is paid publicly (with the
fee_public
method) and the function being executed doesn't take any records as input, the transaction can be built completely offline without connection to the internet.