These days you see many token sales where they exclude residents from certain countries. But how does this work?

E.g.: one passes the whitelisting procedure and is whitelisted. How to the developers 'exclude ' everyone that is not on the whitelist. Is it done by just allowing the whitelisted contribution adresses to contribute or something else?


You'd have to look at a specific token sale contract to see how they're doing it, but this is pretty simple to achieve in a smart contract. E.g.:

mapping(address => bool) whitelist;

function approve(address addr) public {
    // owner approves buyers by address when they pass the whitelisting procedure
    require(msg.sender == owner);

    whitelist[addr] = true;

function purchase() public payable {
    // only approved buyers can call this function


You can't do it within the smart contract so it must be done outside. I'd imagine it's based on geoip or something similar. So, if your IP is from an allowed country you are given an address where to send your Ether. So everyone needs an unique address to send their Ether to and you can't get this destination address if you're in a blocked country.

Of course this kind of systems can be fooled easily but at least it's better than nothing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.