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

[AIP-102][Discussion] Dynamic Transaction Composer #520

Open
thepomeranian opened this issue Oct 9, 2024 · 0 comments
Open

[AIP-102][Discussion] Dynamic Transaction Composer #520

thepomeranian opened this issue Oct 9, 2024 · 0 comments

Comments

@thepomeranian
Copy link
Collaborator

AIP Discussion

Summary
Develop a new set of APIs in our SDKs to allow application builders to easily chain multiple Move operations in a single transaction.

Out of Scope
In this AIP, we will focus solely on the transaction-building aspect. While this solution aims to enhance the composability of our ecosystem as part of the Aptos Intent standard, those standards will be proposed in future AIPs. This AIP will serve as a reference for those later efforts.

High-level Overview
Currently, there are two ways to interact with the Aptos Blockchain:

EntryFunction Payload: Developers need only specify the function name they want to invoke and pass the corresponding arguments to the SDK.
Script Payload: Developers require a Move compiler to compile Move scripts into a compiled format, which is then used as the transaction payload.
These two approaches offer significantly different developer experiences. EntryFunctionPayload is easy to build using our provided SDK, but requires the developer to deploy the entry function to the blockchain upfront, limiting composability. Script Payload provides full expressivity, allowing developers to call and compose any on-chain Move functions. However, it requires the use of the full Move compiler, which may not be practical in a browser-based environment. Currently, the only practical way to use a script is to compile it once, store the compiled bytes in binary format, and use that format in the SDK on the client side.

Ideally, we want a solution that strikes a balance between these two approaches: allowing developers to easily compose Move functions in transactions on the client side without needing the entire Move compiler.

We present the Dynamic Transaction Composer to address this challenge. The transaction builder API will be integrated into the SDK, allowing developers to chain multiple Move calls into a single transaction. The builder will be implemented in Rust, which will generate compiled Move script bytes directly from a sequence of Move calls, without requiring the full Move compiler or source code. This builder will be bundled into WASM for seamless integration into our TypeScript SDK.

Additionally, we will introduce annotation logic to the indexer API so that the indexer/explorer can display the script in a format that looks like the chained function calls. This can be achieved by implementing a decompiler that reverse-engineers the code generation logic.

Read more about it here: https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-102.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant