
Students at Berlin University Build Chess Game on Ethereum - posternut
https://news.bitcoin.com/berlin-students-chess-ethereum/
======
seltzered_
direct link to students medium post: [https://medium.com/@graycoding/lessons-
learned-from-making-a...](https://medium.com/@graycoding/lessons-learned-from-
making-a-chess-game-for-ethereum-6917c01178b6#.xc06oinx1)

link to their github repo for ethereum chess: [https://github.com/ise-
ethereum/on-chain-chess](https://github.com/ise-ethereum/on-chain-chess)

------
SamBam
I don't understand why verifying the checkmate end state is any harder than
playing each turn.

They say

> For checkmate and stalemate, to verify the condition all possible moves have
> to be calculated and verified, which is unfeasible on the blockchain.

But "all possible moves" is only one-move deep. We're generally talking a
couple dozen possible moves at most. If the system can't calculate a couple
dozen possible moves, how is all the basic move logic being done "on chain,"
as they say?

~~~
gjem97
I have to admit ignorance about this implementation, but as I understand it
evaluating a single move is computationally much simpler. That is given a
piece, validate that the proposed move (decided on by a human) conforms to the
rules of chess, and is valid for the given board state. Verifying a checkmate
(even if only verifying checkmates proposed by a human player), means going
through every one of the opponents pieces to see if it can be used to improve
to a non-check state.

~~~
tromp
Verifying checkmate is essentially doing a 2-ply search: for all moves i can
make, the opponent has a reply that captures my king. This is more work than
verifying normal moves, where a 1-ply search suffices to check that kings are
not left in check.

They could have simply adopted blitz chess rules, where the goal is to capture
the opponent king, and leaving your king in check is not illegal, to avoid all
this extra computation...

~~~
mikeash
The average branching factor for chess is about 35 moves, so verifying check
would typically require looking at roughly 35 moves, while verifying checkmate
would require about 1,225 moves. I'm surprised that a factor of 35 is enough
to push it over the edge, but I guess Ethereum contracts need to be fairly
limited.

I wonder if it's cheaper to verify a proof of checkmate that someone else
computes. I'm not sure exactly what such a proof would look like, but there
are lots of problems where finding a proof is hard, but verifying one is easy.
Then you could make the checkmating player prove that it's checkmate and
provide that proof along with their final move, and the contract could just
verify it.

~~~
tscs37
The problem on Ethereum is not that it's limited, the EVM is capable of
handling it.

The problem here is that there is a cap of how much gas[1] a block may consume
which is the moving average of consumed gas plus some extra.

A few contracts got stuck that way; by getting to a point where they could no
longer use that much gas.

[1]: Gas in Ethereum refers to the amount of value paid for computation, once
gas runs out the execution is terminated and the gas subtracted from the
senders account.

~~~
mikeash
I've heard of gas, but I'm not entirely familiar with the cap. I thought it
was determined by how much the contract wanted to spend. Are you saying
there's a fixed cap as well?

~~~
tscs37
Upfront all transactions must pay for the computation they expect to have. The
user (or whatever) decided how much has may be spent.

When the transaction runs, gas is consumed. If the transaction finished or
there is no more gas, computation stops.

Now, transactions have no limit but blocks of transactions have. This is to
prevent a single person creating and mining gigantic transaction to stall the
network.

This limit is dynamic and you can raise it by having the network use more gas
until the moving average climbs high enough.

~~~
mikeash
Makes sense, thanks for explaining! Basing the limit on the moving average is
an interesting choice and I wonder what sort of long-term consequences it will
have on people's behavior. Seems like there's some potential for weird
feedback loops.

------
daveguy
I wonder if we can squeeze coins out of it.

~~~
matthewcford
half the chess pieces go missing

------
snippet22
Oh the language built for lawyers...yay

~~~
Aenima
Ethereum chess had significant latency and the impossibility of consensus...
sounds like lawyer's work to me.

------
meinhard
chess. but with blockchain!

