Closed kikipluche closed 6 years ago
When a user loses connection before txHash has been received, there is no sign of a pending transaction in his txHistory. There is a risk the user will repeat the same transaction, not knowing that his previous one DID get sent to the mempool.
Maybe we can think about limiting the shortcode to single usage? Once the API makes a transaction to that shortcode, enfore the creation of a new one?
Update:
Exposing the user to the terminology TxHash on the transaction-progressing-page with text such as 'Received TXhash' and 'Something went wrong, no TXhash was received.' I feel is going against the intention "to not bother users with blockchain-jargon (public keys etc.)"
The 30 second timeout presents the possibility for the user to make a transaction, sign it, send it, wait more than 30 seconds and not get a txHash back, the user will then feel that the transaction didn't go through and may make a second transaction, when in fact the first transaction did complete.
we will review the 30 seconds and review the copy, maybe change to "this is taking longer than expected" => to be discussed.
Update: we will first test this version, if this error message leads to wrong behaviour, we can iterate and change.
TxHash will stay like this, for this iteration. Losing connection and the edge case people doing a transaction twice is to be seen during testing, we will take this matter in a general epic about logging.
19/3: This epic is clear for dev, ready for execution
In the abstract, you detail " I need the address" who is the I? Is it the API?
The text reads "Something went wrong, no TXhash was received." I still feel this is contrary to the abstract where this is stated "to not bother users with blockchain-jargon (public keys etc.)"
I feel this is a core piece of functionality, the abstract also states "to make doing a transaction in Swarm City fool-proof" The 30 seconds I still feel is a shortcut and we should fully solve this before introducing possibilities for errors to fail to the code base.
@bkawk In the epic, we read
The generated code is single-use , we never will re-use a shortcode. Not when it expires , and not when the request was canceled.
I suggest that the stakeholders expand on this point that once a shortCode has been used, the API disables it. This would effectively avoid having a user send the same transaction multiple times if he doesn't get succes notification on the first try.
@kikipluche we need clarification on this or we will start guessing: either we delete the
or we clarify in the description as Xardas describes it for - to make doing a transaction in Swarm City fool-proof
@bkawk about the 30 seconds, i understand your hesitation, but can we agree to build the simplest version first, so whatever went wrong, after 30sec the user gets the error page and goes back to the wallet view. When we get feedback when testing that the transaction did go through, but something went wrong in giving back the TXhash, we can iterate on this issue. But for now, we keep it as simple as this.
I agree with @xardass that we just need that one point expanding on.
@kikipluche I feel the statements we make should be true, or they should be removed
Thank you all for these great comments!
I changed these things:
data: {
address: "0xabc...",
userName: "swarm citizen",
avatar: <String> // base64
}
What about the single-use shortcode (see my question above)? Can we understand this as disabling the shortcode once it has been used for a transaction? This would effectively make it foolproof.
@xardass
My suggestion is to change:
Abstract:
In order to send SWT in Swarm City on Rinkeby, the sender needs the address, the userName and the avatar of the receiver. For this, we use the concept of shortCode. We use this concept for 3 reasons:
How it works:
The receiver shares his shortcode with the sender offline (e.g. by phone, or in real life). The sender taps the 'send-SWT'-button and enters an amount and a shortcode of the receiver in the first view of the send-flow. When submitting, an API call is made. The shortcode is sent to the API, the API returns the public key, the username and the avatar (after resolving the ipfsHash)
The username is displayed, along with the avatar image. The sender confirms the identity of the receiver. The sender then confirms the total transaction (= amount and receiver). When confirming, a transaction is created on the sender's client. The sender signs this transaction. The signed transaction is sent to the API service "sendSignedTransaction".
A green progress screen is shown. The user can continue as soon as the transactionHash is received. This screen has a timeout of 30 seconds - meaning if a transactionHash is not received in 30 seconds, the green screen will show an error and the user can return to the wallet view.
When successful, the journey ends at the wallet-view, where a new historyItem is seen in the transactionHistory.
The generated code is single-use , we never will re-use a shortcode. Not when it expires , and not when the request was canceled.
Jobs:
N/a
API:
readShortCode
A function
readShortCode
that returns the user data for the given shortcode.emit : readShortCode data:
This function returns the payload that was attached to this shortcode - if it exists and didn't yet expire. the return code for the data will be 200.
response on success:
response on failure:
If the shortcode is not a valid shortcode, the API will return a 400 response code. The user data is not returned.
replyShortCode
A socket handler that accepts the shortcode a signed transaction and puts it in the transaction pool.
emit : replyShortCode data:
response on success:
response on server error:
API Documentation
Internally the tx is just delivered to the transaction pool , and wraps around the
sendSignedTransaction
callReference of server code : https://github.com/swarmcity/SwarmCityAPI/blob/master/src/functions/SendRawTxFunction.js
Example usage on client: https://github.com/swarmcity/SwarmCityAPI/blob/master/test/testSendRawTx.js#L34-L41
Socket cheatsheet https://socket.io/docs/emit-cheatsheet/
What it looks like in front end:
route: /my-wallet
In the wallet-view, we see the 'send SWT'-button in the middle of the page, above the 'shortcode'-button.
When the user taps the 'send SWT'-button, the middle part of the page changes: the two buttons disappear, and first view of the send-flow appears.
First view:
The first view of the send-flow contains:
When the x-mark is tapped, the flow is cancelled: this makes the default view appear again in the middle of the page (= 2 buttons).
The big white button is disabled until the values of both inputfields are valid:
When the big white button is enabled, the user can tap to submit the values and go to the second view.
Second view:
The second view of the send-flow contains:
There is a timeout of 30 seconds on this view - when there's no response, the view changes to third view - errorstate.
When the receiver is found, the view changes to third view - normalstate.
When the user taps the blue X-mark (cancel-button), the whole process is aborted.
Third view - normalstate:
The third view of the send-flow contains:
When the user taps the big white button with next-icon, he confirms the receiver, and the page changes to the confirm-sending-page.
When the user taps the blue X-mark (cancel-button), the whole process is aborted.
Third view - errorstate:
The third view - errorstate of the send-flow contains:
When the user taps the blue X-mark (cancel-button), the whole process is aborted.
confirm-sending-page
The confirm-sending-page contains:
When the user taps the black X-mark (cancel-button), the whole process is aborted.
When the user taps the big white button with blue V-mark, he confirms the transaction, triggering the password-unlock for signing this transaction.
confirm-sending-page (with password-unlock)
The password-unlock is an overlay on the page it is on. It contains:
When the user taps the black X-mark (cancel-button), the password-unlock dissappears, showing the page below as she was.
The big white button with blue V-mark is disabled until it contains 1 character. When it is enabled, and the user taps it, he signs the transaction. The signed transaction is sent to the API. The page changes to transaction-progress-page.
transaction-progress-page
The transaction-process-page contains:
When entering the page, the big white button with black next-icon is disabled. When the transactionHash is received (making the white dots turn into the white V), the button is enabled.
When the user taps this button, the page changes back to wallet-view, ending the send-flow (resulting in a new historyItem).
transaction-progress-page (error) The transaction-progressing-page (error) contains:
When in this view, the process of sending has failed (because no transactionHash was received). Tapping the big white button with black prev-icon, will lead the user back to the wallet-view.
Documentation / references
N/a
♡