The quickest way to start building on Stacks with Quicknode is by sending a 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 popular SDKs and programming languages.
Get Your Stacks Endpoint
Ein Quicknode-Konto erstellen
Melde dich hier an, falls du das noch nicht getan hast.
Gehen Sie zu Ihrem Dashboard
Öffnen Sie das Endpunkte-Dashboard über das Menü in der linken Seitenleiste, um alle Ihre Blockchain-Endpunkte zu verwalten
Neuen Endpunkt erstellen
Click Create an Endpoint in the top-right corner, select Stacks as your blockchain, then select your preferred network
Kopieren Sie die URLs Ihres Anbieters
Halten Sie die HTTP-URL griffbereit. Sie werden sie in den folgenden Anfragen verwenden.
Eine ausführliche Anleitung zur Nutzung des Quicknode-Dashboards finden Sie in unserem Leitfaden
Senden Sie Ihre erste Anfrage
Your endpoint is ready. Now, let's make your first call to the Stacks blockchain. We’ll use the /v2/info endpoint to fetch information about the Stacks Core API. Select your preferred language or SDK below and follow the steps.
- cURL
- Node.js
Python
cURL-Installation überprüfen
Die meisten *nix-basierten Systeme unterstützen cURL standardmäßig. Öffnen Sie Ihr Terminal und überprüfen Sie die cURL-Version, indem Sie den folgenden Befehl ausführen:
curl --version
Get Server Info
To run the cURL request, open a terminal window and paste the following code to retrieve the server information.
curl --location 'YOUR_QUICKNODE_ENDPOINT_URL/v2/info' \
--header 'Content-Type: application/json'
Sample response
{
"peer_version": 402653197,
"pox_consensus": "8097c32d611a9803e4b6454446f833c49e186379",
"burn_block_height": 917395,
"stable_pox_consensus": "80c2129d4ff1967e061411b23517be3f46ae08ef",
"stable_burn_block_height": 917388,
"server_version": "stacks-node 3.2.0.0.1 (release/3.2.0.0.1:4a7dfc2+, release build, linux [x86_64])",
"network_id": 1,
"parent_network_id": 3652501241,
"stacks_tip_height": 3921858,
"stacks_tip": "6f9848f72b83b27bcf3d5df3b745753b95632f9cd02ce10855d5101354a7ded5",
"stacks_tip_consensus_hash": "8097c32d611a9803e4b6454446f833c49e186379",
"genesis_chainstate_hash": "74237aa39aa50a83de11a4f53e9d3bb7d43461d1de9873f402e5453ae60bc59b",
"unanchored_tip": null,
"unanchored_seq": null,
"tenure_height": 214788,
"exit_at_block_height": null,
"is_fully_synced": true,
"node_public_key": "03a9f0407bae737e87bfbcd3a428b33cf4e4ab021af9d805a87f41933d209eb175",
"node_public_key_hash": "169abc91fbb6c5b9162766cc5030d15a796b454c",
"affirmations": {
"heaviest": "",
"stacks_tip": "",
"sortition_tip": "",
"tentative_best": ""
},
"last_pox_anchor": {
"anchor_block_hash": "4ae4b465da5bbdff325d848ce137032ee5e4141d185371a109c10112dcd7abd7",
"anchor_block_txid": "c96593fc8677675bd3b5a3fb96b6f304f42d02f18931bff71a5202d5bde8305c"
},
"stackerdbs": []
}
Richten Sie Ihr Projekt ein
Create a directory and initialize a Node.js project:
mkdir stacks-js-quickstart
cd stacks-js-quickstart
npm init -y
Create app.js
Add the code into your JavaScript file and execute the file in your terminal with the `node fileName.js` to retrieve the server information.
const https = require('https');
const options = {
hostname: '{your-endpoint-name}.quiknode.pro',
path: '/{your-token}/v2/info',
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
const req = https.request(options, (res) => {
let result = '';
res.on('data', (chunk) => {
result += chunk;
});
res.on('end', () => {
console.log(result);
});
});
req.on('error', (error) => {
console.error('Error:', error);
});
req.end();
Run
Execute your script:
Knoten app.js
Richten Sie Ihr Projekt ein
Erstellen Sie ein neues Verzeichnis für Ihr Python-Projekt:
mkdir stacks-python-quickstart
cd stacks-python-quickstart
Eine virtuelle Umgebung erstellen und aktivieren
Erstellen Sie eine virtuelle Umgebung zur Verwaltung von Abhängigkeiten:
python3 -m venv venv
source venv/bin/activate
Installationsanfragen
Installieren Sie die Bibliothek „requests“ zum Absenden von HTTP-Anfragen:
pip install Requests
Erstellen Sie ein Python-Skript (app.py)
Erstellen Sie eine Python-Datei mit dem folgenden Code:
import requests
url = "YOUR_QUICKNODE_ENDPOINT_URL/v2/info"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers)
print(response.text)
Führen Sie das Skript aus
Führen Sie Ihr Python-Skript aus:
python app.py
Wenn Sie mehr über das Absenden von API-Anfragen erfahren möchten, sehen Sie sich unsere Anleitungen und Beispiel-Apps an.