How can we get transaction information

ho we can get ETH transaction (which is shown on etherscan.io) result in VS code, and print it.

you can use this:
https://docs.moralis.io/moralis-dapp/web3-api/native#gettransaction-new

but here I need to give the transaction hash, but I don’t have it.
I just want to store the information of transaction that is from, to, hash code, block number in my database i.e. Mongo

for what transactions you want to store that info?

I did transaction using metamask, and when I view on etherscan it is visible. But the same information
I want to store in database as backend programming.

so you know at least your wallet address?
in that case you can list the transactions for that address:
https://docs.moralis.io/moralis-dapp/web3-api/account#gettransactions

my transaction is on etherscan.io, so will moralis getTransaction will help me to get data in VS code.

that is a question? how do you find the transaction in etherscan? there are a lot of transactions there

what is specific to VS code?

I have my Tx Hash, with help of this i can fid my tx in etherscan

here I had the impression that you said that you don’t have the transaction hash

to check on etherscan we can use that tx hash.
But when we want data in node.js then we can’t use tx hash, it should be saved on it’s own

what is the information that you know about that transaction?

I know everything, but I don’t want to use anything from this information to store data.
When transaction takes place it should store on it’s own in Mongo.

you mean in Moralis Server db? you have to add an address to watch address for that to happen, or to be authenticated with that wallet address

  1. I have run a code in solidity, then I minted a NFT and did the transaction using metamask.

  2. After successful transaction I got transaction receipt in Remix terminal.

  3. Now I want that same information in my MongoDB.

then what can I do ?

you can sync the events specific to that mint

https://docs.moralis.io/moralis-dapp/automatic-transaction-sync/smart-contract-events

I am using sync, but after sync I am only able to create table in database, but not able to fetch the transaction

Can you check if there are any errors in the database logs which are related to the event sync.

As UI interface has changes I am not able to open the database for the server created.

If you open the server settings you can find the option here.

You can also use the legacy UI if you still can’t open it.

1 Like