Whitelist Addresses


I am trying to implement this with cloud functions. Is this feasible? I have a list of addresses that i want to whitelist.



We need more details. If you need a whitelist at contract level then maybe cloud functions will not help you

The link provided explains the approach.

Adding 50k+ addresses to a smart contract takes time and costs money. However, using a Cloudfunction/Lambda, a request can be signed. Then this signed hash can be used by the smart contract to authorise the caller.

ok, you will need to hardcode a private key in that cloud function in order to be able to do that signature

it is possible to do it

@cryptokid Awesome. That’s what i was thinking. I have a working sample in Solidity and Truffle.

I need to mimic

const soliditySha3Expected = soliditySha3(signer, β€œ1”); from β€œweb3-utils”

Or the solidity version.

function hashMessage(address sender, uint256 bucketNumber)
    returns (bytes32)
    return keccak256(abi.encodePacked(sender, bucketNumber));

Can Moralis SDK do this? Or can i import a npm package to cloud functions? I cannot see any docs on how to do that.