Are you looking for an easy way to get wallet transactions using RPC nodes? If so, you’re in the right place. In today’s tutorial, we’ll explore Moralis’ Extended RPC Methods and our eth_getTransactions endpoint, which allows you to fetch any wallet’s native transaction history with just one call. Eager to learn how it works? Check out the method in action here:
“`javascript
import fetch from ‘node-fetch’;
const options = {
method: ‘POST’,
headers: {
accept: ‘application/json’,
‘content-type’: ‘application/json’
},
body: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“method”: “eth_getTransactions”,
“params”: [
{
“address”: “0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045”,
“limit”: 100,
}
]
})
};
fetch(‘YOUR_NODE_URL’, options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
“`
By running the script above, you’ll receive the native transaction history of the specified wallet, enriched with timestamps, gas prices, address labels, and more. Here’s a sample response:
“`javascript
{
result: [
{
hash: ‘0xd89b02f289a08ae7b2feead06031fec20777bad8b73fc8d853f9040bc423a6c7’,
nonce: ‘0’,
transaction_index: ‘142’,
from_address: ‘0xda74ac6b69ff4f1b6796cddf61fbdd4a5f68525f’,
from_address_label: ”,
to_address: ‘0xdac17f958d2ee523a2206206994597c13d831ec7’,
to_address_label: ‘Tether USD (USDT)’,
value: ‘0’,
gas: ‘207128’,
gas_price: ‘17020913648’,
input: ‘0xa9059cbb00000000000000000000000028c6c06298d514db089934071355e5743bf21d6000000000000000000000000000000000000000000000000000000017a1df1700’,
receipt_cumulative_gas_used: ‘8270587’,
receipt_gas_used: ‘41309’,
receipt_contract_address: null,
receipt_root: null,
receipt_status: ‘1’,
block_timestamp: ‘2023-01-22T15:00:11.000Z’,
block_number: ‘16463098’,
block_hash: ‘0x2439330d0a282f9a6464b0aceb9f766ac4d7b050c048b4a1322b48544c61e01d’,
transaction_fee: ‘0.000703116921885232’
},
//…
]
}
“`
That’s it! It’s easy to retrieve wallet transactions using RPC nodes when working with Moralis. However, for a more detailed tutorial, join us in this article or check out the Moralis YouTube video below:
Want to get wallet transactions using RPC nodes yourself? Sign up for free with Moralis to immediately access all our Extended RPC Methods!
Overview
If you’re looking to build decentralized applications (dapps), whether it’s a cryptocurrency wallet, portfolio tracker, tax platform, or similar projects, you’ll likely need access to your users’ native transaction history. However, if you’re planning on getting this information using RPC nodes, it’s easier said than done, as it requires multiple requests and extensive manual data aggregation. Fortunately, there’s now a better way: Moralis’ Extended RPC Methods.
With our Extended RPC Methods, you can query the same decoded data that our APIs provide, but through RPC-style requests. A single call allows you to retrieve a wallet’s native transaction history, token prices, token balances, and much more.
But how does this work? If you’d like to learn more about our Extended RPC Methods, join us in this tutorial. Let’s dive straight in!
Introducing Moralis’ Next-Generation RPC Nodes – The Easiest Way to Get Wallet Transactions
Moralis is the industry’s leading provider of next-generation RPC nodes. With our intuitive user interface, you can access nodes for all major chains with just a click. As such, no matter what network you’re building on, we’ve got you covered.
But what makes our nodes unique?
- Speed: Our RPC nodes set the benchmark for speed, with response times as low as 70 ms.
- Reliability: With 99.9% uptime, you can trust our node infrastructure.
- Extended RPC Methods: Moralis’ Extended RPC Methods enhance our node offering, allowing you to query decoded, human-readable data via RPC-style requests.
Now, let’s dive a bit deeper into our Extended RPC Methods, which enable you to seamlessly get wallet transactions using RPC nodes!
Extended RPC Methods
Moralis’ Extended RPC Methods make fetching decoded, human-readable data with RPC nodes a breeze. With just one call, you can effortlessly get wallet transactions, NFTs, token prices, metadata, and much more. As such, when using Moralis and our Extended RPC Methods, you can significantly streamline your developer experience.
What data can you fetch with our Extended RPC Methods?
- eth_getTransactions: Get the native transactions of a wallet.
- eth_getDecodedTransactions: Query the full transaction history of a wallet.
- eth_getTokenBalances: Retrieve the ERC-20 balances of a wallet.
- eth_getTokenMetadata: Get the metadata of any ERC-20 token.
- eth_getTokenPrice: Access the price of any ERC-20 token.
- eth_getNFTBalances: Get the NFT balances of any wallet.
- eth_getNFTCollections: Fetch the NFT collections held by a wallet.
In summary, with our Extended RPC Methods, you can seamlessly fetch the same decoded, human-readable data our APIs provide, but through RPC-style requests.
eth_getTransactions – Get Wallet Transactions Using RPC Nodes with One Request
With the eth_getTransactions method, you can now seamlessly get any wallet’s native transaction history with just one single RPC request. Each transaction is also fully enriched with additional data, including time stamps, gas prices, address labels, and much more. As such, when using the eth_getTransactions endpoint, you get decoded data out of the box with just one call.
But how does this work? And what does an actual response look like? If you’re looking for the answers to these questions, join us in the next section, where we show you exactly how to get wallet transactions using RPC nodes in three simple steps.
Tutorial: How to Get Wallet Transactions Using RPC Nodes
With our Extended RPC Methods and the eth_getTransactions endpoint, you can get wallet transactions using RPC nodes in three simple steps:
- Sign up with Moralis & get a node URL.
- Write a script calling eth_getTransactions.
- Run the code.
But before we can dive into the tutorial, you need to deal with a few prerequisites.
Prerequisites
Make sure you have the following ready before continuing:
- An account with Moralis to access the Extended RPC Methods.
- A node URL from Moralis for authenticating your requests.
- Basic knowledge of JavaScript and API requests.
Step 1: Sign Up with Moralis & Get a Node URL
Click the “Start for Free” button at the top right and sign up with Moralis:
Log in, navigate to the “Nodes” tab, and click “+ Create Node”:
Choose “Ethereum,” then “Mainnet,” and click “Create Node”:
Copy and save one of your node URLs, as you’ll need it in the next step: