The RSADonations contract provides a way to send ETH to anyone with an RSA keypair. This is a WIP, mostly written during the ETH Paris hackathon.
Many more people own RSA keypairs than Ethereum addresses, and RSA public keys tend to be publicly associated to real-world identities:
- Most websites’ SSL uses an RSA keypair, and this can easily be retrieved
- Most heavy users of github have an RSA keypair, and this can easily be retrieved
- Many (perhaps most) GPG users have an RSA keypair
Thus, being able to commit ETH to an RSA public key greatly broadens the scope for Ethereum-based donations, and gives donees a trustworthy incentivize to adopt Ethereum, i.e. in order to claim their donations.
It happens that RSA cryptography can be done quite efficiently on the EVM, due to the modular exponentiation precompile
- The contract is written, and the core components of it have been tested. Signature verification and claiming of donations are the next thing to test.
- Methods for retrieving RSA public keys given domain names and github user profiles have been determined.
RSADonations commits ETH to an RSA public key, which can then be claimed by
the key owner by sending a message signed with the key.
- User specifies the real-world identity (domain name, github username, GPG id).
- The RSA public key for that identity is retrieved. (See
ssl_keyin ./app/routes.py, or try adjusting the last field of this URL, assuming the service hasn’t fallen over… - User specifies the amount of ETH to send, and how long to commit it for.
This is sent to
RSADonations#donateToNewPublicKeyalong with the key, if the contract doesn’t already know about it, orRSADonations#donateToKnownPublicKeyif it does. - If the commitment deadline expires before the key owner claims the funds,
the original sender can recover them by sending a message to the
recoverDonationmethod. This mitigates the risk of sending to a keypair for which the private key has been lost. - The claimant constructs a message, signed with the RSA private key, and
containing
- a nonce
- the ethereum address to send the funds to
- size of reward for the transmitter of the message, which will be deducted from the funds
- the transmitter. Specifying this enables the claimant to retrieve their funds without already having ETH, and makes it cost-effective to run a service which sends such transactions.
The message construction needs to access the private key. The page which does this can operate offline, so that claimants can mitigate the risk of exposing the private key to whatever extent they wish. The message can then be pasted in to the aforementioned ethereum transmission service, which then sends it to the
claimDonationmethod. - The contract verifies the signature, and transfers the funds if the message is valid.
- Tested on ubuntu 18.04.
apt install openssl python-pip npm docker.iopip install -r ./requirements.txt- Put a secret key (used for cookie/CSRF protection) in
./app/secret_key.txt. npm installdocker pull ethereum/solc:0.5.2FLASK_APP=RSA_donations.py FLASK_DEBUG=1 flask run