ERC721: How to get the owned tokens of an addressERC721 ownedTokens array length limitations on owners with thousands of tokensHow to know which ERC20 tokens a wallet owns?List ERC721 tokens owned by a user on a web pageProper way to implement “buyable” ERC721 tokensHow do ERC721 tokens get created on private blockchain?How can there be a balance for an ERC721 contract?Two ERC721 tokens that refer to the same metadataGet ERC721 token total supply using web3.jsWhat is the difference between the transfer and transferFrom function in an ERC721 contractDeploy ERC721 tokens to many addresses

SQL PRINT vs SQL EXEC

categorizing a variable turns it from insignificant to significant

Air travel with refrigerated insulin

How can an organ that provides biological immortality be unable to regenerate?

Animal R'aim of the midrash

Naïve RSA decryption in Python

Why is the intercept typed in as a 1 in stats packages (R, python)

Friend wants my recommendation but I don't want to give it to him

Can "few" be used as a subject? If so, what is the rule?

What is it called when someone votes for an option that's not their first choice?

How do researchers send unsolicited emails asking for feedback on their works?

Animating wave motion in water

Would mining huge amounts of resources on the Moon change its orbit?

Pre-Employment Background Check With Consent For Future Checks

What should be the ideal length of sentences in a blog post for ease of reading?

Do native speakers use "ultima" and "proxima" frequently in spoken English?

Have any astronauts/cosmonauts died in space?

When should a starting writer get his own webpage?

How to find the largest number(s) in a list of elements, possibly non-unique?

Which partition to make active?

Unfrosted light bulb

How do you justify more code being written by following clean code practices?

Creating points with attributes from coordinates in ArcPy

How to test the sharpness of a knife?



ERC721: How to get the owned tokens of an address


ERC721 ownedTokens array length limitations on owners with thousands of tokensHow to know which ERC20 tokens a wallet owns?List ERC721 tokens owned by a user on a web pageProper way to implement “buyable” ERC721 tokensHow do ERC721 tokens get created on private blockchain?How can there be a balance for an ERC721 contract?Two ERC721 tokens that refer to the same metadataGet ERC721 token total supply using web3.jsWhat is the difference between the transfer and transferFrom function in an ERC721 contractDeploy ERC721 tokens to many addresses













3















There is a balanceOf function, but it only displays one uint (the token identifier)
I see most ERC721 tokens doing this so I am confused on how to view all owned tokens.










share|improve this question


























    3















    There is a balanceOf function, but it only displays one uint (the token identifier)
    I see most ERC721 tokens doing this so I am confused on how to view all owned tokens.










    share|improve this question
























      3












      3








      3








      There is a balanceOf function, but it only displays one uint (the token identifier)
      I see most ERC721 tokens doing this so I am confused on how to view all owned tokens.










      share|improve this question














      There is a balanceOf function, but it only displays one uint (the token identifier)
      I see most ERC721 tokens doing this so I am confused on how to view all owned tokens.







      solidity web3js erc-721






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      BlockchainBoyBlockchainBoy

      506




      506




















          3 Answers
          3






          active

          oldest

          votes


















          3














          Per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md, there's an optional "enumeration extension". If this is implemented for the token you're interested in, then you can just call balanceOf to get the number of tokens owned by the account, followed by tokenOfOwnerByIndex in a loop to get each owned token ID.



          If it isn't implemented, then there's no well-defined way to discover all of a user's owned tokens, but there may be a non-standard way to do it for the specific token you're interested in.






          share|improve this answer

























          • This is the correct answer, the enumerable extension was created explicitly for this purpose. The only correction is that it's tokenOfOwnerByIndex not byAddress.

            – AnAllergyToAnalogy
            2 days ago











          • Thanks for the correction! I edited my answer.

            – smarx
            2 days ago











          • Cheers for the help :)

            – BlockchainBoy
            2 days ago


















          2














          The function balanceOf actually returns the number of owned tokens and not the identifier of an owned token.



          Therefore I'd assume the process could go something like this:



          1) Find out how many tokens an address has (balanceOf). If this is more than zero, continue the process.



          2) Find out which tokens exist in the contract. The standard offers no direct functionality for this so this depends on the implementation. Or, as is probably the case, simply start enumerating from zero upwards hoping that the tokens are enumerable in that way (and not assigned for example to random numbers). So you would check "does someone own token 0? does someone own token 1? .."



          3) Once you have found all the tokens owned by the address you can stop the process.






          share|improve this answer


















          • 1





            See also my answer. I believe most tokens implement the optional "enumeration extension" which does allow for efficiently finding a user's tokens.

            – smarx
            2 days ago











          • Thanks for the heads-up :)

            – Lauri Peltonen
            2 days ago


















          1














          There is basically no way to easily view all owned tokens. My Ethereum wallets own probably lots of random worthless tokens which someone has airdropped and I don't even know about it.



          Some services (wallets) display many of the owned tokens. I'm unsure how exactly they do that but most likely they simply have a database of known token contracts and they check whether a certain address owns those known tokens.



          If I now created a new token and donated some of it to random wallets nobody would probably know about it unless I somehow tell wallet creators "please include my token contract in your checks".



          At least myetherwallet used to display all (known) ERC20 tokens still about a year ago but the quickly they gave up and last I checked you had to manually enter the contract address to see those tokens. The amount of different token contracts exploded a year ago and it was probably too much hassle to try to keep track of them (to store them all in their database).






          share|improve this answer























          • I am looking at a specific token, I don't see a easy way to check this from the token's contract

            – BlockchainBoy
            2 days ago











          • Ah, sorry, I had misunderstood the question. My answer is not so relevant in that case.

            – Lauri Peltonen
            2 days ago










          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "642"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f68438%2ferc721-how-to-get-the-owned-tokens-of-an-address%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          Per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md, there's an optional "enumeration extension". If this is implemented for the token you're interested in, then you can just call balanceOf to get the number of tokens owned by the account, followed by tokenOfOwnerByIndex in a loop to get each owned token ID.



          If it isn't implemented, then there's no well-defined way to discover all of a user's owned tokens, but there may be a non-standard way to do it for the specific token you're interested in.






          share|improve this answer

























          • This is the correct answer, the enumerable extension was created explicitly for this purpose. The only correction is that it's tokenOfOwnerByIndex not byAddress.

            – AnAllergyToAnalogy
            2 days ago











          • Thanks for the correction! I edited my answer.

            – smarx
            2 days ago











          • Cheers for the help :)

            – BlockchainBoy
            2 days ago















          3














          Per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md, there's an optional "enumeration extension". If this is implemented for the token you're interested in, then you can just call balanceOf to get the number of tokens owned by the account, followed by tokenOfOwnerByIndex in a loop to get each owned token ID.



          If it isn't implemented, then there's no well-defined way to discover all of a user's owned tokens, but there may be a non-standard way to do it for the specific token you're interested in.






          share|improve this answer

























          • This is the correct answer, the enumerable extension was created explicitly for this purpose. The only correction is that it's tokenOfOwnerByIndex not byAddress.

            – AnAllergyToAnalogy
            2 days ago











          • Thanks for the correction! I edited my answer.

            – smarx
            2 days ago











          • Cheers for the help :)

            – BlockchainBoy
            2 days ago













          3












          3








          3







          Per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md, there's an optional "enumeration extension". If this is implemented for the token you're interested in, then you can just call balanceOf to get the number of tokens owned by the account, followed by tokenOfOwnerByIndex in a loop to get each owned token ID.



          If it isn't implemented, then there's no well-defined way to discover all of a user's owned tokens, but there may be a non-standard way to do it for the specific token you're interested in.






          share|improve this answer















          Per https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md, there's an optional "enumeration extension". If this is implemented for the token you're interested in, then you can just call balanceOf to get the number of tokens owned by the account, followed by tokenOfOwnerByIndex in a loop to get each owned token ID.



          If it isn't implemented, then there's no well-defined way to discover all of a user's owned tokens, but there may be a non-standard way to do it for the specific token you're interested in.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered 2 days ago









          smarxsmarx

          19.2k1719




          19.2k1719












          • This is the correct answer, the enumerable extension was created explicitly for this purpose. The only correction is that it's tokenOfOwnerByIndex not byAddress.

            – AnAllergyToAnalogy
            2 days ago











          • Thanks for the correction! I edited my answer.

            – smarx
            2 days ago











          • Cheers for the help :)

            – BlockchainBoy
            2 days ago

















          • This is the correct answer, the enumerable extension was created explicitly for this purpose. The only correction is that it's tokenOfOwnerByIndex not byAddress.

            – AnAllergyToAnalogy
            2 days ago











          • Thanks for the correction! I edited my answer.

            – smarx
            2 days ago











          • Cheers for the help :)

            – BlockchainBoy
            2 days ago
















          This is the correct answer, the enumerable extension was created explicitly for this purpose. The only correction is that it's tokenOfOwnerByIndex not byAddress.

          – AnAllergyToAnalogy
          2 days ago





          This is the correct answer, the enumerable extension was created explicitly for this purpose. The only correction is that it's tokenOfOwnerByIndex not byAddress.

          – AnAllergyToAnalogy
          2 days ago













          Thanks for the correction! I edited my answer.

          – smarx
          2 days ago





          Thanks for the correction! I edited my answer.

          – smarx
          2 days ago













          Cheers for the help :)

          – BlockchainBoy
          2 days ago





          Cheers for the help :)

          – BlockchainBoy
          2 days ago











          2














          The function balanceOf actually returns the number of owned tokens and not the identifier of an owned token.



          Therefore I'd assume the process could go something like this:



          1) Find out how many tokens an address has (balanceOf). If this is more than zero, continue the process.



          2) Find out which tokens exist in the contract. The standard offers no direct functionality for this so this depends on the implementation. Or, as is probably the case, simply start enumerating from zero upwards hoping that the tokens are enumerable in that way (and not assigned for example to random numbers). So you would check "does someone own token 0? does someone own token 1? .."



          3) Once you have found all the tokens owned by the address you can stop the process.






          share|improve this answer


















          • 1





            See also my answer. I believe most tokens implement the optional "enumeration extension" which does allow for efficiently finding a user's tokens.

            – smarx
            2 days ago











          • Thanks for the heads-up :)

            – Lauri Peltonen
            2 days ago















          2














          The function balanceOf actually returns the number of owned tokens and not the identifier of an owned token.



          Therefore I'd assume the process could go something like this:



          1) Find out how many tokens an address has (balanceOf). If this is more than zero, continue the process.



          2) Find out which tokens exist in the contract. The standard offers no direct functionality for this so this depends on the implementation. Or, as is probably the case, simply start enumerating from zero upwards hoping that the tokens are enumerable in that way (and not assigned for example to random numbers). So you would check "does someone own token 0? does someone own token 1? .."



          3) Once you have found all the tokens owned by the address you can stop the process.






          share|improve this answer


















          • 1





            See also my answer. I believe most tokens implement the optional "enumeration extension" which does allow for efficiently finding a user's tokens.

            – smarx
            2 days ago











          • Thanks for the heads-up :)

            – Lauri Peltonen
            2 days ago













          2












          2








          2







          The function balanceOf actually returns the number of owned tokens and not the identifier of an owned token.



          Therefore I'd assume the process could go something like this:



          1) Find out how many tokens an address has (balanceOf). If this is more than zero, continue the process.



          2) Find out which tokens exist in the contract. The standard offers no direct functionality for this so this depends on the implementation. Or, as is probably the case, simply start enumerating from zero upwards hoping that the tokens are enumerable in that way (and not assigned for example to random numbers). So you would check "does someone own token 0? does someone own token 1? .."



          3) Once you have found all the tokens owned by the address you can stop the process.






          share|improve this answer













          The function balanceOf actually returns the number of owned tokens and not the identifier of an owned token.



          Therefore I'd assume the process could go something like this:



          1) Find out how many tokens an address has (balanceOf). If this is more than zero, continue the process.



          2) Find out which tokens exist in the contract. The standard offers no direct functionality for this so this depends on the implementation. Or, as is probably the case, simply start enumerating from zero upwards hoping that the tokens are enumerable in that way (and not assigned for example to random numbers). So you would check "does someone own token 0? does someone own token 1? .."



          3) Once you have found all the tokens owned by the address you can stop the process.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          Lauri PeltonenLauri Peltonen

          5,8382525




          5,8382525







          • 1





            See also my answer. I believe most tokens implement the optional "enumeration extension" which does allow for efficiently finding a user's tokens.

            – smarx
            2 days ago











          • Thanks for the heads-up :)

            – Lauri Peltonen
            2 days ago












          • 1





            See also my answer. I believe most tokens implement the optional "enumeration extension" which does allow for efficiently finding a user's tokens.

            – smarx
            2 days ago











          • Thanks for the heads-up :)

            – Lauri Peltonen
            2 days ago







          1




          1





          See also my answer. I believe most tokens implement the optional "enumeration extension" which does allow for efficiently finding a user's tokens.

          – smarx
          2 days ago





          See also my answer. I believe most tokens implement the optional "enumeration extension" which does allow for efficiently finding a user's tokens.

          – smarx
          2 days ago













          Thanks for the heads-up :)

          – Lauri Peltonen
          2 days ago





          Thanks for the heads-up :)

          – Lauri Peltonen
          2 days ago











          1














          There is basically no way to easily view all owned tokens. My Ethereum wallets own probably lots of random worthless tokens which someone has airdropped and I don't even know about it.



          Some services (wallets) display many of the owned tokens. I'm unsure how exactly they do that but most likely they simply have a database of known token contracts and they check whether a certain address owns those known tokens.



          If I now created a new token and donated some of it to random wallets nobody would probably know about it unless I somehow tell wallet creators "please include my token contract in your checks".



          At least myetherwallet used to display all (known) ERC20 tokens still about a year ago but the quickly they gave up and last I checked you had to manually enter the contract address to see those tokens. The amount of different token contracts exploded a year ago and it was probably too much hassle to try to keep track of them (to store them all in their database).






          share|improve this answer























          • I am looking at a specific token, I don't see a easy way to check this from the token's contract

            – BlockchainBoy
            2 days ago











          • Ah, sorry, I had misunderstood the question. My answer is not so relevant in that case.

            – Lauri Peltonen
            2 days ago















          1














          There is basically no way to easily view all owned tokens. My Ethereum wallets own probably lots of random worthless tokens which someone has airdropped and I don't even know about it.



          Some services (wallets) display many of the owned tokens. I'm unsure how exactly they do that but most likely they simply have a database of known token contracts and they check whether a certain address owns those known tokens.



          If I now created a new token and donated some of it to random wallets nobody would probably know about it unless I somehow tell wallet creators "please include my token contract in your checks".



          At least myetherwallet used to display all (known) ERC20 tokens still about a year ago but the quickly they gave up and last I checked you had to manually enter the contract address to see those tokens. The amount of different token contracts exploded a year ago and it was probably too much hassle to try to keep track of them (to store them all in their database).






          share|improve this answer























          • I am looking at a specific token, I don't see a easy way to check this from the token's contract

            – BlockchainBoy
            2 days ago











          • Ah, sorry, I had misunderstood the question. My answer is not so relevant in that case.

            – Lauri Peltonen
            2 days ago













          1












          1








          1







          There is basically no way to easily view all owned tokens. My Ethereum wallets own probably lots of random worthless tokens which someone has airdropped and I don't even know about it.



          Some services (wallets) display many of the owned tokens. I'm unsure how exactly they do that but most likely they simply have a database of known token contracts and they check whether a certain address owns those known tokens.



          If I now created a new token and donated some of it to random wallets nobody would probably know about it unless I somehow tell wallet creators "please include my token contract in your checks".



          At least myetherwallet used to display all (known) ERC20 tokens still about a year ago but the quickly they gave up and last I checked you had to manually enter the contract address to see those tokens. The amount of different token contracts exploded a year ago and it was probably too much hassle to try to keep track of them (to store them all in their database).






          share|improve this answer













          There is basically no way to easily view all owned tokens. My Ethereum wallets own probably lots of random worthless tokens which someone has airdropped and I don't even know about it.



          Some services (wallets) display many of the owned tokens. I'm unsure how exactly they do that but most likely they simply have a database of known token contracts and they check whether a certain address owns those known tokens.



          If I now created a new token and donated some of it to random wallets nobody would probably know about it unless I somehow tell wallet creators "please include my token contract in your checks".



          At least myetherwallet used to display all (known) ERC20 tokens still about a year ago but the quickly they gave up and last I checked you had to manually enter the contract address to see those tokens. The amount of different token contracts exploded a year ago and it was probably too much hassle to try to keep track of them (to store them all in their database).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          Lauri PeltonenLauri Peltonen

          5,8382525




          5,8382525












          • I am looking at a specific token, I don't see a easy way to check this from the token's contract

            – BlockchainBoy
            2 days ago











          • Ah, sorry, I had misunderstood the question. My answer is not so relevant in that case.

            – Lauri Peltonen
            2 days ago

















          • I am looking at a specific token, I don't see a easy way to check this from the token's contract

            – BlockchainBoy
            2 days ago











          • Ah, sorry, I had misunderstood the question. My answer is not so relevant in that case.

            – Lauri Peltonen
            2 days ago
















          I am looking at a specific token, I don't see a easy way to check this from the token's contract

          – BlockchainBoy
          2 days ago





          I am looking at a specific token, I don't see a easy way to check this from the token's contract

          – BlockchainBoy
          2 days ago













          Ah, sorry, I had misunderstood the question. My answer is not so relevant in that case.

          – Lauri Peltonen
          2 days ago





          Ah, sorry, I had misunderstood the question. My answer is not so relevant in that case.

          – Lauri Peltonen
          2 days ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Ethereum Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f68438%2ferc721-how-to-get-the-owned-tokens-of-an-address%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

          Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?