Alice and Bob want to agree on a bit $0$ or $1$. Both know it would be fair to pick that at random, but there's no way they could meet to throw a dice and no third party they could trust. Are there known protocols that allow either side to prove that they did not manipulate the outcome?
My idea is: Both randomly (or not - but that would be in their best interest) pick $0$ or $1$, write it down, put it in an envelope and send it to the other person. Then the XOR of both bits could not have been manipulated unfairly by either party.
The problem I see with that: How can Alice prove to Bob that she did not open his envolope before making her choice?
Maybe one could instead choose an initial string $n$ and use the first $k$ with $f^k(n) < a$ as the chosen value. Now if $f$ is a cryptographic hashing function and $a$ is small Alice would have taken a long time if she were to predict $k$ before sending her own choice.