I want to be able to achive this:

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

  • there're 100s of user wallets there, so there're 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.

1 Answer 1


Your objectives are valid and you've correctly identified storing private keys on a server as a security risk.

A more appropriate solution might be to write a simple solana program (smart contract) whose data structures include a single PDA escrow account per withdrawal wallet. Your on-chain logic can then ensure that the withdrawals can only be withdrawn from a particular escrow into a single, well-defined target wallet.

Pretty much all DEXes and custodial NFT staking platforms do something similar in their contracts when handling their customers' tokens.

Rather than storing a bunch of private keys (bit of an anti-pattern in web3), you will save yourself a lot of headache and operational overhead by going down the solana program route.

Unless you're operating a CEX and are able to deal with all the safety requirements associated with a custodial solution, an on-chain program is probably a more appropriate solution.

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.