Is there a way to deal with desistance in a off-chain game?What are State Channels and use case/code examples?How does cryptokitties work with smart contracts and is there a random element to it?Is it possible to write an online browser game in ASP.net and integrate a smart contract to buy assets in that game for example?Loading smart contract x with tokens; sending eth to smart contract x; receiving tokens for that ethworking with balance management in a gameTic-tac-toe and smart contractsRock scissors paper game in SolidityDesign pattern for game development

How can I hint that my character isn't real?

Why does 8 bit truecolor use only 2 bits for blue?

Capacitors with same voltage, same capacitance, same temp, different diameter?

Is there a "right" way to interpret a novel, if not, how do we make sure our novel is interpreted correctly?

Get Emacs to jump to the start of a word after isearch

Colorize specific region in plane

Return only the number of paired values in array javascript

Why would an airport be depicted with symbology for runways longer than 8,069 feet even though it is reported on the sectional as 7,200 feet?

Why does PAUSE key have a long make code and no break code?

The pirate treasure of Leatherback Atoll

What explains the Genie's fate?

What precisely does the commonly reported network hash rate refer to?

Is mountain bike good for long distances?

Examples where "thin + thin = nice and thick"

How to finish my PhD?

Is there a way to deal with desistance in a off-chain game?

Galilean transformation vs simple translation

Why is infinite intersection "towards infinity" an empty set?

What's the biggest difference between these two photos?

Is a MySQL database a viable alternative to LDAP?

When did computers stop checking memory on boot?

When calculating averages, why can we treat exploding die as if they're independent?

Bit floating sequence

Are professors obligated to accept supervisory role? If not, how does it work?



Is there a way to deal with desistance in a off-chain game?


What are State Channels and use case/code examples?How does cryptokitties work with smart contracts and is there a random element to it?Is it possible to write an online browser game in ASP.net and integrate a smart contract to buy assets in that game for example?Loading smart contract x with tokens; sending eth to smart contract x; receiving tokens for that ethworking with balance management in a gameTic-tac-toe and smart contractsRock scissors paper game in SolidityDesign pattern for game development






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















Suppose I want to use blockchain to play chess for money. So, I can register, on the blockchain, a smart contract (a chess game) associated to some amount of ether. If someone wants to join, he or she has to bet the same amount of ether. Whoever wins the game, gets all the ether.



We can implement this smart contract to run on-chain. So, for every piece moved, the player would have to register his decision on the blockchain. This approach would be expensive, because the players would have to pay the transaction fee for every decision they make. And it would be slow, because the game speed would be limited to the speed of the blockchain itself.



To avoid those problems, we could implement this smart contract to run off-chain. Besides the game itself, and the ether, the contract would contain an address to establish a communication (forget about security issues).



The first to play would sign, with his private key, his decision (which chess piece, and its new position) and send it to the other player (not to the blockchain). The second player would sign, with his private key, a "block" that would contain his own decision AND the other decision AND the other signature, and send it to the first player, and so on...



This process would continue until the end of the game. Then, any player could register the final block (containing all the decisions signed) on the blockchain. The contract itself could verify the autenticity and the validity of the decisions (in this case, the moves) and transfer all the ether to the winner.



The problem is: how to deal with desistance?



If a disonest player make a bad move, he can not regret (after send it to the other player), because his decision is signed, but he can just "do nothing" forever. So, he will just ignore the next decision he will receive from the other, and all the ether would be forever blocked for both players. To avoid that, we can implement a timeout.



If the contract has a timeout, another problem emerge: one player (let's call it A) can try to "deceive" the blockchain, pretending that the other player gave up, by refusing to accept the other's decisions.
We can solve that by allowing the other player (let's call it B) himself to register his decision directly on the blockchain, even if it is not his turn to play. This way, the contract will able to know that player B is active.



I believe that, this way, both players would have incentives to play honestly.



If player A doesn't want to (or can't) play anymore, B can send the incomplete game to the blockchain and, after a timeout, if A doesn't publish any valid decision, the contract will asumme that A gave up and will transfer all the ether to B.



If player A believe he has no chance of winning, he will have to send a decision anyway, otherwise player B will register on the blockchain the incomplete game, and the time will begin to count, unless A publish a valid decision.



As you can see, I've just proposed a solution. I did that because I don't even know how to properly describe the problem.



So, now that (I hope) the problem is clear, does this solution work? If not, is there another one? Which?



I used chess as example, but it could be Go, Checker, Hash, Poker, or any other decision game.










share|improve this question







New contributor



Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    2















    Suppose I want to use blockchain to play chess for money. So, I can register, on the blockchain, a smart contract (a chess game) associated to some amount of ether. If someone wants to join, he or she has to bet the same amount of ether. Whoever wins the game, gets all the ether.



    We can implement this smart contract to run on-chain. So, for every piece moved, the player would have to register his decision on the blockchain. This approach would be expensive, because the players would have to pay the transaction fee for every decision they make. And it would be slow, because the game speed would be limited to the speed of the blockchain itself.



    To avoid those problems, we could implement this smart contract to run off-chain. Besides the game itself, and the ether, the contract would contain an address to establish a communication (forget about security issues).



    The first to play would sign, with his private key, his decision (which chess piece, and its new position) and send it to the other player (not to the blockchain). The second player would sign, with his private key, a "block" that would contain his own decision AND the other decision AND the other signature, and send it to the first player, and so on...



    This process would continue until the end of the game. Then, any player could register the final block (containing all the decisions signed) on the blockchain. The contract itself could verify the autenticity and the validity of the decisions (in this case, the moves) and transfer all the ether to the winner.



    The problem is: how to deal with desistance?



    If a disonest player make a bad move, he can not regret (after send it to the other player), because his decision is signed, but he can just "do nothing" forever. So, he will just ignore the next decision he will receive from the other, and all the ether would be forever blocked for both players. To avoid that, we can implement a timeout.



    If the contract has a timeout, another problem emerge: one player (let's call it A) can try to "deceive" the blockchain, pretending that the other player gave up, by refusing to accept the other's decisions.
    We can solve that by allowing the other player (let's call it B) himself to register his decision directly on the blockchain, even if it is not his turn to play. This way, the contract will able to know that player B is active.



    I believe that, this way, both players would have incentives to play honestly.



    If player A doesn't want to (or can't) play anymore, B can send the incomplete game to the blockchain and, after a timeout, if A doesn't publish any valid decision, the contract will asumme that A gave up and will transfer all the ether to B.



    If player A believe he has no chance of winning, he will have to send a decision anyway, otherwise player B will register on the blockchain the incomplete game, and the time will begin to count, unless A publish a valid decision.



    As you can see, I've just proposed a solution. I did that because I don't even know how to properly describe the problem.



    So, now that (I hope) the problem is clear, does this solution work? If not, is there another one? Which?



    I used chess as example, but it could be Go, Checker, Hash, Poker, or any other decision game.










    share|improve this question







    New contributor



    Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      2












      2








      2








      Suppose I want to use blockchain to play chess for money. So, I can register, on the blockchain, a smart contract (a chess game) associated to some amount of ether. If someone wants to join, he or she has to bet the same amount of ether. Whoever wins the game, gets all the ether.



      We can implement this smart contract to run on-chain. So, for every piece moved, the player would have to register his decision on the blockchain. This approach would be expensive, because the players would have to pay the transaction fee for every decision they make. And it would be slow, because the game speed would be limited to the speed of the blockchain itself.



      To avoid those problems, we could implement this smart contract to run off-chain. Besides the game itself, and the ether, the contract would contain an address to establish a communication (forget about security issues).



      The first to play would sign, with his private key, his decision (which chess piece, and its new position) and send it to the other player (not to the blockchain). The second player would sign, with his private key, a "block" that would contain his own decision AND the other decision AND the other signature, and send it to the first player, and so on...



      This process would continue until the end of the game. Then, any player could register the final block (containing all the decisions signed) on the blockchain. The contract itself could verify the autenticity and the validity of the decisions (in this case, the moves) and transfer all the ether to the winner.



      The problem is: how to deal with desistance?



      If a disonest player make a bad move, he can not regret (after send it to the other player), because his decision is signed, but he can just "do nothing" forever. So, he will just ignore the next decision he will receive from the other, and all the ether would be forever blocked for both players. To avoid that, we can implement a timeout.



      If the contract has a timeout, another problem emerge: one player (let's call it A) can try to "deceive" the blockchain, pretending that the other player gave up, by refusing to accept the other's decisions.
      We can solve that by allowing the other player (let's call it B) himself to register his decision directly on the blockchain, even if it is not his turn to play. This way, the contract will able to know that player B is active.



      I believe that, this way, both players would have incentives to play honestly.



      If player A doesn't want to (or can't) play anymore, B can send the incomplete game to the blockchain and, after a timeout, if A doesn't publish any valid decision, the contract will asumme that A gave up and will transfer all the ether to B.



      If player A believe he has no chance of winning, he will have to send a decision anyway, otherwise player B will register on the blockchain the incomplete game, and the time will begin to count, unless A publish a valid decision.



      As you can see, I've just proposed a solution. I did that because I don't even know how to properly describe the problem.



      So, now that (I hope) the problem is clear, does this solution work? If not, is there another one? Which?



      I used chess as example, but it could be Go, Checker, Hash, Poker, or any other decision game.










      share|improve this question







      New contributor



      Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Suppose I want to use blockchain to play chess for money. So, I can register, on the blockchain, a smart contract (a chess game) associated to some amount of ether. If someone wants to join, he or she has to bet the same amount of ether. Whoever wins the game, gets all the ether.



      We can implement this smart contract to run on-chain. So, for every piece moved, the player would have to register his decision on the blockchain. This approach would be expensive, because the players would have to pay the transaction fee for every decision they make. And it would be slow, because the game speed would be limited to the speed of the blockchain itself.



      To avoid those problems, we could implement this smart contract to run off-chain. Besides the game itself, and the ether, the contract would contain an address to establish a communication (forget about security issues).



      The first to play would sign, with his private key, his decision (which chess piece, and its new position) and send it to the other player (not to the blockchain). The second player would sign, with his private key, a "block" that would contain his own decision AND the other decision AND the other signature, and send it to the first player, and so on...



      This process would continue until the end of the game. Then, any player could register the final block (containing all the decisions signed) on the blockchain. The contract itself could verify the autenticity and the validity of the decisions (in this case, the moves) and transfer all the ether to the winner.



      The problem is: how to deal with desistance?



      If a disonest player make a bad move, he can not regret (after send it to the other player), because his decision is signed, but he can just "do nothing" forever. So, he will just ignore the next decision he will receive from the other, and all the ether would be forever blocked for both players. To avoid that, we can implement a timeout.



      If the contract has a timeout, another problem emerge: one player (let's call it A) can try to "deceive" the blockchain, pretending that the other player gave up, by refusing to accept the other's decisions.
      We can solve that by allowing the other player (let's call it B) himself to register his decision directly on the blockchain, even if it is not his turn to play. This way, the contract will able to know that player B is active.



      I believe that, this way, both players would have incentives to play honestly.



      If player A doesn't want to (or can't) play anymore, B can send the incomplete game to the blockchain and, after a timeout, if A doesn't publish any valid decision, the contract will asumme that A gave up and will transfer all the ether to B.



      If player A believe he has no chance of winning, he will have to send a decision anyway, otherwise player B will register on the blockchain the incomplete game, and the time will begin to count, unless A publish a valid decision.



      As you can see, I've just proposed a solution. I did that because I don't even know how to properly describe the problem.



      So, now that (I hope) the problem is clear, does this solution work? If not, is there another one? Which?



      I used chess as example, but it could be Go, Checker, Hash, Poker, or any other decision game.







      games off-chain






      share|improve this question







      New contributor



      Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 8 hours ago









      Tiago NascimentoTiago Nascimento

      111 bronze badge




      111 bronze badge




      New contributor



      Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Tiago Nascimento is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.

























          2 Answers
          2






          active

          oldest

          votes


















          2
















          You have described State Channels: What are State Channels and use case/code examples?



          They are the basis of some blockchain games and several second layer scaling solutions like Raiden or Bitcoin Lightning network.






          share|improve this answer
































            1
















            I wrote a few blog posts that build up to a full state channel solution:



            • Two-Player Games In Ethereum

            • State Channels for Two-Player Games

            • State Channels with Signing Keys

            Specifically, the "On-Chain Fallback" section of the second post is relevant to your question about timeouts:




            ...if a player’s opponent has stopped making moves, the player needs to invoke a timeout by calling startTimeout()...



            In response to a timeout, the player whose turn it is must make a move by calling move(). This resets the timer and lets the game continue. Players can then resume the typical workflow of exchanging signed messages, or they can continue to make moves on chain.




            I believe this is exactly what you describe, so yes, I believe your solution should work.






            share|improve this answer



























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "642"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );







              Tiago Nascimento is a new contributor. Be nice, and check out our Code of Conduct.









              draft saved

              draft discarded
















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f74750%2fis-there-a-way-to-deal-with-desistance-in-a-off-chain-game%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2
















              You have described State Channels: What are State Channels and use case/code examples?



              They are the basis of some blockchain games and several second layer scaling solutions like Raiden or Bitcoin Lightning network.






              share|improve this answer





























                2
















                You have described State Channels: What are State Channels and use case/code examples?



                They are the basis of some blockchain games and several second layer scaling solutions like Raiden or Bitcoin Lightning network.






                share|improve this answer



























                  2














                  2










                  2









                  You have described State Channels: What are State Channels and use case/code examples?



                  They are the basis of some blockchain games and several second layer scaling solutions like Raiden or Bitcoin Lightning network.






                  share|improve this answer













                  You have described State Channels: What are State Channels and use case/code examples?



                  They are the basis of some blockchain games and several second layer scaling solutions like Raiden or Bitcoin Lightning network.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 7 hours ago









                  IsmaelIsmael

                  17.1k6 gold badges28 silver badges51 bronze badges




                  17.1k6 gold badges28 silver badges51 bronze badges


























                      1
















                      I wrote a few blog posts that build up to a full state channel solution:



                      • Two-Player Games In Ethereum

                      • State Channels for Two-Player Games

                      • State Channels with Signing Keys

                      Specifically, the "On-Chain Fallback" section of the second post is relevant to your question about timeouts:




                      ...if a player’s opponent has stopped making moves, the player needs to invoke a timeout by calling startTimeout()...



                      In response to a timeout, the player whose turn it is must make a move by calling move(). This resets the timer and lets the game continue. Players can then resume the typical workflow of exchanging signed messages, or they can continue to make moves on chain.




                      I believe this is exactly what you describe, so yes, I believe your solution should work.






                      share|improve this answer





























                        1
















                        I wrote a few blog posts that build up to a full state channel solution:



                        • Two-Player Games In Ethereum

                        • State Channels for Two-Player Games

                        • State Channels with Signing Keys

                        Specifically, the "On-Chain Fallback" section of the second post is relevant to your question about timeouts:




                        ...if a player’s opponent has stopped making moves, the player needs to invoke a timeout by calling startTimeout()...



                        In response to a timeout, the player whose turn it is must make a move by calling move(). This resets the timer and lets the game continue. Players can then resume the typical workflow of exchanging signed messages, or they can continue to make moves on chain.




                        I believe this is exactly what you describe, so yes, I believe your solution should work.






                        share|improve this answer



























                          1














                          1










                          1









                          I wrote a few blog posts that build up to a full state channel solution:



                          • Two-Player Games In Ethereum

                          • State Channels for Two-Player Games

                          • State Channels with Signing Keys

                          Specifically, the "On-Chain Fallback" section of the second post is relevant to your question about timeouts:




                          ...if a player’s opponent has stopped making moves, the player needs to invoke a timeout by calling startTimeout()...



                          In response to a timeout, the player whose turn it is must make a move by calling move(). This resets the timer and lets the game continue. Players can then resume the typical workflow of exchanging signed messages, or they can continue to make moves on chain.




                          I believe this is exactly what you describe, so yes, I believe your solution should work.






                          share|improve this answer













                          I wrote a few blog posts that build up to a full state channel solution:



                          • Two-Player Games In Ethereum

                          • State Channels for Two-Player Games

                          • State Channels with Signing Keys

                          Specifically, the "On-Chain Fallback" section of the second post is relevant to your question about timeouts:




                          ...if a player’s opponent has stopped making moves, the player needs to invoke a timeout by calling startTimeout()...



                          In response to a timeout, the player whose turn it is must make a move by calling move(). This resets the timer and lets the game continue. Players can then resume the typical workflow of exchanging signed messages, or they can continue to make moves on chain.




                          I believe this is exactly what you describe, so yes, I believe your solution should work.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 5 hours ago









                          smarxsmarx

                          21.5k1 gold badge8 silver badges20 bronze badges




                          21.5k1 gold badge8 silver badges20 bronze badges
























                              Tiago Nascimento is a new contributor. Be nice, and check out our Code of Conduct.









                              draft saved

                              draft discarded

















                              Tiago Nascimento is a new contributor. Be nice, and check out our Code of Conduct.












                              Tiago Nascimento is a new contributor. Be nice, and check out our Code of Conduct.











                              Tiago Nascimento is a new contributor. Be nice, and check out our Code of Conduct.














                              Thanks for contributing an answer to Ethereum Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f74750%2fis-there-a-way-to-deal-with-desistance-in-a-off-chain-game%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                              Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                              Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її