0

I need some temporary addresses in my contract. Is there a secure way to creating public and private key pairs within the contract?

1

1 Answer 1

0

No, it's not possible for a contract to have a private key to some address (well, at least it would be a huge security risk, since all data is public). But there are other ways to accomplish what you wish.

I recommend one of two ways:

  1. store the assets in the original contract. Include logic in that contract about how the assets can be handled, who has access to them and so on

  2. deploy a new contract where you send the assets to. This kind of second asset management contract is often called a vault. In the vault, you can have custom logic which says for example that the original contract has certain access to the assets

3
  • I'm going to send ether to my contact from an external address and send it to another address through the contact that no one has access to except the contact itself. Jan 30, 2022 at 6:38
  • Edited my answer Jan 30, 2022 at 7:21
  • got it! Multiple contract is what i want Jan 31, 2022 at 10:46

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.