61 Commits

Author SHA1 Message Date
mhatal
680b51b100 chore: use api v8.13.6 2025-12-24 00:03:18 -06:00
mhatal
5b8628bf89 chore: use stacks 3.3.0.0.3 2025-12-18 13:20:00 -06:00
mhatal
25676d0a8c chore: use stacks node 3.3.0.0.2 & api 8.13.5 2025-12-10 01:32:51 -06:00
mhatal
c8a1d58e49 chore: use stacks node 3.3.0.0.1 2025-11-11 19:53:01 -06:00
mhatal
8ca15cd0d4 chore: use stacks api 8.13.4 2025-11-06 14:32:47 -06:00
mhatal
b541d2b421 chore: use stacks core 3.3.0.0.0 2025-11-05 11:58:55 -06:00
mhatal
32f7e2f5f0 chore: stacks core 3.2.0.0.2 & api 8.13.2 2025-10-29 10:20:24 -05:00
mhatal
75534dab9c chore: use api 8.13.0 2025-09-14 02:09:11 -05:00
mhatal
75b7271265 chore: use api 8.12.1 2025-08-27 08:55:27 -05:00
mhatal
63101ced1e chore: use stacks 3.2.0.0.1 & api 8.12.0 2025-08-24 23:19:04 -05:00
mhatal
10cb6a4a88 chore: use stacks 3.2.0.0.0 2025-07-26 03:03:28 -05:00
mhatal
c59454fa64 chore: use api 8.11.5 2025-07-20 11:27:56 -05:00
mhatal
57eefbed4c chore: use stacks api 8.11.4 2025-07-16 09:08:06 -05:00
mhatal
34e84429d5 chore: use stacks 3.1.0.0.13 2025-07-11 01:46:05 -05:00
mhatal
e481560aea chore: use api 8.11.2 2025-07-02 02:44:59 -05:00
mhatal
f6bef3b4e0 chore: use stacks api 8.11.1 2025-06-08 06:19:23 -05:00
mhatal
676a1eeb46 chore: use postgres 17 2025-05-24 12:22:27 -05:00
mhatal
3da4f66287 chore: use stacks 3.1.0.0.11 2025-05-24 01:52:25 -05:00
mhatal
9fdcdd2c21 chore: update cors headers 2025-05-15 12:29:06 -05:00
mhatal
cf33d3ebf4 chore: use stacks 3.1.0.0.9 2025-05-11 23:46:27 -05:00
mhatal
63cf180797 chore: use stacks api 8.10.0 2025-04-19 04:46:11 -05:00
mhatal
6053ae565c chore: use stacks 3.1.0.0.8 2025-04-17 03:19:23 -05:00
mhatal
90935a3882 chore: use stacks api 8.9.0 2025-04-13 02:16:16 -05:00
mhatal
6a0668b46b chore: use envoy 1.33.2 2025-03-28 02:22:39 -05:00
mhatal
f2f63e5554 chore: use stacks 3.1.0.0.7 2025-03-04 10:51:12 -06:00
mhatal
affd017730 chore: update hiro archive url 2025-02-05 02:03:37 -06:00
mhatal
f71418d1d1 chore: use stacks 3.1.0.0.5 2025-02-05 00:44:58 -06:00
mhatal
ce40bd3176 chore: use stacks 3.1.0.0.4 2025-01-25 06:24:55 -06:00
mhatal
e1eb072274 chore: use stacks-node 3.1.0.0.3 2025-01-16 21:50:00 -06:00
mhatal
38b08a9ac7 chore: fix envoy cors config 2025-01-08 08:08:15 -06:00
mhatal
fe8ab27840 chore: fix internal_address_config config 2025-01-01 02:50:21 -06:00
mhatal
d730b7b145 chore: fix cors config 2025-01-01 02:48:25 -06:00
mhatal
c0891d2402 chore: fix envoy config 2025-01-01 02:23:28 -06:00
mhatal
f898e26e4d chore: fix setup ufw 2025-01-01 02:16:23 -06:00
mhatal
aa772d1798 chore: use patched version of stacks api 2024-12-25 21:45:57 -06:00
mhatal
2a4fd48f5d chore: fix restoring from hiro archive 2024-12-25 05:51:54 -06:00
mhatal
fd6ae97acd chore: fix mount volume 2024-12-25 05:30:47 -06:00
mhatal
d4de89bc95 chore: use envoy 1.32.3 2024-12-25 02:16:43 -06:00
mhatal
0167788d35 chore: use stacks api 8.4.0 2024-12-21 09:05:00 -06:00
mhatal
fd352fa7f1 chore: use stacks 3.1.0.0.2 2024-12-14 04:23:58 -06:00
mhatal
a4f1e609a6 chore: use stacks 3.1.0.0.1 2024-12-13 01:37:23 -06:00
mhatal
ed57dfe430 chore: use stacks 3.0.0.0.4 2024-12-05 11:21:40 -06:00
mhatal
16c8a7ffab chore: use stacks 3.0.0.0.2 2024-11-11 22:59:29 -06:00
mhatal
dd8d0f1902 chore: use envoy 1.32.1 & fix hiro archive links 2024-11-04 21:47:42 -06:00
mhatal
2707e6555b chore: use stacks-core 3.0.0.0.0 2024-10-29 02:19:09 -05:00
mhatal
7d4639ab3d chore: fix envoy listen dual stack 2024-10-23 21:33:32 -05:00
mhatal
5e59f7d8b3 chore: use stacks api 8.1.1 2024-10-21 04:36:29 -05:00
mhatal
531fbc0fb6 chore: use api 8.0.3 2024-10-03 07:56:11 -05:00
mhatal
f88e564f88 chore: use stacks 2.5.0.0.7 2024-09-19 21:01:33 -05:00
mhatal
98bdebdeef chore: use stacks 2.5.0.0.6 & api 8.0.0 2024-09-04 20:53:37 -05:00
mhatal
f4e9811fbe chore: remove useless stacks-core env 2024-08-09 03:00:31 -05:00
mhatal
c85726d9af chore: ignore direnv config for server specific config 2024-08-09 02:57:47 -05:00
mhatal
aecc066ef5 chore: use stacks api 7.13.0 2024-08-09 02:51:25 -05:00
mhatal
fd95ae0832 chore: use stacks-node 2.5.0.0.5 2024-07-15 02:45:05 -05:00
mhatal
a14580e84d chore: use envoy route (#1)
* feat: use envoy to route stacks core requests

* chore: use envoy 1.30.2
2024-06-10 16:11:36 +08:00
mhatal
560d7b4180 chore: ignore stacks local config 2024-04-21 22:00:00 -05:00
mhatal
ae1fd8462d chore: use stacks-core 2.5.0.0.3 2024-04-21 21:57:41 -05:00
mhatal
50da2a59f7 chore: use stack foundation bitcoind 2024-03-24 21:01:04 +08:00
mhatal
57f4cc45a3 chore: revert to 2.4.0.0.4 2024-03-24 17:33:50 +08:00
mhatal
64b6eed8c0 chore: use stacks node 2.4.0.1.0
Signed-off-by: mhatal <100742635+mhatal@users.noreply.github.com>
2024-03-23 01:13:33 -05:00
mhatal
922378a6dd chore: add postgres init.sql
Signed-off-by: mhatal <100742635+mhatal@users.noreply.github.com>
2024-03-01 22:36:47 -06:00
11 changed files with 136 additions and 41 deletions

4
.gitignore vendored
View File

@@ -1,3 +1,5 @@
/stacks-node
/postgresql
/wait
/wait
/config/Stacks-*.toml
/.envrc

View File

@@ -2,8 +2,8 @@
References:
+ https://docs.hiro.so/stacks-blockchain-api/how-to-guides/how-to-run-mainnet-node
+ https://docs.hiro.so/hiro-archive/overview
- https://docs.stacks.co/guides-and-tutorials/nodes-and-miners
- https://docs.hiro.so/stacks/archive
Note: **use `stop.sh` to shutdown daemons!**
@@ -16,7 +16,7 @@ The scripts are tested on debian 12. Clone this repo and follow the steps.
1. Run ./setup.sh and reboot the server
2. Restore the latest backup from https://github.com/alexgo-io/stacks-node-mainnet/releases
3. Run ./start.sh
4. Run `watch 'curl -s http://127.0.0.1:3999/extended/v1/status'`, wait until the block height matches that from `https://api.hiro.so/v2/info`
4. Run `watch 'curl -s http://127.0.0.1:3999/extended'`, wait until the block height matches that from `https://api.hiro.so/v2/info`
5. Done
## How to spin up a stacks-node from archive
@@ -52,5 +52,5 @@ docker-compose logs -f
Wait until the block height catches up with official node: `https://api.hiro.so/v2/info`
```bash
watch 'curl -s http://127.0.0.1:3999/extended/v1/status'
watch 'curl -s http://127.0.0.1:3999/extended'
```

View File

@@ -2,21 +2,20 @@
working_dir = "/srv/stacks-node"
rpc_bind = "0.0.0.0:20443"
p2p_bind = "0.0.0.0:20444"
bootstrap_node = "02196f005965cebe6ddc3901b7b1cc1aa7a88f305bb8c5893456b8f9a605923893@seed.mainnet.hiro.so:20444"
bootstrap_node = "02196f005965cebe6ddc3901b7b1cc1aa7a88f305bb8c5893456b8f9a605923893@seed.mainnet.hiro.so:20444,02539449ad94e6e6392d8c1deb2b4e61f80ae2a18964349bc14336d8b903c46a8c@cet.stacksnodes.org:20444,02ececc8ce79b8adf813f13a0255f8ae58d4357309ba0cedd523d9f1a306fcfb79@sgt.stacksnodes.org:20444,0303144ba518fe7a0fb56a8a7d488f950307a4330f146e1e1458fc63fb33defe96@est.stacksnodes.org:20444"
wait_time_for_microblocks = 10000
[burnchain]
chain = "bitcoin"
mode = "mainnet"
peer_host = "bitcoin.blockstack.com"
username = "blockstack"
password = "blockstacksystem"
peer_host = "bitcoin.mainnet.stacks.org"
username = "stacks"
password = "foundation"
rpc_port = 8332
peer_port = 8333
[[events_observer]]
endpoint = "127.0.0.1:3700"
retry_count = 255
events_keys = ["*"]
[connection_options]
@@ -24,4 +23,4 @@ read_only_call_limit_write_length = 15000000
read_only_call_limit_read_length = 100000000
read_only_call_limit_write_count = 7750
read_only_call_limit_read_count = 7750
read_only_call_limit_runtime = 5000000000
read_only_call_limit_runtime = 5000000000

96
config/envoy.yaml Normal file
View File

@@ -0,0 +1,96 @@
node:
id: stacks_node_envoy
cluster: stacks_node
static_resources:
listeners:
- address:
socket_address:
address: "::"
port_value: 3999
ipv4_compat: true
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
internal_address_config:
cidr_ranges:
address_prefix: 10.0.0.0
prefix_len: 8
stat_prefix: ingress_http
codec_type: auto
http_filters:
- name: envoy.filters.http.cors
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.Cors
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
route_config:
name: local_route
virtual_hosts:
- name: stacks_node
domains:
- "*"
routes:
- match:
prefix: "/v2"
route:
cluster: stacks_core
- match:
prefix: "/v3"
route:
cluster: stacks_core
- match:
prefix: "/"
route:
cluster: stacks_api
typed_per_filter_config:
envoy.filters.http.cors:
"@type": type.googleapis.com/envoy.extensions.filters.http.cors.v3.CorsPolicy
allow_origin_string_match:
- prefix: "*"
allow_methods: "GET, POST, PUT, PATCH, DELETE, OPTIONS"
allow_headers: "DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range, Authorization, Priority, Access-Control-Allow-Origin, X-Hiro-Product, X-Hiro-Version"
allow_credentials: true
max_age: "1728000"
clusters:
- name: stacks_api
type: STATIC
connect_timeout: 10s
load_assignment:
cluster_name: stacks_api
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 23999
- name: stacks_core
type: STATIC
connect_timeout: 10s
load_assignment:
cluster_name: stacks_core
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 20443
admin:
access_log:
- name: envoy.access_loggers.stdout
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
address:
socket_address:
address: 0.0.0.0
port_value: 23866
overload_manager:
resource_monitors:
- name: "envoy.resource_monitors.global_downstream_max_connections"
typed_config:
"@type": type.googleapis.com/envoy.extensions.resource_monitors.downstream_connections.v3.DownstreamConnectionsConfig
max_active_downstream_connections: 65535

View File

@@ -1,8 +1,15 @@
version: "3.9"
services:
envoy:
restart: always
container_name: stacks_envoy
image: envoyproxy/envoy:v1.36.4
network_mode: "host"
command: --base-id 3999 --config-path /etc/envoy/envoy.yaml
volumes:
- "$PWD/config/envoy.yaml:/etc/envoy/envoy.yaml:ro"
stacks-blockchain-postgres:
restart: always
image: postgres:15.6
image: postgres:18-trixie
container_name: stacks_postgres
command: postgres -c 'max_connections=1000'
shm_size: 2gb
@@ -13,10 +20,10 @@ services:
POSTGRES_DB: stacks_blockchain_api
volumes:
- ./postgresql:/var/lib/postgresql
- ./postgresql/data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
stacks-blockchain-api:
restart: always
image: bestmike007/stacks-blockchain-api:7.8.2
image: bestmike007/stacks-blockchain-api:8.13.6
container_name: stacks_api
entrypoint: "/wait"
network_mode: host
@@ -29,10 +36,10 @@ services:
PG_PASSWORD: 6nyi11z9tWbXJDYsVESHQfNVo
PG_DATABASE: stacks_blockchain_api
PG_SCHEMA: stacks_blockchain_api
STACKS_CORE_EVENT_HOST: 127.0.0.1
STACKS_CORE_EVENT_PORT: "3700"
STACKS_CORE_EVENT_HOST: http://0.0.0.0
STACKS_BLOCKCHAIN_API_PORT: "3999"
STACKS_BLOCKCHAIN_API_HOST: 0.0.0.0
STACKS_BLOCKCHAIN_API_HOST: 127.0.0.1
STACKS_BLOCKCHAIN_API_PORT: "23999"
STACKS_CORE_RPC_HOST: 127.0.0.1
STACKS_CORE_RPC_PORT: "20443"
STACKS_CHAIN_ID: "0x00000001"
@@ -43,7 +50,7 @@ services:
- ./wait:/wait:ro
stacks-blockchain:
restart: always
image: bestmike007/stacks-blockchain:2.4.0.0.4
image: bestmike007/stacks-blockchain:3.3.0.0.3
container_name: stacks_node
entrypoint: "/wait"
network_mode: host
@@ -51,17 +58,8 @@ services:
WAIT_BEFORE: 3
WAIT_AFTER: 3
WAIT_HOSTS: "127.0.0.1:3700"
WAIT_COMMAND: "stacks-node start --config=/srv/Stacks.toml"
NOP_BLOCKSTACK_DEBUG: 0
XBLOCKSTACK_DEBUG: 0
RUST_BACKTRACE: 0
STACKS_CHAIN_ID: "0x00000001"
V2_POX_MIN_AMOUNT_USTX: 90000000260
STACKS_CORE_RPC_HOST: 127.0.0.1
STACKS_CORE_RPC_PORT: 20443
STACKS_API_ENABLE_FT_METADATA: 1
STACKS_API_ENABLE_NFT_METADATA: 1
WAIT_COMMAND: "stacks-node start --config /srv/Stacks.toml"
volumes:
- ./config/Stacks.toml:/srv/Stacks.toml:ro
- ./stacks-node/mainnet:/srv/stacks-node/mainnet
- ${STACKS_NODE_TOML:-./config/Stacks.toml}:/srv/Stacks.toml:ro
- ./stacks-node:/srv/stacks-node
- ./wait:/wait:ro

1
init.sql Normal file
View File

@@ -0,0 +1 @@
CREATE SCHEMA stacks_blockchain_api;

View File

@@ -9,6 +9,6 @@ if [ -e stacks-node ]; then
exit 0
fi
curl https://archive.hiro.so/mainnet/stacks-blockchain/mainnet-stacks-blockchain-latest.tar.gz | tar -zxv
mkdir stacks-node
mv mainnet stacks-node/
cd stacks-node
curl https://archive.hiro.so/mainnet/stacks-blockchain/mainnet-stacks-blockchain-latest.tar.gz | tar -zxv

View File

@@ -10,7 +10,7 @@ if [ -e postresql ]; then
fi
mkdir postgresql
curl -o postgresql/latest.dump https://archive.hiro.so/mainnet/stacks-blockchain-api-pg/stacks-blockchain-api-pg-15-7.1.10-latest.dump
curl -o postgresql/latest.dump https://archive.hiro.so/mainnet/stacks-blockchain-api-pg/stacks-blockchain-api-pg-17-latest.dump
docker-compose up -d stacks-blockchain-postgres
WAIT_HOSTS='127.0.0.1:5432' ./wait

View File

@@ -6,15 +6,14 @@ cd $DIR
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get autoclean
apt-get install -y dstat vim zip unzip ca-certificates curl git gawk jq tmux screen traceroute dnsutils iftop ufw net-tools
apt-get install -y dstat vim zip unzip ca-certificates curl git gawk jq tmux screen traceroute dnsutils iftop iotop htop ufw net-tools
echo "Port 20022" >> /etc/ssh/sshd_config
echo "UseDNS no" >> /etc/ssh/sshd_config
systemctl restart ssh
ufw allow 3999/tcp
ufw allow 20443/tcp
ufw allow 20444/tcp
ufw limit 20022
ufw allow 20443:20444/tcp
ufw limit 20022/tcp
echo y | ufw enable
# docker
@@ -30,7 +29,7 @@ if [ ! -e /usr/local/bin/docker-compose ]; then
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
fi
chmod a+r /etc/apt/keyrings/docker.gpg
apt-get update && apt-get install -y docker-ce
apt-get update && apt-get install -y docker-ce docker-compose-plugin
ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose
echo '{
"log-driver": "json-file",

View File

@@ -3,4 +3,4 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
cd $DIR
docker-compose up -d
docker compose up -d

View File

@@ -7,4 +7,4 @@ echo 'Stopping stacks-node, timeout: 60mins'
docker stop -t 3600 stacks_node
docker stop stacks_api
docker stop stacks_postgres
docker-compose down
docker compose down