The quickest way to start building on XRPL with Quicknode is by sending a JSON-RPC request to your endpoint. In this quickstart, you'll create an endpoint, copy its provider URL, and make your first request. Code samples are available in cURL as well as other popular programming languages.
Get Your XRPL Endpoint
Create a Quicknode account
Sign up here if you haven't already.
Go to your dashboard
Open the Endpoints dashboard from the left sidebar menu to manage all your blockchain endpoints
Create a new endpoint
Click Create an Endpoint in the top-right corner, select XRPL as your blockchain, then select your preferred network
Copy your provider URLs
Keep the HTTP URL handy. You'll use it in your requests below.
For a detailed walkthrough of the Quicknode dashboard, check out our guide
Send Your First Request
Your endpoint is ready. Now, let's make your first call to the XRPL blockchain. We'll use the fee method, which retrieves current fee information from the network. Select your preferred language and follow the steps below to send your first request.
- cURL
- Node.js
- Python
- Ruby
Check cURL installation
Most *nix based systems have cURL support out of the box. Open your terminal and check the cURL version by running the command below:
curl --version
Send a JSON-RPC request
In your terminal, copy and paste the following cURL command to retrieve current fee information:
curl YOUR_QUICKNODE_ENDPOINT_URL/ \
-X POST \
-H "Content-Type: application/json" \
--data '{
"method": "fee",
"params": [{}],
"id": 1,
"jsonrpc": "2.0"
}'
Sample Response
{
"id": 1,
"status": "success",
"type": "response",
"result": {
"current_ledger_size": "56",
"current_queue_size": "0",
"drops": {
"base_fee": "10",
"median_fee": "5000",
"minimum_fee": "10",
"open_ledger_fee": "10"
},
"expected_ledger_size": "55",
"ledger_current_index": 75708765,
"levels": {
"median_level": "128000",
"minimum_level": "256",
"open_ledger_level": "256",
"reference_level": "256"
},
"max_queue_size": "1100"
}
}
Set up your project
First, verify Node.js is installed with node --version. If not installed, download it from https://nodejs.org. Then create a new directory and initialize a Node.js project:
mkdir xrpl-api-quickstart
cd xrpl-api-quickstart
npm init -y
Create your main file
Create an index.js file for your code:
touch index.js
Add this code to your index.js file
Copy and paste this code into your index.js file:
const https = require('https');
const data = JSON.stringify({
method: "fee",
params: [{}],
id: 1,
jsonrpc: "2.0"
});
const options = {
hostname: '{your-endpoint-name}.quiknode.pro',
path: '/{your-token}/',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log('XRPL Fee Information:');
console.log(JSON.stringify(JSON.parse(responseData), null, 2));
});
});
req.on('error', (error) => {
console.error('Error:', error);
});
req.write(data);
req.end();
Run the script
Execute your Node.js script to retrieve fee information:
node index.js
Set up your project
Create a new directory for your project:
mkdir xrpl-api-quickstart
cd xrpl-api-quickstart
Create and activate a virtual environment
Create a virtual environment to manage dependencies:
python3 -m venv venv
source venv/bin/activate
Install required packages
Install the requests library:
pip install requests
Create a Python script (main.py)
Create a main.py file with the following code:
import requests
import json
url = "YOUR_QUICKNODE_ENDPOINT_URL/"
payload = {
"method": "fee",
"params": [{}],
"id": 1,
"jsonrpc": "2.0"
}
headers = {
'Content-Type': 'application/json'
}
try:
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
data = response.json()
print("XRPL Fee Information:")
print(json.dumps(data, indent=2))
except requests.exceptions.RequestException as e:
print(f"Error making request: {e}")
except json.JSONDecodeError as e:
print(f"Error parsing JSON: {e}")
Run the script
Execute your Python script to retrieve fee information:
python main.py
Set up your project
Create a new directory for your Ruby project:
mkdir xrpl-ruby-quickstart
cd xrpl-ruby-quickstart
Check Ruby Installation
Verify Ruby is installed on your system. If not, install it from https://ruby-lang.org:
ruby --version
Create a Ruby script (main.rb)
Create a main.rb file with the following code:
require 'uri'
require 'net/http'
require 'json'
url = URI('YOUR_QUICKNODE_ENDPOINT_URL/')
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/json'
request.body = {
method: "fee",
params: [{}],
id: 1,
jsonrpc: "2.0"
}.to_json
begin
response = https.request(request)
if response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)
puts 'XRPL Fee Information:'
puts JSON.pretty_generate(data)
else
puts "HTTP Error: #{response.code} - #{response.message}"
end
rescue JSON::ParserError => e
puts "JSON parsing error: #{e.message}"
rescue => e
puts "Error: #{e.message}"
end
Run the script
Execute your Ruby script to retrieve fee information:
ruby main.rb
If you want to continue learning about making API requests, check out our guides and sample apps.
We ❤️ Feedback!
If you have any feedback or questions about this documentation, let us know. We'd love to hear from you!