1

If I am using the Web3 library, and I want to fetch a list of all tokens associated with my user account, would I be completely wrong in thinking that I need to use:

const myAccount = new web3.eth.Contract(..

Feeding in my public key and an ABI representing some 'createUserOnEthereum' contract?

Basically, my question here should probably be, when I create a wallet (and then make my first transaction), does the EVM create an 'instance' of my wallet on Ethereum using some kind of 'createUserBasedOnTheirGenereatedPublicKey()' function?

As far as I know, no wallet would ever be recognised if no transaction was ever made (and the EVM would never see my private keys anyway right?)

Thanks!

1

As far as I know, no wallet would ever be recognised if no transaction was ever made

You are right. When a new wallet is created nodes do not know about it until it is involved in a transaction. Once it does, the nodes will save the new account in their local world state trie. There is no smart contract involved for address registration (the accounts are not stored on-chain), it is managed locally by the nodes.

The EVM would never see my private keys anyway right?

Yes. Just the signed transaction is needed.

There is no simple, straightforward way to know all the tokens held by any account. You could however know about the different ERC20s it has using a blockchain explorer like Etherscan.

1
  • Thanks for the response, I did a bit more research on this at the weekend, and see why it is so complicated to get all the NFTs associated. TheGraph might even be a better solution. As far as I understand, the process would need to be: 1. get all existing NFTs ever, 2. filter out transactions I had made from my wallet, 3. get the 'state' of my ownership by replaying just my transactions for each token.
    – timhc22
    Mar 22 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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