Reorgs handling
Simple example: Handling reorg risk on Ethereum
contract PrivateKeySale {
euint256 privateKey;
bool isAlreadyBought = false;
constructor(externalEuint256 _privateKey, bytes inputProof) {
privateKey = FHE.fromExternal(_privateKey, inputProof);
FHE.allowThis(privateKey);
}
function buyPrivateKey() external payable {
require(msg.value == 1 ether, "Must pay 1 ETH");
require(!isBought, "Private key already bought");
isBought = true;
FHE.allow(encryptedPrivateKey, msg.sender);
}
}Last updated