Robinhood API Overview
Welcome to the Robinhood API Quickstart and Reference Guide. This guide provides everything you need to start building on Robinhood using dRPC's JSON-RPC API. Whether you're retrieving account balances, fetching block details, executing transactions, or estimating gas fees, this comprehensive guide will help you integrate Robinhood seamlessly into your applications.
This page includes:
- A Quickstart Guide to help you set up and make your first Robinhood API request.
- A detailed list of all Robinhood API methods, categorized for easy reference.
Robinhood API Quickstart#
To get started with building on Robinhood using dRPC's Robinhood RPC API, follow these steps:
1. Create a dRPC Account
By signing up for a free dRPC account, you can access Premium Robinhood RPC endpoints.
2. Set Up Your Development Environment
RPC can be requested in various ways (opens in a new tab). In this example, we are going to use Node.js. Ensure you have Node.js (opens in a new tab) and npm installed on your system. You can verify their installation by running:
node -v
npm -vIf not installed, download and install them from the official Node.js website (opens in a new tab).
3. Initialize Your Project
Create a new directory for your project and initialize it:
mkdir Robinhood-drpc-quickstart
cd Robinhood-drpc-quickstart
npm init --yes4. Install Axios
Axios is a popular HTTP client for making API requests. Install it using npm:
npm install axios5. Obtain dRPC Endpoint
Log in to your dRPC account and navigate to the Robinhood RPC endpoints section. Copy the HTTPS endpoint URL for the Robinhood Mainnet.
6. Write Your First Script
Create an index.js file in your project directory and add the following code:
const axios = require('axios');
const url = 'https://lb.drpc.live/robinhood/YOUR_DRPC_API_KEY';
const payload = {
jsonrpc: '2.0',
id: 1,
method: 'eth_blockNumber',
params: []
};
axios.post(url, payload)
.then(response => {
console.log('The latest block number is', parseInt(response.data.result, 16));
})
.catch(error => {
console.error('Error fetching block number:', error);
});Replace 'https://lb.drpc.live/robinhood/YOUR_DRPC_API_KEY' with the actual endpoint URL you obtained from dRPC.
7. Run Your Script
Execute your script using Node.js:
node index.jsYou should see the latest Robinhood block number printed in your console.
Additional Information
dRPC offers various features such as high performance nodes, access to multiple chains.
By following these steps, you can start building on Robinhood using dRPC's reliable and efficient RPC endpoints.
Robinhood API Methods#
These endpoints allow to retrieve information about blocks, transactions, balances, logs, and more, facilitating efficient blockchain development and integration.
Accounts info#
Returns data about an account's balance, contract code, or stored data on the blockchain.
eth_accounts : Retrieves a list of accounts controlled by the connected client.
eth_getBalance : Returns the balance of an account.
eth_getCode : Fetches the contract code stored at an address.
eth_getProof : Provides a Merkle proof for an account's state.
eth_getStorageAt : Returns data stored at a specific slot in the account's storage.
eth_getStorageValues : Returns multiple storage values for an account at specified storage slots.
Blocks info#
Retrieves detailed information from a specified block, including transactions, receipts, and block data.
eth_blockNumber : Retrieves the latest block number.
eth_getBlockByHash : Fetches block details by hash.
eth_getBlockByNumber : Retrieves block data by number.
eth_newBlockFilter : Creates a filter for new blocks.
eth_getBlockReceipts : Retrieves receipts for a given block.
eth_getBlockTransactionCountByHash : Gets the transaction count of a block by its hash.
eth_getBlockTransactionCountByNumber : Gets the transaction count of a block by its number.
Chain info#
Supplies details about the network, its protocol version, and its configuration.
eth_chainId : Retrieves the chain ID of the network.
eth_protocolVersion : Returns the protocol version used by the client.
net_listening : Checks if the client is actively listening for network connections.
net_version : Returns the current network version.
net_peerCount : Retrieves the number of active peers.
eth_syncing : Indicates the synchronization status of the node.
eth_hashrate : Provides the current mining hashrate of the network.
Debug and trace#
Allows to trace transactions, inspect block execution, and replay transactions or blocks for detailed analysis.
trace_filter : Filters trace data based on criteria.
trace_block : Traces execution of all transactions in a block.
trace_replayBlockTransactions : Replays block transactions for debugging.
debug_traceBlockByHash : Traces a block by its hash.
debug_traceBlockByNumber : Traces a block by its number.
trace_transaction : Traces a specific transaction.
debug_traceTransaction : Provides detailed trace data for a transaction.
trace_replayTransaction : Replays a transaction for debugging.
trace_get : Retrieves trace data by criteria.
trace_call : Executes a trace call.
debug_traceCall : Traces a specific call without state change.
debug_accountRange : Returns a list of accounts and their state at a given block, used for state inspection.
debug_dumpBlock : Retrieves the full state of a block as a JSON dump for debugging.
debug_getBadBlocks : Returns a list of the most recent "bad" (invalid) blocks the client has encountered.
debug_getModifiedAccountsByHash : Returns accounts modified between two block hashes.
debug_getModifiedAccountsByNumber : Returns accounts modified between two block numbers.
debug_getRawBlock : Returns the RLP-encoded raw block data.
debug_getRawHeader : Returns the RLP-encoded raw block header.
debug_getRawReceipts : Returns the RLP-encoded raw transaction receipts for a block.
debug_getRawTransaction : Returns the RLP-encoded raw transaction data.
debug_intermediateRoots : Returns the intermediate state roots produced while executing a block's transactions.
debug_storageRangeAt : Returns a range of storage entries for an account at a given block and transaction index.
debug_traceBlock : Traces all transactions in a given RLP-encoded block.
debug_traceCallMany : Executes and traces multiple call objects against a given block state.
Event logs#
Provides logs of events emitted by smart contracts, useful for tracking token transfers and state changes.
eth_getLogs : Retrieves logs based on filter criteria.
eth_newFilter : Available only on paid tier. Creates a new filter to monitor logs.
eth_getFilterChanges : Available only on paid tier. Retrieves changes for an active filter.
eth_uninstallFilter : Uninstalls a specific filter.
eth_getFilterLogs : Available only on paid tier. Fetches logs matching a specific filter.
Executing transactions#
Facilitates sending ETH, executing smart contracts, and performing on-chain operations.
eth_call : Executes a read-only call to a smart contract without broadcasting it to the network.
eth_sendRawTransaction : Sends a raw, signed transaction to the blockchain for execution.
eth_sendBundle : Submits a bundle of transactions to be included atomically, typically used with MEV relays/builders.
eth_simulateV1 : Simulates a sequence of calls or transactions against a specified block state without broadcasting.
Gas estimation#
Estimates gas fees for transactions and provides historical and current gas price data.
eth_feeHistory : Retrieves historical gas fees over a specified range of blocks.
eth_estimateGas : Estimates the gas required for a transaction based on its parameters.
eth_gasPrice : Returns the current gas price.
eth_createAccessList : Generates an access list to reduce gas costs.
eth_maxPriorityFeePerGas : Retrieves the maximum priority fee per gas unit.
eth_blobBaseFee : Returns the base fee per blob gas for the current or next block (EIP-4844).
Getting uncles#
Retrieves information about "uncle" blocks, which are valid but not included in the blockchain.
eth_getUncleByBlockHashAndIndex : Retrieves uncle block information by block hash and index.
eth_getUncleByBlockNumberAndIndex : Fetches uncle block details by block number and index.
eth_getUncleCountByBlockHash : Returns the number of uncle blocks for a block hash.
eth_getUncleCountByBlockNumber : Returns the number of uncle blocks for a block number.
Mining#
Provides details on the mining state of the node.
eth_coinbase : Returns the address of the miner who is receiving mining rewards.
eth_mining : Indicates whether the node is actively mining blocks.
Subscriptions#
Allows to subscribe to specific events in real-time via WebSockets.
eth_subscribe : Subscribes to various blockchain events such as new blocks, pending transactions, or logs.
eth_unsubscribe : Unsubscribes from an existing event subscription.
Transactions info#
Retrieves data on individual transactions, such as status, receipt, and inclusion in a specific block.
eth_getTransactionByHash : Fetches transaction details using its hash.
eth_getTransactionCount : Returns the number of transactions sent from an address.
eth_getTransactionReceipt : Retrieves the receipt of a processed transaction.
eth_newPendingTransactionFilter : Available only on paid tier. Creates a filter for pending transactions.
eth_getTransactionByBlockHashAndIndex : Retrieves a transaction by block hash and index.
eth_getTransactionByBlockNumberAndIndex : Retrieves a transaction by block number and index.
txpool_content : Provides details of the transaction pool content.
eth_getRawTransactionByBlockHashAndIndex : Returns the raw (RLP-encoded) transaction at a given block hash and index.
eth_getRawTransactionByHash : Returns the raw (RLP-encoded) transaction data for a given transaction hash.
Web3#
Returns general network configuration data for nodes.
web3_clientVersion : Returns the version of the node client in use.