0

I can't get the transactions from a specific wallet provided, it's weird because I can get transactions filtering with the to argument and other arguments but when using from it doesn't. I don't understand why, wallet format and everything looks good. Any suggestion?? Here is the code: (changed the wallet cause I want to stream my own transactions)

const { Alchemy, Network, AlchemySubscription } = require("alchemy-sdk")
const {ethers, FixedNumber} = require("ethers")
const delay = require('delay')
require("dotenv").config()

const ARBI_WS_KEY = process.env.ARBI_WS_KEY

const settings = {
  apiKey: ARBI_WS_KEY, // Replace with your Alchemy API Key
  network: Network.ARB_MAINNET, // Replace with your network
}

const alchemy = new Alchemy(settings)

// Subscription for Alchemy's minedTransactions API
const add = async () => {
    let a = 0
    alchemy.ws.on(
        {
            method: AlchemySubscription.MINED_TRANSACTIONS,
        },
        (tx) => {
            let add0 = String(tx["transaction"]["from"])

            if( add0 == "0xc3EB0ad7d6bdB1Bd7E1fe9FDcf4C136c0Aedfac3"){ 
                console.log(tx["transaction"]["hash"])
            }
        }
    )
}


add()
10
  • is the address in the code (0xc3EB0ad7d6bdB1Bd7E1fe9FDcf4C136c0Aedfac3) the address that you're trying to get the transactions for? Feb 1, 2023 at 20:45
  • Is an example address actually, I tried with others addresses but still its not working. Used also mine and did some simple transactions, wrap/unwrap eth, bought some token but I cant filter transactions using "from" argument. Really dont know what Im missing.
    – Oriok
    Feb 1, 2023 at 23:28
  • I'll try an answer which answers for the address above, and might be relevant to the others - lmk if I need to change something Feb 2, 2023 at 10:30
  • Ok, Im agree with what you provided as an aswer. But I dont understand the last part. Let me put an example I have just tryed: Used same code to try to get all hash transactions that come "from" this 0xfbB26A55a5757326368Ea292fe9678EafAE9970a address. And as you can see in the scan it did many movements like providing liquidity to the token just created in this hash arbiscan.io/tx/… But the code didn't find anything.
    – Oriok
    Feb 2, 2023 at 11:18
  • Are you suggesting with the last paragraph that this is not the way to get the transactions that this address has done then?
    – Oriok
    Feb 2, 2023 at 11:23

1 Answer 1

0

(Clarification: the OP has clarified in comments that the address in the snippet is an example, and that multiple addresses didn't work. I'm still posting this answer in the hopes that it might be relevant across all addresses the OP has tried, and also in the event that it helps others.)

Assuming the address and chain in the code above are the address/chain that you're trying to get transactions from, the reason is somewhat straightforward: the address you have in the code (0xc3EB0ad7d6bdB1Bd7E1fe9FDcf4C136c0Aedfac3) is a contract on Arbitrum. Let's explain this in a bit more detail:

The from field that you're talking about represents the EOA that initiates the transaction. (A useful way of looking at it is who's paying the gas.) A contract has no private key, and at least as of this writing, cannot initiate a transaction. As a result, there are no results when using this address and chain and searching for transactions from it. You can verify this quickly by looking at the Arbiscan link above - all the txs are marked In, none are Out.

The transactions you're getting returned with this address being to are the times other addresses are transacting with the contract. Whatever you're looking may be contained in these transactions.

For example, if you're looking for contracts this contract has called, these calls will (likely) be located in the traces of these transactions. You'd need a way of seeing all of the calls made during the transaction, though. I'm not sure you can get that through this particular API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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