CRYPTO NEWS

Range proof for elgamal ciphertext

Alice has an ElGamal public key $y=g^x$. Bob encrypts a value $g^b$ based on Alice’s Elgamal public key and he ends up with a ciphertext $(g^by^r, g^r)$. Can Bob prove that the value $b$ is in some range without revealing it or do you need to be the "owner" of the ElGamal secret key $x$ to create such proofs?

If $g^b$ is confusing then ignore it and consider a value $b$, I just need to know if I can create a range proof without knowing the $x$.

require(condition, "message") vs revert with a custom Error(), which is better and why?

For Example: /** Custom Errors **/ ///`cid` is an invalid Ipfs-Cid /// @param cid Ipfs-Cid entered. error InvalidCid(string cid); ///Sender’s address isnt valid error InvalidSenderAddress(address sender); function _addCid(string memory _cid) public { /// @dev Check for valid Cid //check using require require(bytes(_cid).length > 0, "Cannot accept empty Cid"); //check using custom error if(bytes(_cid).length < 0)::Listen

For Example:

/** Custom Errors **/     ///`cid` is an invalid Ipfs-Cid     /// @param cid Ipfs-Cid entered.     error InvalidCid(string cid);          ///Sender's address isnt valid     error InvalidSenderAddress(address sender);    function _addCid(string memory _cid) public {                              /// @dev Check for valid Cid                  //check using require         require(bytes(_cid).length > 0, "Cannot accept empty Cid");                  //check using custom error         if(bytes(_cid).length < 0)          revert InvalidCid(_cid);                        /// @dev Check for valid sender's address                   //require function         require(msg.sender != address(0), "Cannot be called from 0x0 address.");              //revert function          if(msg.sender == address(0))         revert InvalidSenderAddress(msg.sender);  function proceed();  }      

In the above code, I’ve used both revert and require for each of the validations-

  • Valid Ipfs-Cid
  • Valid sender’s address

My question is which one should I use and why?

Range proof for elgamal ciphertext

Shopping cart
There are no products in the cart!
Continue shopping
0