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

Idea: Install Hook on a new account with the SetHook transaction #425

Open
tequdev opened this issue Jan 19, 2025 · 0 comments
Open

Idea: Install Hook on a new account with the SetHook transaction #425

tequdev opened this issue Jan 19, 2025 · 0 comments
Labels
feature Feature Request

Comments

@tequdev
Copy link
Collaborator

tequdev commented Jan 19, 2025

Summary

Instead of installing a Hook on the sender's account with a SetHook transaction, create a new account within the transaction and install a Hook on that account.

Motivation

When creating a so-called smart contract-type hook at present, we need to generate a key pair in an off-ledger, and activate the account and then send a SetHook transaction from that account.

By doing all of this in an on-ledger, it is possible to eliminate those off-ledger tasks.

Solution

If the corresponding flag is On, the SetHook transaction will create a new account within the process and install the Hook specified in sfHooks.

In addition, within SetHook, transaction sender must send account reserve and object reserve.

Sign-able account

To ensure access to the new account, set the regular key or signer list under the following conditions.

The account to be created will have the master key disabled.

  • If the transaction is signed with the master key, the account will be set as a regular key
  • If it is signed with a regular key, the account will be set as a regular key
  • If it is signed with a multi-sig, the signer list will be created with the same list.

Flags

  • Add two flags to the SetHook transaction.
    • A flag indicating that you have created a new account and installed Hook.
    • A flag indicating that the transaction is multisig-signed.
      • (Necessary to know that one object reserve is required for SignerList object when calculating the BaseFee in advance.)

Notes

Because created accounts only have reserves amount of XAH, we cannot create a new HookState in Hooks until we have made a separate deposit.

Paths Not Taken

@tequdev tequdev added the feature Feature Request label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature Request
Projects
None yet
Development

No branches or pull requests

2 participants
@tequdev and others