Hi everyone, first post here.
I’ve been an Ethereum developer for more than 2 years and this weekend I found Algorand and it seems to be very promising!
So I started to read the developers’ docs and I’ve also put a node online (mainnet) on one of my DigitalOcean droplets.
To keep playing around I’ve opted to use the Docker sandbox
on my local machine (testnet).
One thing that I didn’t get it right is the proper way to set and get data from a Smart Contract (account).
I understand that a user can leverage the note
field of a txn to insert some data there.
But I’m still not able to figure out how another user can interact with this note
.
Let me try to elaborate better using an example:
1 - Alice wants to “create” a game in the real world and using virutal prize (ALGO).
So she initiates a Smart Contract with 100 ALGO and a note
with the participants of the game:
note = {
"amount": 100,
"participants": "",
"winner": "",
"rules": "BlaBlaBla",
"expiration": 7000000
}
2 - Alice then invites Bob to join her game, in order to do that, Bob needs to send 1 ALGO to the Smart Contract and update its notes.
But first Alice needs Bob’s account to make him able to participate:
3 - Alice adds Bob to her game’s note:
note = {
"amount": 100,
"participants": "[BobAddr]",
"winner": "",
"rules": "BlaBlaBla",
"expiration": 7000000
}
4 - Now Bob is able to interact with the Smart Contract (game) <— here is my question!
My goal is to make the Smart Contract read the “participants” list and validate that Bob’s Address can participate and by that accept his txn.
Bob’s txn has to, besides send 1 ALGO, insert his account as the “current” winner:
note = {
"amount": 101,
"participants": "[BobAddr]",
"winner": "BobAddr",
"rules": "BlaBlaBla",
"expiration": 7000000
}
5 - So the next players can do the same and even Bob can send more ALGO to keep his account as the current winner.
How can I proper handle this data set/get workflow?
PS1: I know that the game is dummy!
PS2: Maybe I’m still to biased with Ethereum’s Solidity…