AleoNet / snarkVM

A Virtual Machine for Zero-Knowledge Executions

Home Page:https://snarkvm.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Add self.address to the Aleo instructions

snowtigersoft opened this issue Β· comments

πŸš€ Feature

Add self.address to the Aleo instructions & Leo

Motivation

The ability to reference a program's own address within its instructions is a crucial feature that's currently missing in snarkVM. As it stands, to utilize a program's address within the program itself, one must pre-calculate this address before deployment. This process is prone to errors, especially during program upgrades, where there's a risk of mistakenly using an old program's address. Incorporating a self.address feature directly into the instructions would significantly streamline development, reduce errors, and facilitate smoother program upgrades.

This feature request is motivated by the practical need to reference the deploying program's address more dynamically and accurately within the Aleo ecosystem. It relates to the broader goal of enhancing developer experience and program reliability on the platform.

Implementation

To support this feature in snarkVM:

  • Introduce a new instruction, self.address, that when called, returns the address of the current program.
  • This addition would require modifications to the snarkVM instruction set and possibly the execution environment to correctly interpret and execute this new instruction.
  • Ensure that self.address an be seamlessly integrated into existing and future Aleo programs without breaking changes.