-
Notifications
You must be signed in to change notification settings - Fork 630
Add ERC: PDAs (Programmatically Derived Addresses) #890
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
base: master
Are you sure you want to change the base?
Conversation
File
|
```solidity | ||
function derivePDA(address baseContract, bytes32[] memory seeds) public pure returns (address) { | ||
bytes32 hash = keccak256(abi.encodePacked(baseContract, seeds)); | ||
return address(uint160(uint256(hash))); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some concerns/questions about this since there is no Discussions link to EthMagicians.
This function derives an Ethereum address by truncating a 32-byte Keccak-256 hash to 20 bytes?. If so, this is not the standard method for deriving Ethereum addresses. Usually , an Ethereum address is obtained by taking the last 20 bytes of the Keccak-256 hash of the public key.
Solidity's abi.encodePacked performs tight packing, this makes variable-length arrays like seeds might not be properly hashed as intended.
No Error Handling or validation for invalid inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this document meets the requirements for an ERC separate from EIP-1014. You haven't convinced the reader that there is a need for a standard derivePDA
function.
--- | ||
EIP: 7879 | ||
Title: Program-Derived Addresses (PDAs) | ||
Author: John Crunch, @JohnCrunch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Author: John Crunch, @JohnCrunch | |
author: John Crunch (@JohnCrunch) |
--- | ||
|
||
## Abstract | ||
This Ethereum Improvement Proposal (EIP) introduces Program-Derived Addresses (PDAs) as a mechanism to generate deterministic, contract-derived addresses without private keys. Inspired by Solana’s PDA architecture, this standard enables smart contracts to create verifiable and immutable addresses using predefined seeds and cryptographic operations. PDAs provide stateless, permissionless interactions with smart contracts while ensuring security and uniqueness. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Ethereum Improvement Proposal (EIP) introduces Program-Derived Addresses (PDAs) as a mechanism to generate deterministic, contract-derived addresses without private keys. Inspired by Solana’s PDA architecture, this standard enables smart contracts to create verifiable and immutable addresses using predefined seeds and cryptographic operations. PDAs provide stateless, permissionless interactions with smart contracts while ensuring security and uniqueness. | |
Program-Derived Addresses (PDAs) are deterministic, contract-derived addresses without private keys. Inspired by Solana’s PDA architecture, this standard enables smart contracts to create verifiable and immutable addresses using predefined seeds and cryptographic operations. PDAs provide stateless, permissionless interactions with smart contracts while ensuring security and uniqueness. |
--- | ||
|
||
## Abstract | ||
This Ethereum Improvement Proposal (EIP) introduces Program-Derived Addresses (PDAs) as a mechanism to generate deterministic, contract-derived addresses without private keys. Inspired by Solana’s PDA architecture, this standard enables smart contracts to create verifiable and immutable addresses using predefined seeds and cryptographic operations. PDAs provide stateless, permissionless interactions with smart contracts while ensuring security and uniqueness. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your abstract is decent, but it's missing a high-level (but still technical) overview of how the proposal accomplishes its goals. You should sketch out what the derivation mechanism is, at least briefly.
### Key Properties | ||
- **No Private Key Association**: The PDA does not have a corresponding private key, making it non-custodial and non-signable. | ||
- **Verifiable On-Chain**: Any contract can recompute a PDA and validate its authenticity. | ||
- **Prevents Collisions**: By incorporating the contract’s address, PDAs remain unique to the originating smart contract. | ||
|
||
### Use Cases | ||
#### 1. Stateless Account Abstraction | ||
PDAs allow contracts to operate permissionlessly on derived accounts, facilitating multi-user, multi-session access without requiring new wallet generation. | ||
|
||
#### 2. Gasless Meta-Transactions | ||
Users can interact with PDAs without directly owning them, enabling sponsored transactions where a relayer signs and pays gas on their behalf. | ||
|
||
#### 3. Trustless Escrow & Sub-Accounts | ||
Protocols can create predictable, verifiable addresses for escrow, lending, and financial primitives without requiring independent contract deployments. | ||
|
||
#### 4. Off-Chain State Commitments | ||
PDAs provide a deterministic address for off-chain data commitments, ensuring verifiability while reducing on-chain storage costs. | ||
|
||
#### 5. Efficient Multi-Party Control Without Gas Costs | ||
Ethereum’s multisig wallets require explicit transactions to modify ownership structures, incurring gas fees. PDAs enable multi-party control without the need for continuous storage updates, as authority can be derived programmatically. | ||
|
||
#### 6. On-Chain Order Books and Marketplaces | ||
Ethereum’s on-chain order books require storage mappings, making them expensive in gas costs. PDAs allow orders to be stored in derived addresses without bloating contract storage, similar to Solana’s Serum order book model. | ||
|
||
#### 7. Dynamic On-Chain Games | ||
PDAs can facilitate player state storage in decentralized games, reducing reliance on smart contract storage while maintaining programmatic access to game states. | ||
|
||
#### 8. Precomputed Addresses for DeFi and Oracles | ||
Lending protocols, AMMs, and on-chain oracles can generate deterministic PDAs for vaults, price feeds, and liquidity pools without requiring separate contract deployments, improving gas efficiency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use cases belong in Motivation. The Rationale section is for explaining choices made within the document itself.
The commit e642451 (as a parent of 06ede5b) contains errors. |
This is a draft ERC proposing Programmatically Derived Addresses (PDAs).
Summary
This ERC introduces a mechanism for generating deterministic, contract-derived addresses without private keys. PDAs enable permissionless, stateless interactions with smart contracts while ensuring security and uniqueness.
Requesting review from ERC editors. Thanks!