Smart-Contract-Owned P-Chain Staking Account #174
Replies: 4 comments 4 replies
-
dope proposal there |
Beta Was this translation helpful? Give feedback.
-
Is there a way to abstract this from concrete P-Chain transactions CreateAbstractedAccountTx: Creates new account that is managed by an ChainID and Address combination CallFromAbstractedAccountTc: Wraps any existing P-Chain transaction type and provides a signed warp adressedCall message over the parameters that authorizes the action This way we would not only unlock staking, but all P-Chain tx types including creation of L1s. The entire P-Chain can be made accessible from any L1 and the C-Chain via a trustless relayer that can deliver these messages for a few (similar to ICM) |
Beta Was this translation helpful? Give feedback.
-
I think this a very cool idea, especially considering that liquid staking solutions already exist today and their off-chain components introduce potential security risks to the ecosystem since they could potentially secure a large amount of staked AVAX. My main question for how it could all work is regarding how the new account addresses would work. For example, say I create an account using
A similar consideration would be how these addresses are handled when used as part of a multi-sig output. Minor note: Using "1" as the separator after the HRP of a bech32 address is actually part of the official bech32 specification, so may want to consider altering the HRP prefix instead for display purposes such that all standard bech32 libraries/tooling would still work. |
Beta Was this translation helpful? Give feedback.
-
Love this. I'd be in favor of abstracting this as @martineckardt suggested towards a new auth type for existing P-Chain transactions rather than creating duplicates of existing transaction types. Wrote up my thoughts on warp addressed transactions here: |
Beta Was this translation helpful? Give feedback.
-
Motivation
Staking of AVAX to the Avalanche Primary Network happens on the P-Chain. This forces liquid staking providers to set up off-chain custodial MPC solutions to manage the bridging of AVAX from/to the C-Chain and the staking operations on the P-Chain.
The implementation of ACP-77 in the Etna upgrade (that went live on December 16th, 2024) has proven that it is possible to manage an L1 validator set from any Avalanche L1 by leveraging ICM (InterChain Messaging) to the P-Chain.
We propose to define a new type of P-Chain account that would be owned by a smart contract on an Avalanche L1 (most likely the C-Chain) and leverage ICM to manage AVAX staking operations on the P-Chain.
Description
This proposal requires (i) the creation of a new type of P-Chain account with its own AVAX balance and (ii) the introduction of new transactions to cover the entire staking workflow.
Smart-contract-owned P-Chain account
Similar to how a
ValidatorManager
contract is defined for each L1 and needed to sign L1-related transactions, a smart contract would be the sole capable of signing for staking operations for the AVAX tokens it owns. This type of account should be compatible with AVAX functions such as exports from the C/X-chain, P-Chain transfers, and validation/delegation outputs.CreateStakingAccountTx
For the creation of such an account, we would introduce a new transaction to the P-Chain, e.g.
CreateStakingAccountTx
.Staking account address
To remain compatible with existing P-Chain functions, we could envision following the same pattern as Bech32 X/P-Chain addresses but clearly identifying staking accounts by using
2
as the separator between the HRP from the address and error correction code (1
is currently used for EOAs). The four parts of a staking account Bech32 address would be:avax
.2
, which separates the HRP from the address and error correction code.The 20-byte address could be obtained by hashing the ID of the transaction that created the staking account:
New P-Chain transactions
To cover the entire staking workflow, the following new transactions should be introduced:
CreateStakingAccountTx
as described aboveChainID
andAddress
of the smart contract owning the staking accountImportToStakingAccountTx
, the equivalent of ImportTx for staking accounts (has to follow an export transaction on X/C-Chain)ExportFromStakingAccountTx
, the equivalent of ExportTx for staking accountsAddValidatorForStakingAccountTx
, the equivalent of AddValidatorTx for staking accountsAddDelegatorForStakingAccountTx
, the equivalent of AddDelegatorTx for staking accountsAny EOA can execute those transactions on the P-Chain as long as a proper ICM message signed by the C-Chain validators is passed as a parameter.
Use Cases
Trust-minimized liquid staking
Smart-contract-owned P-Chain accounts enable trust-minimized, decentralized liquid staking directly on Avalanche. These accounts allow smart contracts on the C-Chain to manage operations on the P-Chain simplifying the process while enhancing security and accessibility.
Smart contracts fully control all operations needed for liquid staking, including, but not limited to, staking, delegations, and cross-chain transfers, ensuring transparent and secure on-chain management.
DAO/institutional-owned nodes
DAOs and institutional actors could also operate smart-contract-owned P-Chain accounts, allowing risk-free yield on on-chain treasuries.
Open Questions
Should there be an emergency P-Chain account bound to the staking account?
Since anyone can relay messages, this shouldn’t be necessary and would increase trust assumptions.
Should there be the same output options for staking transactions?
AddValidatorTx
andAddDelegatorTx
haveStakeOuts
andRewardsOwner
parameters. Not sure they make as much sense for staking accounts.Beta Was this translation helpful? Give feedback.
All reactions