supertestnet / bitcoin-chess

Play a game of chess and signal every move in a bitcoin transaction. An educational experiment with key tweaking
Creative Commons Zero v1.0 Universal
11 stars 0 forks source link

Game state stopped syncing mid game #1

Open TonyGiorgio opened 2 years ago

TonyGiorgio commented 2 years ago

"Next state update 0 seconds"

In the console log, I see:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.blockcypher.com/v1/btc/test3/addrs/tb1q5s232zcpdlgjny8nym0t6qz7w9wl29es5fqze2. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 429.

I refreshed the page, put in the opponent's pubkey back into the game, but it didn't resume from where I left off. It generated a new pubkey for me which was different from the original one. I was one move away from checkmate, I want my testnet money back :(

I try to view the readonly game of it and it has a bunch of tweakchain is undefined errors.

https://supertestnet.github.io/bitcoin-chess/view-only.html White: 02851267c66418f0e7ae3437c340aa8bb4ae3368201ee2b2480b31a80bfd379fe5 Black: 02154eb3ad4e8ef423498078bb3b8052e1022a9d4fec6c6ada397e13e09cf1d8db

I think it's related to CORS issues too.

supertestnet commented 2 years ago

I run into that issue occasionally, and I notice that blockcypher gave you an http error code of 429 which the internet defines as a rate limiting error. I suspect that blockcypher enforces their rate limit by redirecting your request to an error page that does not have a good CORS policy. When they start enforcing their rate limit, the game breaks.

For what it's worth, I had no trouble following your game in view only mode up to the point where White's bishop took Black's queen. The reason why you couldn't follow the game in view only mode is probably because blockcypher was still redirecting your requests to their error page. If you try it again now you should have no trouble following along.

I'm not sure how to fix the rate limit issue, assuming that I've correctly identified the problem. Maybe I should use blockstream instead of blockcypher, blockstream has a much higher rate limit, or maybe no rate limit at all.