[Question] How to get the address of redirected transaction #1704
Replies: 13 comments
-
See #977 :) |
Beta Was this translation helpful? Give feedback.
-
@zemse thanks, I figured that the data of the Tx will give me the the variables I need. I cannot access to those redirected transactions. But the addess is one of the variables that the function is asking, so I just decode the data and it gives me the _to, _amount and _comision variables; that works for me. Tranks for the response. |
Beta Was this translation helpful? Give feedback.
-
That is a nice trick that works with this function! However, watchout for the case in which a transaction is reverted. In that you'd get the tx mined (enabling you to decode tx) but state would be reverted (in actuality no funds were transferred). You can check if tx was success in the tx receipt. If you're on testnet (you can change the solidity code), you can instead add events, which would make your life more easier. If tx reverts then events are also not emitted. |
Beta Was this translation helpful? Give feedback.
-
@zemse If a transaction is reverted, Etherscan will not give me that tx in the history, is't it? |
Beta Was this translation helpful? Give feedback.
-
I found another posible problem, lets say: Account1 makes a transaction to the contract function that is redirected to Account2 If I want to get the history of Account1 I just ask the etherscanProvider and iterate the array of txs to decode all transactions that are make to the contract address, that way I get the address of Account2 in the txs. But if I want to get the history of Account2, a redirected transaction from the contract doesnt appear in the history of Account2, so it seems that the balance just increment but there is no record of receiving a transaction in the Account2 history. How can I get that tx from Account2? |
Beta Was this translation helpful? Give feedback.
-
I see reverted transactions in the EtherScan UI https://rinkeby.etherscan.io/address/0x08D85Bd1004E3e674042EAddF81Fb3beb4853a22 So I suppose you might get them in your API call. Probably, they might also be including a parameter that tells if tx was success or reverted. For the part in which Account2 receives ETH in an internal transaction, I have an example tx that pays test ETH to 3 addresses internally. But on etherscan adress pages of receiptents, you don't see the Ether coming in their account. Did you give a thought to using events? But this is possible only if it's possible to update the solidity code. Else, probalby you might have to go with your trick + checking tx success or not. |
Beta Was this translation helpful? Give feedback.
-
@zemse sorry for the delay in the response, I was working in another project. in the api call to etherscan, I received the transactions that were reverted, but in the response I see nothing that can indicate me that the response was reverted. I'll leave the responses to you to see it: Not reverted: reverted: The thing with the events is that I already deployed the contract. And not only that, that contract is made with the intension that is as cheaper as it can, so adding the events may increase the costs. I don't find a way to get the transactions received internally by a contract operation. except recorring all the history of the contract and parsing the data, but in the time that is really time consuming |
Beta Was this translation helpful? Give feedback.
-
This looks like the transaction object, the execution status of a transaction is available in receipt. You just need to extract every tx hash and query it's receipt like following: const receipt = await providerETH.getTransactionReceipt('0xff6d5e5b2978f9565c2f1862851b34ba728f93895583a918f391a122a1b65050')
receipt.success // is 0 if reverted, is 1 if execution success |
Beta Was this translation helpful? Give feedback.
-
@zemse Okay I understand, thanks. Now what about getting the history of transactions received of an Address that just get some funds from an internal transaction? |
Beta Was this translation helpful? Give feedback.
-
Now reading internal transactions is something that is not standardized in Ethereum's RPC spec. You will need to use some custom rpc calls of some client like |
Beta Was this translation helpful? Give feedback.
-
@zemse okay okay, I thought in another possible answer, what if I store all the transactions in an hexString in my database, that could be possible? and how much would that cost in space? |
Beta Was this translation helpful? Give feedback.
-
Though you could store the transactions in your database (as you get in |
Beta Was this translation helpful? Give feedback.
-
(please feel free to continue the conversation; moving to discussions) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working in a history, I can receive the history of an address from etherscan provider without a problem, but the transactions are going to a contract address, that receive the eth, and redirects it to another address. Something like this:
I need to parse those transactions sended to this contract address and get the address of the redirected transaction (get address _to). How can I do this?
Beta Was this translation helpful? Give feedback.
All reactions