The Dogecoin API gives you access to the Dogecoin blockchain through a standard set of JSON-RPC methods. With this API, you can retrieve block and transaction data, inspect the mempool, broadcast transactions, and more.
Dogecoin uses a UTXO-based model and exposes its functionality via the JSON-RPC protocol. This quickstart will help you make your first request.
The Dogecoin Chain API allows applications to communicate with a Dogecoin node using the JSON-RPC protocol. Like Bitcoin, Dogecoin relies on a UTXO (Unspent Transaction Output) model, which means balances are tracked by outputs that are explicitly spent or unspent.
Alchemy's Dogecoin API gives developers a consistent interface to query blockchain data, submit transactions, and monitor network activity. This includes:
- Retrieving raw or decoded transaction data
- Querying block headers and full blocks
- Monitoring mempool entries and states
- Submitting and testing raw transactions
If you've worked with Bitcoin or other JSON-RPC-compatible chains, the structure will feel familiar.
Select a package manager to manage your project's dependencies. The choice between npm and yarn depends on your preference or project requirements.
| npm | yarn |
|---|---|
Begin with npm by following the npm documentation. | For yarn, refer to yarn's installation guide. |
Open your terminal and run the following commands:
mkdir dogecoin-api-quickstart
cd dogecoin-api-quickstart
npm init --yesThis creates a new directory named dogecoin-api-quickstart and initializes a Node.js project within it.
Install Axios, a popular HTTP client, to make API requests:
npm install axios
# Or with yarn
# yarn add axiosCreate an index.js file in your project directory and paste the following code:
const axios = require('axios');
const url = `https://dogecoin-mainnet.g.alchemy.com/v2/${apiKey}`;
const payload = {
jsonrpc: '2.0',
id: 1,
method: 'getblockcount',
params: []
};
axios.post(url, payload)
.then(response => {
console.log('Current block height:', response.data.result);
})
.catch(error => {
console.error('Error fetching block count:', error);
});Replace apiKey with your actual Alchemy API key that you can get from the Alchemy Dashboard.
To execute your script and make a request to the Dogecoin API, run:
node index.jsYou should see the current block height on Dogecoin printed to your console:
Current block height: 5421894You've made your first request to the Dogecoin API. With this foundation, you can dive deeper into the JSON-RPC methods available on Dogecoin and start building on it.