-
Notifications
You must be signed in to change notification settings - Fork 470
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
Signing Transactions Offline #116
Comments
EDITED Been interested in having this functionality since I came across the web3 crate. We could implement |
The output of |
Most likely integrate with https://github.com/tomusdrw/ethsign |
We used ethsign with web3 indirectly -- in https://github.com/SubstratumNetwork/SubstratumNode -- but had to copy RawTransaction to work around type conflicts between web3::types, ethereum-types, and primitive-types. |
@steveswing cool! Yeah, there is no proper transaction type around (except for parity repo, but you really don't want to reference that in your code). I also wanted to avoid it in ethsign (initially), but would be happpy to include it at some point, along with different signature payloads that Ethereum is using (signData, signTransaction, etc)). |
This PR introduces functionality to sign transactions by the driver in rust before submitting them to the ethereum client. This is needed to deploy our system on rinkeby and mainnet since there we don't have "unlocked" clients (such as ganache for testing). Therefore our transactions are rejected as invalid. Unfortunately our rust web3 library didn't have built in support for this (there is an open issue but not yet an implementation tomusdrw/rust-web3#116). With this change, we now provide the network id and private key in our env file and sign the raw transaction using the `ethereum-tx-sign` library. This will make the system work with both unlocked and locked accounts. ### Test Plan In common.env set `NETWORK_ID` to 4, `PRIVATE_KEY` to your rinkeby eth funded account's pk, `STABLEX_CONTRACT_ADDRESS` to `0x9046451F7cF124c1d7d1832F76F5e98a33D1610E` `docker-compose up` Then use the truffle scripts to add tokens, deposits and orders (note that you will have to make a trade happen for the driver to actually send a transaction). Alternatively, you can remove this if check https://github.com/gnosis/dex-services/blob/89448372eab3a860ecdf673607acbf54f05d4d0f/driver/src/driver/stablex_driver.rs#L42 to make it also submit trivial solutions. See transaction going through successfully.
Support for signing transactions offline for sending to a locked node or potentially Infura would be extremely helpful. Similar functionality can be found in the
ethereumjs-tx
for javascript. Much of this functionality exists across the parity codebase and needs to be pieced together. In discussing this with @tomusdrw, the general steps required would be:ethabi
)ethkey
library)The text was updated successfully, but these errors were encountered: