-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
28 lines (22 loc) · 1.33 KB
/
Copy pathconfig.py
File metadata and controls
28 lines (22 loc) · 1.33 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
# SPDX-License-Identifier: MIT
"""Shared config for the Python examples. Everything is overridable via env vars.
export TESTNET_NET=ltc-testnet # switch the explorer-API examples to Litecoin
export RPC_URL=http://127.0.0.1:48332 RPC_USER=... RPC_PASS=... # your node
"""
import os
# --- TestnetScan explorer API (recipes 01-06, 10, 11, no node needed) ---
API = os.environ.get("TESTNET_API", "https://testnetscan.com").rstrip("/")
NET = os.environ.get("TESTNET_NET", "btc-testnet4") # or "ltc-testnet"
def api(path):
"""Build a full API URL, e.g. api('/blocks/tip/height')."""
return f"{API}/{NET}/api{path}"
# --- Your own node's JSON-RPC (recipes 00, 07, 08, 14, 15) ---
# Default port is Litecoin testnet (19332). Bitcoin testnet4 is 48332, testnet3 18332.
# Safest auth for a local node: put the contents of the .cookie file (user:pass) here.
RPC_URL = os.environ.get("RPC_URL", "http://127.0.0.1:19332")
RPC_USER = os.environ.get("RPC_USER", "")
RPC_PASS = os.environ.get("RPC_PASS", "")
# --- Monero daemon (recipes 09, 12) --- stagenet 38081, testnet 28081
MONEROD = os.environ.get("MONEROD", "http://127.0.0.1:38081").rstrip("/")
# --- Monero wallet RPC (recipe 13) --- start monero-wallet-rpc yourself; port is your choice
MONERO_WALLET_RPC = os.environ.get("MONERO_WALLET_RPC", "http://127.0.0.1:38083").rstrip("/")