in

Is it possible to automatically send a value back to the address of the original sender in a smart contract?

Let’s suppose this situation:

A gamble game, three players entered to the bet, the one who gets the higher number wins it all.

The only thing registered is the signature of the sender of the bet, that is, only the bet is registered, not an account or anything.

This would be the first move:

​

|Player 1|Player 2|Player 3|
|:-|:-|:-|
|Signature: 12345|Signature: abcde|Signature: aeoiu|
|Bet – Value: 0,001 eth|Bet – Value: 0,001 eth|Bet – Value: 0,001 eth|
|Recipient: xyz12|Recipient: xyz12|Recipient: xyz12|

It means that all players sent the bet to the address xyz12, which is the address of the house.

Then the address of the senders are stored until the round ends.

The draw is made and let’s suppose player 1 has won.

Then all the value in the address xyz12 (house) will be sent back to the address 12345:

​

|House|
|:-|
|Signature: xyz12|
|Prize – Value: 0,003 eth (- fees)|
|Recipient: 12345|

Then all data about the bets is deleted in order to not store more useless information.

Is it possible? I was thinking about it in order to eliminate user registration in gamble games

What do you think?

10 Points
Upvote Downvote

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

3 Comments

  1. Yes. You don’t even need to store the addresses of the senders, necessarily (though it might cost less gas if you do? not sure), because addresses can be extracted from message signatures. After validating the message signatures and senders, you can just store the signatures and later extract the addresses with the `ecrecover` function.

How to exchange cryptos on Coinomi | by Changelly Team

BotHunter 🎯 /$BTH Token / Search / Report, 🤖Destroy Bots and get their Money / Passive Income / Use Case / Nice Idea / PRESALE 27 July