-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Asynchronous signing #636
Comments
This looks like a good idea, I agree the current What if instead of returning an eth_getResult(idNumber, (err, result) => {
result === {
status: 'pending approval' || 'transmitting to network',
hash: '0x..',
rawTx: '0x..', // why not return the raw tx while we're at it?
}
// true
}) To really flesh out the API, we should define the exact status codes/messages that would be returned by different phases, for cross-client compatibility. Here I'm borrowing transaction states tracked by MetaMask, they're probably similar across clients:
Having written these out, I notice it might also be convenient for developers if this same This way a single transaction-polling loop could provide a developer all the transaction state data that is relevant to them. |
Do the wire protocols already support multiple outstanding RPCs? If they do, I'd argue that it makes more sense to support long running requests at the wire level, rather than to layer a polling-based API on top of it. |
@Arachnid There is many issues you can run into with long running requests (most notably browser timeouts). |
Well, there's a websockets interface, too. And JS clients can set the desired timeout. |
With WebSockets interface it won't survive reconnect or page reload. |
Sure, so these could be optional parameters. Just a thought, it brings this polling spec a little closer to the eventual ideal behavior of a subscription to evolving transaction state. |
i think there's something to be said for minimising the complexity of the RPC so we might not want to provide extraneous (through relevant) data without a decent reason. for optional parameters, one potential landmine is that users and clients may not grasp when they should be made available, leading to different clients providing them in different situations and implementation lock-in/annoyed users. definitely agree on standardising transitions; that said, if we split it out into two independent operations, then it's less of an issue in the RPC - metamask's middleware would be able to recombine as it sees fit. |
There has been no activity on this issue for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review. |
This issue was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment. |
Currently we have one standard API for sending a transaction:
eth_sendTransaction
. This accepts a transaction specification, constructs and signs a "raw" transaction (approving as necessary) and submits it to the network. It returns the hash of the submitted transaction.This API is suboptimal: firstly, it combines a number of different activities. Signing is an operation fundamentally concerning the key-store; network submission merely concerns only the p2p networking subsystem. Secondly, an most importantly, it results in a potentially long RPC since user-approval could be a non-trivial task. Any APIs or logic that assume an RPC will complete in a reasonable period of time will break.
Proposal
Introduce three new APIs and deprecate
eth_sign
,eth_signTransaction
,eth_sendTransaction
.eth_postSignTransaction(tx: TransactionSpec) => id: Number
: Requests the construction and signing oftx
. Returns the unique job identifier.eth_postSignMessage(message: String, from: Address) => id: Number
: Requests the prefixing and signing ofmessage
from identityfrom
. Returns the unique job identifier.eth_getResult(id: Number) => result | error
: Returns the result of the previously requested job of identityid
or an error if the job is not yet completed or resulted in an error.eth_getResult
would also be a subscribable endpoint within a pub/sub API, yet to be standardised.Rationale
Jobs no longer hold up the RPC. Polling is a suboptimal solution, but no different than is currently supported in the
eth_
RPC collection. This would transition well to a pub/sub mechanism (with the ability to subscribe to the result of a given job) when pub/sub becomes widespread and standardised.The text was updated successfully, but these errors were encountered: