sdk
sdk copied to clipboard
[Feature] Execute program command
🚀 Feature
Add an aleo execute
command and equivalent WASM functionality to execute a program's function and broadcast the resulting transaction on-chain.
Motivation
Both Aleo developers and users need a way to execute their programs on-chain. For wallets and any other applications running on top of Aleo to work, they need a way to execute functions and publish them on the blockchain.
This is also necessary for the explorer to give users the ability to execute program functions.
Implementation
As opposed to the run
feature, this will require accessing on-chain state (i.e. records). When a program receives a record as input, the execute
command (or wasm function) will expect an on-chain record commitment, which it will fetch from a node, decrypt using the user's view key and then use for the execution.
As an example, if there's a hello
function with one record as input, and the CLI user has a record on chain with commitment 3892363209129015695237595996230595282638607490815872341685075479616088416491field
, they would run (on the CLI)
aleo execute hello 3892363209129015695237595996230595282638607490815872341685075479616088416491field