2

I want to lock an account to a specific Smart contract. So that the account will allow only the transactions from this specific smart contract. If some other smart contract tries to interact with this account, it will not be able to. How can I do this?

enter image description here

I got this doubt based on the Zether paper (screenshots attached) in which it is given that we can lock an account to a contract.

4
  • Transactions don't come from smart contracts. They only come from "users" (EOAs) Commented Apr 5, 2023 at 18:56
  • Also, when I send you some tokens or NFTs, I am not interacting with your account. At all. Commented Apr 5, 2023 at 18:57
  • Why don't you just inverse, and only allow an account to interact with a contract?
    – johnny 5
    Commented Apr 5, 2023 at 20:44
  • If you really want this functionality use an onchain wallet solution like gnosis
    – johnny 5
    Commented Apr 5, 2023 at 20:44

1 Answer 1

3

Unfortunately, you can't directly "lock" an EOA (External Owned Account) to only interact with a specific smart contract, as it's not a built-in feature of EVM.

However, you can design a proxy contract that will interact only with a specific address or contract. But still you can't prevent someone to interact with you (e.g, sending ERC20 tokens, NFTs, etc.)

9
  • Okay, I got this. But, I have edited my question - with reference to a paper from where i got this doubt. Commented Apr 7, 2023 at 8:56
  • May I please know the answer for my updated (modified) question? Commented Apr 13, 2023 at 15:05
  • You can't stop others from sending tokens to your account or adding your address to their smart contracts. Similarly, I can't prevent anyone from using my name in their app, Excel sheet, or any doc. Zether doesn't change this because it focuses on confidentiality and doesn't modify the core smart contract functionality. For example, if you use Zether for confidential transactions, your account balances and transfers will be encrypted, but the account locking mechanism remains the same, using a proxy contract to control access.
    – Adam Boudj
    Commented Apr 13, 2023 at 18:19
  • @GPavithra Zether will just make sure that your contract is allowed to interact with specific contracts and EOA, but it can't prevent contracts to interact with you. To simplify you can prevent with whom your interacting but not who's interacting with you
    – Adam Boudj
    Commented Apr 13, 2023 at 18:21
  • Okay, is it like this? Commented Apr 14, 2023 at 8:48

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.