-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session key fixes and test #2138
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Implement session keys - guide for app developers | ||
|
||
If the user selects "no-click UX" (or something) when the game starts, do the following: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't a general statement applicable to an app dev out there ... also we have a section for app developers in the ten-documentation repo so we need to add a section there at some point. |
||
|
||
1) call eth_getStorageAt with the address 0x0000000000000000000000000000000000000003 (the other parameters don't matter). This will return the address of the session key. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So what I believe is being said there is that, if you call eth_getStorageAt through the gateway with a 'magic' slot number 0x0000000000000000000000000000000000000003 the gateway will return a session key address? Would you ever want to access this storage slot in a contract e.g. if the contract was transparent and you actually wanted the value stored at this address? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a magic address. Not a magic storage slot. |
||
2) Create a transaction that transfers some eth to this address. (Maybe you ask the user to decide how many moves they want to prepay or something). The user has to sign this in their wallet. Then submit the tx. | ||
3) Once the receipt is received you call eth_getStorageAt with 0x0000000000000000000000000000000000000004 . This means that you tell the gateway to activate the session key. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens on a gateway restart, is the session key and associated funds lost? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sk survives. |
||
4) All the moves made by the user now can be sent with eth_sendRawTransaction or eth_sendTransaction unsigned. They will be signed by the gateway with the session key. | ||
5) When the game is finished create a tx that moves the funds back from the SK to the main address. This will get singed with the SK by the gateeway | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will never be able to totally send the funds from the session key address back to the user address as we can't fully estimate the gas required in TEN, so there will be leakage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah. We'll live with that for now. It will be minimal though |
||
6) Call: eth_getStorageAt with 0x0000000000000000000000000000000000000005 - this deactivates the key. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... with likely albeit small leakage of funds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats this eventsContract? It's not in the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same ... don't see the events contract in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a generic contract. It doesn't really matter for this PR. The idea here is to just send unsigned transactions, and check that they get signed