Chainstack API method to request Ethereum or BNB Smart Chain Testnet funds. Developers use testnet funds for various purposes, primarily to test and develop decentralized applications (DApps), smart contracts, and other blockchain-based projects within a safe and controlled environment.
You can also request funds directly from the Chainstack Faucet page.
Path parameters
chain
— the test network you want to receive funds on.sepolia
— receive testnet ETH on Sepolia.goerli
— receive testnet ETH on Goerli.holesky
— receive testnet ETH on Holesky.bnb-testnet
— receive testnet BNB.zksync-testnet
— receive testnet ETH on zkSync Goerli.scroll-sepolia-testnet
— receive testnet ETH on Scroll Sepolia.
Spam protection system
Note that this API integrates a strict spam protection system, although it should not be required for most requests, be ready to hold a balance on Mainnet to prevent abuse.
If our system identifies potential abuse, it will require the account calling the faucet to hold a minimum of 0.002 ETH on Mainnet. This measure helps ensure fair usage and prevent exploitation of the service.
Faucet API base URL
https://api.chainstack.com/v1/faucet/{chain}
Body parameters
address
— the address that will receive the funds.
Response
url
— the block explorer URL, including the transaction hash, to monitor the status.
Request funds from this page
You can already try this API from this page by doing the following:
- Get your API key and paste it into the Bearer field in the AUTHENTICATION section.
- At the bottom of the page, select which network you want to receive funds from.
- At the bottom of the page, paste your Ethereum address in the address field.
Code examples
The Faucet API is a great option for developers who don't want to spend time hunting for testnet tokens.
Here's an example of a script that automatically refills your wallet by calling the Chainstack Faucet API every 24 hours, ensuring a seamless daily refill.
// npm i axios
const axios = require('axios');
// API config
const chain = 'sepolia' // goerli
const address = 'YOUR_ADDRESS';
const apiUrl = `https://api.chainstack.com/v1/faucet/${chain}`;
const apiKey = 'YOUR_CHAINSTACK_API_KEY';
const fillWallet = async () => {
console.log(`Sending faucet request for address ${address}`)
try {
const response = await axios.post(apiUrl, { address }, {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
});
console.log('API call successful:', response.data);
} catch (error) {
console.error('Error making API call:', error.response.data);
}
// Schedule the next API call in 24 hours (24 * 60 * 60 * 1000 milliseconds)
setTimeout(makeApiCall, 24 * 60 * 60 * 1000);
};
// Make the first API call immediately
fillWallet();
# pip install requests
import requests
import time
# API config
chain = 'sepolia' # goerli
address = 'YOUR_ADDRESS'
api_url = f'https://api.chainstack.com/v1/faucet/{chain}'
api_key = 'YOUR_CHAINSTACK_API_KEY'
def fill_wallet():
print(f'Sending faucet request for address {address}')
try:
response = requests.post(
api_url,
json={'address': address},
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json',
},
)
print('API call successful:', response.json())
except Exception as error:
print('Error making API call:', error)
# Schedule the next API call in 24 hours (24 * 60 * 60 seconds)
time.sleep(24 * 60 * 60)
# Make the first API call immediately
while True:
fill_wallet()
Use cases
Here are some use cases testnet funds are used for:
- Smart contract development — with testnet funds, developers can deploy and interact with smart contracts, finding and fixing any issues before moving to the mainnet, where the real money is involved.
- Testing DApps and infrastructure — testnet funds allow developers to try out transactions, see how user interfaces work, and check the overall functionality of their DApps and blockchain components without risking real assets.
- Trying out new features — testnets are perfect for exploring and testing new features or updates to blockchain protocols and applications. It's like a sandbox where developers can play around and validate their ideas before taking them live on the mainnet.
- Stress testing and scalability — developers use testnet funds to put their DApps or smart contracts through the wringer, seeing how they perform under various conditions and loads. This helps them spot any issues and fix them before going live.
- Learning and training — testnet funds create a risk-free space for developers, researchers, and enthusiasts to learn about blockchain technology, smart contracts, and DApps. It's a great way to build expertise and understanding in the field.