I was looking into the routing of the SAFEnetwork by Maidsafe. They use bitwise XOR to calculate the distance between 2 nodes. It’s a mathematical calculation which insures you’re almost get random connections around the globe.

When thinking about a lottery on Ethereum, let’s say 20.000 users send ETH to a lottery-contract. After 10.000 blocks there will be a winner. How do we know who has won? We need randomness! So here’s the trick to do that:

All addresses on Ethereum are already random. So the contract calculates the XOR-distance between the Hash of the last block and the 20.000 addresses who sent money to the contract to play the lottery. All people have to send the same amount of money (let’s say 1 ETH) and the contract will send the price to the address that’s closest to the Hash of the last block (random) and the address (random) based on XOR-Distance. What do you think?