I want to be able to archive this:

  • a private key or its substitute (P) of a user wallet is stored on a server

  • there're 100s of user wallets there, hence 100s of (P) too

  • server isn't a safe environment, as it's known

  • there's also a main, admin wallet (M), in cold, local storage

  • (P) must only be used to send outbound TXs to (M). Not anywhere else

This can't be achived with a normal private key, right? But how, if at all, it can be archived? Multisignature wallets?

The goal is automate withdrawals from the user wallets on a server, to make the process safer.

I don't consider any third-party solutions.


pre-signing TXs: this would work.

What I need to is

  • a) withdraw all the coins from the user wallets automatically, by a web app

  • b) it may occur once a day, week... month, or once a wallet reaches a certain shrehold.

  • c) and do so without having to keep their private keys on a server

But pre-signing TXs will require to know the gas price in advance too? Which changes all the time.

1 Answer 1


Private keys are used to sign a hashed version of a transaction, making it impossible to use mathematical tricks to limit to sign for a specific recipient. However, here are some scenarios that might be helpful:

  • If you can foresee the transactions coming from wallet P before you send them, you can sign all potential transfers in a secure setting. Instead of storing the private key on a server, you can keep the signed transactions on the server and send them when necessary.

  • If all your assets exist in the form of ERC20 tokens, you can employ the Approve mechanism to allow access to ERC20 tokens from wallet P to a smart contract, and set up the smart contract to send tokens only to wallet M. For the native coin, it's possible to store them in the smart contract rather than in wallet P.

  • 1) Interesting. How? Doesn't signing a TX include a) timestamp as "utc_now()", b) amount to be sent? I can't know both in advance. Although (a) could be guessed; (b) will always be "total amount in a wallet/account" Oct 27, 2023 at 14:11
  • there's also c) nonce Oct 27, 2023 at 14:16
  • I don't believe we have to include information about UTC time or the total amount in the transaction. What really matters here are the nonce and value/amounts. To clarify, you can sign multiple transactions for the next 3 nonce and choosing from 100 different possible amounts. This means you need to create 300 transactions in total.
    – Ehsan
    Oct 27, 2023 at 15:37
  • I might not have fully grasped your issue. Are you trying to send all the money from P to wallet M? If that's the case, using a pre-signed transaction idea could leave a tiny bit of money in the wallet. The more transactions you sign, the less small leftover money you'll have.
    – Ehsan
    Oct 27, 2023 at 15:43
  • updated my question; But how about the gas price, for instance? It's a variable Oct 27, 2023 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.