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?
Yet another calculator problem
Leaving the USA for 10 yrs when you have asylum
Why does PAUSE key have a long make code and no break code?
How should Thaumaturgy's "three times as loud as normal" be interpreted?
Electric shock from pedals and guitar. Jacks too long?
Is mountain bike good for long distances?
Schrodinger's Cat Isn't Meant To Be Taken Seriously, Right?
Are professors obligated to accept supervisory role? If not, how does it work?
2 load centers under 1 meter: do you need bonding and main breakers at both?
Is every sentence we write or utter either true or false?
Hidden fifths between tenor and soprano in Tchaikovsky's "Guide to harmony"
Bacteria vats to generate edible biomass, require intermediary species?
How can faith be maintained in a world of living gods?
What explains the Genie's fate?
Could someone please explain what this inline #define assembly is doing?
Is it right to use the ideas of non-winning designers in a design contest?
Contractor cut joist hangers to make them fit
What precisely does the commonly reported network hash rate refer to?
Is future tense in English really a myth?
How to convert P2O5 concentration to H3PO4 concentration?
What happens when a file that is 100% paged in to the page cache gets modified by another process
How do you say "to hell with everything" in French?
What can we do about our 9-month-old putting fingers down his throat?
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;
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
New contributor
add a comment |
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
New contributor
add a comment |
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
New contributor
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
games off-chain
New contributor
New contributor
New contributor
asked 8 hours ago
Tiago NascimentoTiago Nascimento
111 bronze badge
111 bronze badge
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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.
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered 7 hours ago
IsmaelIsmael
17.1k6 gold badges28 silver badges51 bronze badges
17.1k6 gold badges28 silver badges51 bronze badges
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered 5 hours ago
smarxsmarx
21.5k1 gold badge8 silver badges20 bronze badges
21.5k1 gold badge8 silver badges20 bronze badges
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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