-
-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathgenerate-seo-articles.js
More file actions
2115 lines (1668 loc) · 62.7 KB
/
Copy pathgenerate-seo-articles.js
File metadata and controls
2115 lines (1668 loc) · 62.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { writeFileSync, mkdirSync } from 'fs';
import { join } from 'path';
const OUT = '/workspaces/XActions/docs/seo-articles';
mkdirSync(OUT, { recursive: true });
const articles = [
{
slug: 'binance-api-guide',
title: 'Binance API Guide: Complete Reference for Developers (2026)',
meta: 'Learn how to use the Binance API for spot trading, futures, market data, and WebSocket streams. Includes code examples and authentication setup.',
keywords: 'Binance API, Binance trading API, Binance WebSocket, Binance REST API',
content: `# Binance API Guide: Complete Reference for Developers (2026)
The Binance API is the most widely used cryptocurrency exchange API in the world, powering millions of trading bots, portfolio trackers, and analytics tools. This guide covers everything you need to integrate with Binance's REST and WebSocket APIs.
## Authentication
Binance uses HMAC-SHA256 signed requests for private endpoints. Generate an API key in your account settings, then sign each request with your secret key.
\`\`\`javascript
import crypto from 'crypto';
function sign(queryString, secret) {
return crypto.createHmac('sha256', secret).update(queryString).digest('hex');
}
async function getAccountInfo(apiKey, secret) {
const timestamp = Date.now();
const query = \`timestamp=\${timestamp}\`;
const signature = sign(query, secret);
const res = await fetch(
\`https://api.binance.com/api/v3/account?\${query}&signature=\${signature}\`,
{ headers: { 'X-MBX-APIKEY': apiKey } }
);
return res.json();
}
\`\`\`
## Key Endpoints
| Endpoint | Method | Description |
|---|---|---|
| \`/api/v3/ticker/price\` | GET | Latest price for a symbol |
| \`/api/v3/klines\` | GET | OHLCV candlestick data |
| \`/api/v3/depth\` | GET | Order book snapshot |
| \`/api/v3/order\` | POST | Place a new order |
| \`/api/v3/account\` | GET | Account balances |
| \`/api/v3/myTrades\` | GET | Trade history |
## Fetching Candlestick Data
\`\`\`javascript
const res = await fetch(
'https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1h&limit=100'
);
const candles = await res.json();
// [openTime, open, high, low, close, volume, closeTime, ...]
\`\`\`
## WebSocket Streams
Binance WebSocket streams deliver real-time data without polling.
\`\`\`javascript
const ws = new WebSocket('wss://stream.binance.com:9443/ws/btcusdt@trade');
ws.onmessage = (event) => {
const trade = JSON.parse(event.data);
console.log(\`Price: \${trade.p}, Qty: \${trade.q}\`);
};
\`\`\`
**Available streams:**
- \`<symbol>@trade\` — real-time trade stream
- \`<symbol>@kline_<interval>\` — candlestick updates
- \`<symbol>@depth\` — order book diffs
- \`<symbol>@bookTicker\` — best bid/ask
## Rate Limits
Binance enforces weight-based rate limits. Each endpoint costs 1–50 weight units. The default limit is 1,200 weight per minute. Exceeding it returns HTTP 429, and repeated violations result in a temporary IP ban (HTTP 418).
Always check the \`X-MBX-USED-WEIGHT-1M\` response header to monitor consumption.
## Order Types
Binance supports: LIMIT, MARKET, STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT, LIMIT_MAKER. For most bots, LIMIT and MARKET cover 90% of use cases.
## Futures API
The Futures API lives at \`https://fapi.binance.com\`. It shares the same authentication scheme but has additional endpoints for leverage, position, and funding rate data.
\`\`\`javascript
// Get funding rate history
const res = await fetch(
'https://fapi.binance.com/fapi/v1/fundingRate?symbol=BTCUSDT&limit=10'
);
\`\`\`
## Best Practices
- Cache public market data (prices, candles) for at least 1 second
- Use WebSockets instead of polling for latency-sensitive strategies
- Implement exponential backoff on 429 responses
- Never store API keys in source code — use environment variables
- Enable IP restrictions on your API key in account settings`
},
{
slug: 'coinbase-api-guide',
title: 'Coinbase Advanced Trade API: Developer Guide (2026)',
meta: 'Full guide to the Coinbase Advanced Trade API — authentication, order management, market data, and WebSocket feeds with JavaScript examples.',
keywords: 'Coinbase API, Coinbase Advanced Trade API, Coinbase Pro API, Coinbase trading API',
content: `# Coinbase Advanced Trade API: Developer Guide (2026)
Coinbase Advanced Trade API (formerly Coinbase Pro) is the institutional-grade trading interface for Coinbase. It offers REST endpoints for order management and real-time WebSocket feeds for market data.
## Base URL
\`https://api.coinbase.com/api/v3/brokerage/\`
## Authentication
Coinbase uses JWT-based authentication for all private endpoints.
\`\`\`javascript
import { SignJWT } from 'jose';
import crypto from 'crypto';
async function createJWT(apiKeyName, privateKey) {
const key = await crypto.subtle.importKey(
'pkcs8',
Buffer.from(privateKey, 'base64'),
{ name: 'ECDSA', namedCurve: 'P-256' },
false,
['sign']
);
return new SignJWT({ sub: apiKeyName, iss: 'cdp', nbf: Math.floor(Date.now() / 1000) })
.setProtectedHeader({ alg: 'ES256', kid: apiKeyName })
.setExpirationTime('2m')
.sign(key);
}
\`\`\`
## Key Endpoints
| Endpoint | Description |
|---|---|
| \`GET /products\` | List all trading pairs |
| \`GET /products/{id}/candles\` | OHLCV data |
| \`GET /best_bid_ask\` | Best bid/ask for symbols |
| \`POST /orders\` | Place an order |
| \`GET /orders/historical/batch\` | Order history |
| \`GET /portfolios\` | Portfolio balances |
## Placing an Order
\`\`\`javascript
const order = {
client_order_id: crypto.randomUUID(),
product_id: 'BTC-USD',
side: 'BUY',
order_configuration: {
limit_limit_gtc: {
base_size: '0.001',
limit_price: '50000'
}
}
};
const res = await fetch('https://api.coinbase.com/api/v3/brokerage/orders', {
method: 'POST',
headers: {
'Authorization': \`Bearer \${jwt}\`,
'Content-Type': 'application/json'
},
body: JSON.stringify(order)
});
\`\`\`
## WebSocket Feed
\`\`\`javascript
const ws = new WebSocket('wss://advanced-trade-ws.coinbase.com');
ws.onopen = () => {
ws.send(JSON.stringify({
type: 'subscribe',
product_ids: ['BTC-USD', 'ETH-USD'],
channel: 'ticker'
}));
};
\`\`\`
**Channels:** ticker, level2, market_trades, user (private)
## Rate Limits
- Public endpoints: 10 requests/second
- Private endpoints: 30 requests/second
- WebSocket: 750 subscriptions per connection
## Sandbox Environment
Test without real funds at \`https://api-public.sandbox.exchange.coinbase.com\`. Sandbox accounts come pre-funded with test assets.`
},
{
slug: 'ethereum-rpc-api-guide',
title: 'Ethereum RPC API Guide: JSON-RPC Methods for Developers (2026)',
meta: 'Complete guide to Ethereum JSON-RPC API — read balances, send transactions, call smart contracts, and listen to events using eth_call, eth_getLogs, and more.',
keywords: 'Ethereum API, Ethereum JSON-RPC, eth_call, web3 API, ethers.js API',
content: `# Ethereum RPC API Guide: JSON-RPC Methods for Developers (2026)
The Ethereum JSON-RPC API is the standard interface for interacting with any EVM-compatible blockchain. Every node — whether self-hosted, Alchemy, Infura, or QuickNode — exposes this same API.
## Connecting
\`\`\`javascript
import { ethers } from 'ethers';
// Via provider URL (Alchemy, Infura, QuickNode, etc.)
const provider = new ethers.JsonRpcProvider(process.env.ETH_RPC_URL);
\`\`\`
## Core Methods
### Get ETH Balance
\`\`\`javascript
const balance = await provider.getBalance('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045');
console.log(ethers.formatEther(balance)); // "1.234"
\`\`\`
### Get Block
\`\`\`javascript
const block = await provider.getBlock('latest');
console.log(block.number, block.timestamp, block.transactions.length);
\`\`\`
### Call a Smart Contract
\`\`\`javascript
const erc20Abi = ['function balanceOf(address) view returns (uint256)'];
const usdc = new ethers.Contract('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', erc20Abi, provider);
const balance = await usdc.balanceOf('0xYourAddress');
\`\`\`
### Send a Transaction
\`\`\`javascript
const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const tx = await signer.sendTransaction({
to: '0xRecipient',
value: ethers.parseEther('0.01')
});
await tx.wait();
\`\`\`
## Raw JSON-RPC
\`\`\`javascript
const res = await fetch(process.env.ETH_RPC_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'eth_getBalance',
params: ['0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', 'latest']
})
});
const { result } = await res.json();
console.log(parseInt(result, 16) / 1e18); // ETH balance
\`\`\`
## Event Logs
\`\`\`javascript
const logs = await provider.getLogs({
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
topics: [ethers.id('Transfer(address,address,uint256)')],
fromBlock: -1000 // last 1000 blocks
});
\`\`\`
## Key RPC Methods Reference
| Method | Description |
|---|---|
| \`eth_blockNumber\` | Latest block number |
| \`eth_getBalance\` | ETH balance of address |
| \`eth_getTransactionByHash\` | Transaction details |
| \`eth_getTransactionReceipt\` | Receipt + logs |
| \`eth_call\` | Read smart contract state |
| \`eth_sendRawTransaction\` | Broadcast signed tx |
| \`eth_getLogs\` | Query event logs |
| \`eth_estimateGas\` | Estimate gas cost |
| \`eth_gasPrice\` | Current gas price |
## Node Providers Compared
| Provider | Free tier | Chains | Websockets |
|---|---|---|---|
| Alchemy | 300M compute units/mo | 20+ | Yes |
| Infura | 100K req/day | 10+ | Yes |
| QuickNode | 10M credits/mo | 30+ | Yes |
| Ankr | 30M req/mo | 40+ | Yes |
| Llamarpc | Unlimited (rate limited) | 5 | No |
## Archive Nodes
Standard nodes only keep recent state. For historical queries (e.g., balance at block 10,000,000), you need an archive node. Alchemy and QuickNode both offer archive access on paid plans.`
},
{
slug: 'solana-api-guide',
title: 'Solana RPC API Guide for Developers (2026)',
meta: 'Learn to use the Solana JSON-RPC API — read accounts, send transactions, subscribe to events, and query on-chain data with JavaScript examples.',
keywords: 'Solana API, Solana RPC, Solana JSON-RPC, @solana/web3.js, Solana developer API',
content: `# Solana RPC API Guide for Developers (2026)
Solana's JSON-RPC API is the primary interface for building on the Solana blockchain. With sub-second finality and ~4,000 TPS, Solana is the go-to chain for high-frequency DeFi, NFTs, and payments.
## Setup
\`\`\`bash
npm install @solana/web3.js
\`\`\`
\`\`\`javascript
import { Connection, PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js';
const connection = new Connection(process.env.SOLANA_RPC_URL, 'confirmed');
\`\`\`
## Get SOL Balance
\`\`\`javascript
const pubkey = new PublicKey('9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM');
const balance = await connection.getBalance(pubkey);
console.log(balance / LAMPORTS_PER_SOL); // SOL balance
\`\`\`
## Get Token Balances (SPL)
\`\`\`javascript
const tokenAccounts = await connection.getParsedTokenAccountsByOwner(pubkey, {
programId: new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA')
});
tokenAccounts.value.forEach(({ account }) => {
const { mint, tokenAmount } = account.data.parsed.info;
console.log(mint, tokenAmount.uiAmount);
});
\`\`\`
## Send a Transaction
\`\`\`javascript
import { SystemProgram, Transaction, Keypair, sendAndConfirmTransaction } from '@solana/web3.js';
const from = Keypair.fromSecretKey(Buffer.from(process.env.PRIVATE_KEY, 'base64'));
const to = new PublicKey('RecipientPublicKey');
const tx = new Transaction().add(
SystemProgram.transfer({
fromPubkey: from.publicKey,
toPubkey: to,
lamports: 0.01 * LAMPORTS_PER_SOL
})
);
const sig = await sendAndConfirmTransaction(connection, tx, [from]);
console.log('Signature:', sig);
\`\`\`
## Subscribe to Account Changes
\`\`\`javascript
const subscriptionId = connection.onAccountChange(pubkey, (accountInfo) => {
console.log('Balance changed:', accountInfo.lamports / LAMPORTS_PER_SOL);
});
// Unsubscribe when done
await connection.removeAccountChangeListener(subscriptionId);
\`\`\`
## Key RPC Methods
| Method | Description |
|---|---|
| \`getBalance\` | SOL balance |
| \`getAccountInfo\` | Raw account data |
| \`getTransaction\` | Transaction details |
| \`getBlock\` | Block with transactions |
| \`sendTransaction\` | Broadcast transaction |
| \`simulateTransaction\` | Dry-run without broadcasting |
| \`getTokenAccountsByOwner\` | All SPL token accounts |
| \`getProgramAccounts\` | All accounts owned by a program |
## RPC Providers for Solana
- **Helius** — best Solana-specific provider, advanced APIs (DAS, webhooks)
- **QuickNode** — reliable, multi-region
- **Alchemy** — Solana support added 2024
- **Triton** — high-performance, staked connections
## getProgramAccounts — Power Query
This method returns all accounts owned by a program — essential for DeFi integrations.
\`\`\`javascript
const accounts = await connection.getProgramAccounts(
new PublicKey('675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'), // Raydium AMM
{
filters: [{ dataSize: 752 }] // filter by account size
}
);
\`\`\``
},
{
slug: 'alchemy-api-guide',
title: 'Alchemy API Guide: Enhanced Web3 APIs Explained (2026)',
meta: 'Complete guide to Alchemy APIs — NFT API, Token API, Transfers API, Webhooks, and Notify. Build blockchain apps faster with Alchemy enhanced APIs.',
keywords: 'Alchemy API, Alchemy NFT API, Alchemy Transfers API, Alchemy Web3, blockchain API',
content: `# Alchemy API Guide: Enhanced Web3 APIs Explained (2026)
Alchemy is the leading blockchain infrastructure provider, offering standard JSON-RPC plus a suite of enhanced APIs that make common tasks dramatically easier.
## Setup
\`\`\`bash
npm install alchemy-sdk
\`\`\`
\`\`\`javascript
import { Alchemy, Network } from 'alchemy-sdk';
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET
});
\`\`\`
## NFT API
Get all NFTs owned by a wallet — no manual event log parsing required.
\`\`\`javascript
const nfts = await alchemy.nft.getNftsForOwner('0xAddress');
nfts.ownedNfts.forEach(nft => {
console.log(nft.contract.address, nft.tokenId, nft.title);
});
\`\`\`
Get NFT metadata:
\`\`\`javascript
const nft = await alchemy.nft.getNftMetadata('0xContractAddress', '1');
console.log(nft.title, nft.description, nft.image.originalUrl);
\`\`\`
## Token API
Get all ERC-20 token balances for a wallet:
\`\`\`javascript
const balances = await alchemy.core.getTokenBalances('0xAddress');
const nonZero = balances.tokenBalances.filter(t => t.tokenBalance !== '0x0');
\`\`\`
Get token metadata:
\`\`\`javascript
const meta = await alchemy.core.getTokenMetadata('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48');
console.log(meta.name, meta.symbol, meta.decimals); // USD Coin, USDC, 6
\`\`\`
## Transfers API
Get the full transfer history for any address — much faster than scanning logs manually.
\`\`\`javascript
const transfers = await alchemy.core.getAssetTransfers({
fromAddress: '0xAddress',
category: ['erc20', 'erc721', 'erc1155', 'external'],
withMetadata: true,
maxCount: 100
});
\`\`\`
## Webhooks (Notify)
Get real-time notifications via HTTP webhook when events happen on-chain.
\`\`\`javascript
// Create a webhook for address activity
const webhook = await alchemy.notify.createWebhook(
'https://yourapp.com/webhook',
WebhookType.ADDRESS_ACTIVITY,
{ addresses: ['0xYourAddress'] }
);
\`\`\`
**Webhook types:**
- \`MINED_TRANSACTION\` — tx confirmed
- \`DROPPED_TRANSACTION\` — tx dropped from mempool
- \`ADDRESS_ACTIVITY\` — any activity on watched addresses
- \`NFT_ACTIVITY\` — NFT transfers
## Supported Networks
Alchemy supports 20+ chains including Ethereum, Polygon, Arbitrum, Optimism, Base, Solana, Starknet, Astar, and more.
## Compute Units
Alchemy bills by "compute units" (CUs). Standard JSON-RPC calls cost 1–50 CUs. Enhanced APIs cost more — e.g., \`getNftsForOwner\` costs 100 CUs. The free tier includes 300M CUs/month.`
},
{
slug: 'coingecko-api-guide',
title: 'CoinGecko API Guide: Free Crypto Market Data (2026)',
meta: 'How to use the CoinGecko API for free crypto price data, market cap, historical OHLCV, DeFi data, and NFT floor prices. No API key required for basic use.',
keywords: 'CoinGecko API, CoinGecko free API, crypto price API, crypto market data free',
content: `# CoinGecko API Guide: Free Crypto Market Data (2026)
CoinGecko offers one of the most comprehensive free crypto market data APIs, covering 10,000+ cryptocurrencies, DeFi protocols, and NFT collections.
## Base URL
- Free (no key): \`https://api.coingecko.com/api/v3\`
- Pro: \`https://pro-api.coingecko.com/api/v3\`
## Get Current Price
\`\`\`javascript
const res = await fetch(
'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana&vs_currencies=usd,btc'
);
const prices = await res.json();
console.log(prices.bitcoin.usd); // e.g., 95000
\`\`\`
## Get Market Data
\`\`\`javascript
const res = await fetch(
'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page=1'
);
const coins = await res.json();
// Returns: id, symbol, name, current_price, market_cap, total_volume, price_change_percentage_24h
\`\`\`
## Historical Price Data
\`\`\`javascript
// Daily prices for last 365 days
const res = await fetch(
'https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=365&interval=daily'
);
const { prices, market_caps, total_volumes } = await res.json();
// prices = [[timestamp, price], ...]
\`\`\`
## OHLCV Data
\`\`\`javascript
const res = await fetch(
'https://api.coingecko.com/api/v3/coins/ethereum/ohlc?vs_currency=usd&days=30'
);
const ohlc = await res.json();
// [[timestamp, open, high, low, close], ...]
\`\`\`
## Coin Details
\`\`\`javascript
const res = await fetch(
'https://api.coingecko.com/api/v3/coins/bitcoin?localization=false&tickers=false&community_data=false'
);
const coin = await res.json();
console.log(coin.market_data.circulating_supply);
console.log(coin.market_data.ath.usd); // All-time high
\`\`\`
## DeFi Data
\`\`\`javascript
// Global DeFi stats
const res = await fetch('https://api.coingecko.com/api/v3/global/decentralized_finance_defi');
const { data } = await res.json();
console.log(data.defi_market_cap, data.trading_volume_24h);
\`\`\`
## NFT Floor Prices
\`\`\`javascript
const res = await fetch('https://api.coingecko.com/api/v3/nfts/cryptopunks');
const nft = await res.json();
console.log(nft.floor_price.native_currency); // Floor in ETH
\`\`\`
## Rate Limits
| Tier | Calls/min | Monthly |
|---|---|---|
| Free (no key) | 30 | ~43K |
| Demo (free key) | 30 | ~43K |
| Analyst | 500 | 720K |
| Lite | 500 | 720K |
| Pro | 500 | 720K |
| Enterprise | Custom | Custom |
## Coin ID Lookup
CoinGecko uses string IDs (e.g., \`bitcoin\`, \`ethereum\`), not symbols. Get the full list:
\`\`\`javascript
const res = await fetch('https://api.coingecko.com/api/v3/coins/list');
const coins = await res.json(); // [{id, symbol, name}, ...]
\`\`\``
},
{
slug: 'infura-api-guide',
title: 'Infura API Guide: Ethereum and IPFS Infrastructure (2026)',
meta: 'How to use Infura for Ethereum JSON-RPC, IPFS, and multi-chain access. Setup, authentication, rate limits, and code examples for Node.js developers.',
keywords: 'Infura API, Infura Ethereum, Infura IPFS, Infura Web3 provider, Ethereum node API',
content: `# Infura API Guide: Ethereum and IPFS Infrastructure (2026)
Infura, by ConsenSys, is one of the oldest and most trusted Ethereum node providers. It supports Ethereum mainnet, testnets, Layer 2s, and IPFS.
## Getting Started
1. Create an account at infura.io
2. Create a new project — note your **Project ID** and **API Key**
3. Your RPC endpoint: \`https://mainnet.infura.io/v3/<PROJECT_ID>\`
\`\`\`javascript
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider(
\`https://mainnet.infura.io/v3/\${process.env.INFURA_PROJECT_ID}\`
);
\`\`\`
## Supported Networks
| Network | Endpoint |
|---|---|
| Ethereum Mainnet | \`mainnet.infura.io/v3/<id>\` |
| Sepolia Testnet | \`sepolia.infura.io/v3/<id>\` |
| Polygon Mainnet | \`polygon-mainnet.infura.io/v3/<id>\` |
| Arbitrum One | \`arbitrum-mainnet.infura.io/v3/<id>\` |
| Optimism | \`optimism-mainnet.infura.io/v3/<id>\` |
| Base | \`base-mainnet.infura.io/v3/<id>\` |
| Linea | \`linea-mainnet.infura.io/v3/<id>\` |
| Avalanche | \`avalanche-mainnet.infura.io/v3/<id>\` |
## IPFS API
Infura provides a dedicated IPFS gateway and upload API.
\`\`\`javascript
// Upload a file to IPFS
const formData = new FormData();
formData.append('file', fileBlob);
const res = await fetch('https://ipfs.infura.io:5001/api/v0/add', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + Buffer.from(\`\${projectId}:\${projectSecret}\`).toString('base64')
},
body: formData
});
const { Hash } = await res.json();
console.log(\`https://ipfs.io/ipfs/\${Hash}\`);
\`\`\`
## WebSocket Endpoint
\`\`\`javascript
const ws = new ethers.WebSocketProvider(
\`wss://mainnet.infura.io/ws/v3/\${process.env.INFURA_PROJECT_ID}\`
);
// Subscribe to new blocks
ws.on('block', (blockNumber) => {
console.log('New block:', blockNumber);
});
\`\`\`
## Rate Limits
- Free: 100,000 requests/day
- Developer: 300K/day
- Team: 3M/day
- Growth: 15M/day
## Secret Key Authentication
For production, require a secret key alongside your project ID to prevent unauthorized use of your endpoint.
Enable in: Dashboard → Project Settings → Security → Require API Key Secret
\`\`\`javascript
const provider = new ethers.JsonRpcProvider({
url: \`https://mainnet.infura.io/v3/\${projectId}\`,
user: '',
password: projectSecret
});
\`\`\``
},
{
slug: 'quicknode-api-guide',
title: 'QuickNode API Guide: Multi-Chain RPC for Builders (2026)',
meta: 'Learn how to use QuickNode for fast multi-chain RPC access, Streams data pipelines, Functions serverless compute, and marketplace add-ons.',
keywords: 'QuickNode API, QuickNode RPC, QuickNode Streams, multi-chain API, QuickNode setup',
content: `# QuickNode API Guide: Multi-Chain RPC for Builders (2026)
QuickNode is a high-performance blockchain infrastructure provider supporting 30+ chains. Beyond standard RPC, it offers Streams (real-time data pipelines), Functions (serverless compute), and a marketplace of add-ons.
## Setup
Create an endpoint at quicknode.com. You'll get a unique HTTPS and WSS URL.
\`\`\`javascript
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider(process.env.QUICKNODE_HTTP_URL);
const wsProvider = new ethers.WebSocketProvider(process.env.QUICKNODE_WSS_URL);
\`\`\`
## Supported Chains (sample)
Ethereum, Solana, Bitcoin, BNB Chain, Polygon, Avalanche, Arbitrum, Optimism, Base, zkSync, Starknet, Aptos, Sui, TON, Cosmos, Near, Fantom, Celo, Moonbeam, and more.
## QuickNode SDK
\`\`\`bash
npm install @quicknode/sdk
\`\`\`
\`\`\`javascript
import QuickNode from '@quicknode/sdk';
const qn = new QuickNode.Core({
endpointUrl: process.env.QUICKNODE_HTTP_URL
});
// Get NFT assets for an address
const nfts = await qn.client.qn_fetchNFTsByCollection({
collection: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D', // BAYC
page: 1,
perPage: 10
});
\`\`\`
## Streams: Real-Time Data Pipelines
Streams lets you pipe on-chain data directly to a destination (HTTP, Kafka, S3, Snowflake) without polling.
\`\`\`json
{
"name": "ETH Transfers",
"network": "ethereum-mainnet",
"dataset": "receipts",
"filter_function": "function main(data) { return data.filter(r => r.logs.length > 0); }",
"destination": "https://yourapp.com/webhook",
"status": "active"
}
\`\`\`
## Functions: Serverless On-Chain Compute
Run JavaScript serverless functions that execute on QuickNode's infrastructure and have native RPC access.
\`\`\`javascript
// A QuickNode Function
export async function main(params) {
const block = await eth_blockNumber();
const price = await fetchTokenPrice('ETH');
return { block, price };
}
\`\`\`
## Add-ons Marketplace
QuickNode's marketplace includes:
- **Token and NFT API** — enhanced asset queries
- **DeFi Pulse Data** — DeFi protocol metrics
- **Etherscan Compat** — Etherscan-style API on any chain
- **Trader Joe / Uniswap** — DEX analytics
## Rate Limits and Plans
| Plan | Req/s | Monthly credits |
|---|---|---|
| Free | 15 | 10M |
| Build | 50 | Unlimited |
| Scale | 100+ | Unlimited |`
},
{
slug: 'moralis-api-guide',
title: 'Moralis API Guide: Web3 Data APIs for Developers (2026)',
meta: 'Full guide to Moralis APIs — Wallet API, NFT API, Token API, DeFi API, and Streams. Build Web3 apps without running your own node infrastructure.',
keywords: 'Moralis API, Moralis Web3 API, Moralis NFT API, Moralis Wallet API, Web3 data API',
content: `# Moralis API Guide: Web3 Data APIs for Developers (2026)
Moralis provides high-level Web3 APIs that abstract the complexity of raw RPC calls. Instead of parsing raw logs and state, you get clean structured data for wallets, tokens, NFTs, and DeFi positions.
## Setup
\`\`\`bash
npm install moralis
\`\`\`
\`\`\`javascript
import Moralis from 'moralis';
await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
\`\`\`
## Wallet API
Get native balance + token balances in one call:
\`\`\`javascript
const portfolio = await Moralis.EvmApi.wallets.getWalletTokenBalancesPrice({
address: '0xAddress',
chain: '0x1' // Ethereum
});
portfolio.result.forEach(token => {
console.log(token.symbol, token.balanceFormatted, token.usdValue);
});
\`\`\`
Get wallet net worth:
\`\`\`javascript
const netWorth = await Moralis.EvmApi.wallets.getWalletNetWorth({
address: '0xAddress',
excludeSpam: true,
excludeUnverifiedContracts: true
});
console.log(netWorth.result.totalNetworth); // USD value
\`\`\`
## NFT API
\`\`\`javascript
// All NFTs owned by an address
const nfts = await Moralis.EvmApi.nft.getWalletNFTs({
address: '0xAddress',
chain: '0x1',
mediaItems: true
});
// NFT collection stats
const stats = await Moralis.EvmApi.nft.getNFTCollectionStats({
address: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D' // BAYC
});
console.log(stats.result.floor_price, stats.result.volume_usd);
\`\`\`
## Token API
\`\`\`javascript
// Token price with liquidity data
const price = await Moralis.EvmApi.token.getTokenPrice({
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
chain: '0x1'
});
console.log(price.result.usdPrice, price.result.exchangeName);
\`\`\`
## DeFi API
\`\`\`javascript
// All DeFi positions (Uniswap, Aave, Compound, etc.)
const positions = await Moralis.EvmApi.defi.getDefiPositionsSummary({
address: '0xAddress',
chain: '0x1'
});
\`\`\`
## Streams (Webhooks)
Get real-time webhooks when on-chain events occur:
\`\`\`javascript
const stream = await Moralis.Streams.add({
chains: ['0x1'],
description: 'USDC transfers',
tag: 'usdc-transfers',
webhookUrl: 'https://yourapp.com/webhook',
abi: transferAbi,
topic0: ['Transfer(address,address,uint256)'],
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
});
\`\`\`
## Supported Chains
Moralis supports 30+ EVM chains plus Solana, Aptos, and more.
## Rate Limits
Free tier: 40,000 CU/day. Paid plans start at $49/month for 100M CU/month.`
},
{
slug: 'the-graph-api-guide',
title: 'The Graph API Guide: Query Blockchain Data with GraphQL (2026)',
meta: 'Learn how to use The Graph protocol to query on-chain data with GraphQL. Deploy subgraphs, query Uniswap, Aave, and custom protocol data.',
keywords: 'The Graph API, GraphQL blockchain, subgraph API, Uniswap subgraph, The Graph protocol',
content: `# The Graph API Guide: Query Blockchain Data with GraphQL (2026)
The Graph is a decentralized indexing protocol that lets you query blockchain data with GraphQL. It powers data for Uniswap, Aave, Compound, and thousands of other DeFi protocols.
## How It Works
1. A **subgraph** defines which on-chain events to index and how to structure them
2. Indexers process the subgraph and store the data
3. You query the subgraph via a GraphQL API endpoint
## Querying a Public Subgraph
No API key needed for hosted service subgraphs:
\`\`\`javascript
const UNISWAP_V3 = 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3';
const query = \`{
pools(first: 5, orderBy: totalValueLockedUSD, orderDirection: desc) {
id
token0 { symbol }
token1 { symbol }
feeTier
totalValueLockedUSD
volumeUSD
}
}\`;
const res = await fetch(UNISWAP_V3, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query })
});
const { data } = await res.json();
\`\`\`
## Decentralized Network (requires API key)
\`\`\`javascript
const GRAPH_API_KEY = process.env.GRAPH_API_KEY;
const SUBGRAPH_ID = 'ELUcwgpm14LKPLrBRuVvPvNKHQ9HvwmtKgKSH855M4Nd'; // Uniswap V3
const endpoint = \`https://gateway.thegraph.com/api/\${GRAPH_API_KEY}/subgraphs/id/\${SUBGRAPH_ID}\`;
\`\`\`
## Popular Subgraphs
| Protocol | Subgraph |
|---|---|
| Uniswap V3 | uniswap/uniswap-v3 |
| Aave V3 | aave/protocol-v3 |
| Compound V3 | messari/compound-v3-ethereum |
| Curve | messari/curve-finance-ethereum |
| Balancer V2 | balancer-labs/balancer-v2 |
| ENS | ensdomains/ensregistrar |
| Lens Protocol | lens-protocol/lens |
## Query With Variables
\`\`\`javascript
const query = \`
query GetTokenSwaps($token: String!, $limit: Int!) {
swaps(
where: { token0: $token }
first: $limit
orderBy: timestamp
orderDirection: desc
) {
id
timestamp
amountUSD
token0 { symbol }
token1 { symbol }
}
}
\`;
const res = await fetch(endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query,
variables: { token: '0xA0b86991c...', limit: 20 }
})