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

Add ERC: PDAs (Programmatically Derived Addresses) #890

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JohnCrunch
Copy link

This is a draft ERC proposing Programmatically Derived Addresses (PDAs).

  • ERC Number: To be assigned by an editor.
  • Discussion Link: TODO create conversation in ethereum magicians with this ERC

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!

@eip-review-bot
Copy link
Collaborator

eip-review-bot commented Feb 8, 2025

File ERCS/erc-7879.md

Requires 1 more reviewers from @g11tech, @lightclient, @SamWilsn, @xinbenlv

Comment on lines +30 to +34
```solidity
function derivePDA(address baseContract, bytes32[] memory seeds) public pure returns (address) {
bytes32 hash = keccak256(abi.encodePacked(baseContract, seeds));
return address(uint160(uint256(hash)));
}

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants