Cryptography – How to Use Private Key to Encode Your Own Public Address

cryptographyencodingencryptionprivate-keypublic-key

Let's say I use a wallet's private key to encode/digitally sign it's own public address, meaning that upon using its public address to decrypt that encoded/signed data, the result would be the public address itself. Until the others don't know what that public address is, is the message safe?

I would use then another wallet and put this signed data in the transaction, and at some later time I would reveal to people that public address, which would prove that I used that particular wallet to do certain operations/transactions.

Use case:
What I want to do is commit myself to using a specific wallet in advance, and later on this wallet will be used to generate Chainlink VRF random number, which will then be used in determining NFT metadata mapping (i.e. assigning actual NFT metadata to the NFTs in a random order).

EDIT:

You can actually sign the public address of some wallet by the same wallet which puts the signed data in the transaction. This way you don't need to rely/use the wallet whose public address got encrypted for the encryption and decryption, which is also more practical in case you do this for more wallets later on, because you can encrypt and reveal/decrypt all of them (separately) with this same wallet.

Best Answer

Until the others don't know what that public address is, is the message safe?

Yes. If you encrypt a message and post it on-chain, you can create what is called a commit and reveal scheme.

Note that any of the popular Ethereum wallets do not support encrypting messages. You would need to build a custom software for this where you import the private key.