0

I am writing a smart contract. This smart contract has declared a mapping(address=>boolean) whitelist. The admin can register users' addresses on this whitelist, and then those users are able to call the functions defined in the smart contract(imaging functions in the smart contract has a modifier that checks if the caller address is in the mapping).

What I want to achieve is that the admin only need to register a user's one address, after that the user is able to call the functions defined in the smart contract from any of the child addresses, assuming the user is using HD wallet.

modifier onlyWhiteListed {
      address parentAddress = *someFunction*(msg.sender)
      require(whitelist[parentAddress]);
      _;
}

Is there any function that can compute the parent address from child addresses? If the extended public key or any public information is needed, I can add variables accordingly, e.g. a mapping(address=>string) from address to its extended public key.

shapeare
  • 4,133
  • 7
  • 28
  • 39

1 Answers1

0

What I want to achieve is that the admin only need to register a user's one address, after that the user is able to call the functions defined in the smart contract from any of the child addresses, assuming the user is using HD wallet.

This is not possible, because addresses are derived from the seed, not from other addresses. The wallet seed is never used to interact with blockchain.

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435