Goal (not asking XY question):
- send ETH to an address
web3.js
script monitoring it and acting upon transaction- if
msg.value > 0.1 ether
then... - ...encrypt a file with the public key of the
msg.sender
and publish to IPFS - only the original ETH sender (they have private key) can decrypt the file
Looking at the question: How are ethereum addresses generated?
Start with the public key (128 characters / 64 bytes)
Take the Keccak-256 hash of the public key. You should now have a string that is 64 characters / 32 bytes. (note: SHA3-256 eventually became the standard, but Ethereum uses Keccak)
Take the last 40 characters / 20 bytes of this public key (Keccak-256). Or, in other words, drop the first 24 characters / 12 bytes. These 40 characters / 20 bytes are the address. When prefixed with 0x it becomes 42 characters long.
Public key to address is a one-way function, so how can we design the system to accomplish the goal?