rust-web3
rust-web3 copied to clipboard
Bypass self.web3().eth() request to sign transactions
Hi!
I am building a backend service responsible for just the signature stuff. The idea is to have a service that is responsible only for preparing and signing the trx. There will be another service responsible for sending the trx. This separation of concerns is due to some security and scalability concerns we have.
we have used this great library before and I think we can use it for this specific use case.
This is how we are using the library in a simpler solution:
let signed_transaction = client
.web3
.accounts()
.sign_transaction(transaction, &key)
.wait()
.map_err(|e| error_handler(e))?;
We need pretty much the functionality of Accounts::sign_transaction, however, it forces us to construct a web3 client that can potentially initiate a request if nonce, gas price or chain id are not included, something that by design will always be included in our service.
But this service has no way to communicate with the chain since for security concerns we want to keep it isolated from the rest of the network. In other words, the service can´t build the web3 client.
I wonder if there is a way to completely skip the web3 client and consume just the signing module.
I´ll really appreciate your guidance and help. Thank you very much!
Indeed. These added calls significantly slow down the signing. Even web3py is 50 times faster