├── .gitignore ├── LICENSE ├── config └── Config.toml ├── README.md ├── start └── docker-compose.yml /.gitignore: -------------------------------------------------------------------------------- 1 | bns/ 2 | persistent-data/ 3 | .DS_Store 4 | .env 5 | stacks/ 6 | stacks-blockchain-api/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Syvita Guild 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/Config.toml: -------------------------------------------------------------------------------- 1 | # stacks node config 2 | [node] 3 | # where the node stores stacks chain data 4 | working_dir = "/root/stacks-node/data" 5 | rpc_bind = "0.0.0.0:20443" 6 | p2p_bind = "0.0.0.0:20444" 7 | # the nodes used to bootstrap your node 8 | # these are hiro's nodes, but you can use any other nodes too 9 | bootstrap_node = "02da7a464ac770ae8337a343670778b93410f2f3fef6bea98dd1c3e9224459d36b@seed-0.mainnet.stacks.co:20444,02afeae522aab5f8c99a00ddf75fbcb4a641e052dd48836408d9cf437344b63516@seed-1.mainnet.stacks.co:20444,03652212ea76be0ed4cd83a25c06e57819993029a7b9999f7d63c36340b34a4e62@seed-2.mainnet.stacks.co:20444" 10 | 11 | # time in ms to wait for a microblock 12 | wait_time_for_microblocks = 10000 13 | 14 | [[events_observer]] 15 | endpoint = "stacks-blockchain-api:3700" 16 | retry_count = 255 17 | events_keys = ["*"] 18 | 19 | [burnchain] 20 | chain = "bitcoin" 21 | mode = "mainnet" 22 | 23 | # YOU SHOULD BE RUNNING YOUR OWN BITCOIN CORE NODE 24 | # https://docs.syvita.org/understand-stacks/running-mainnet-node#step-2-running-bitcoin-core 25 | 26 | # this is halo's bitcoin core node 27 | # change to "localhost" if Bitcoin Core is running on the same system 28 | peer_host = "94.237.60.208" 29 | username = "" 30 | password = "" 31 | rpc_port = 8332 32 | peer_port = 8333 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stacks API Node easy start 2 | 3 | ## Quickstart 4 | 5 | ### Requirements 6 | 7 | **IMPORTANT:** You need **ALL** of these to use this guide. This guide has only been tested to work on macOS! 8 | 9 | - [Docker](https://www.docker.com/products/docker-desktop) 10 | - [Git](https://git-scm.com) 11 | - [docker-compose](https://docs.docker.com/compose/install/#install-compose) (no install needed if you have Docker Desktop installed from above on macOS and Windows) 12 | 13 | ### let's go! 14 | 15 | Open a terminal of some sort: 16 | 17 | - macOS - Terminal 18 | - Windows 10 - Console 19 | - Windows 11 - Windows Terminal 20 | - Linux - if you are using Linux, you should know how to use a terminal... lol 21 | 22 | This command: 23 | 24 | 1. Downloads this code 25 | 2. Enters the folder 26 | 3. Starts the quickstart sequence 27 | 28 | ```sh 29 | git clone https://github.com/syvita/stacks-api-node 30 | cd stacks-api-node 31 | sh start 32 | ``` 33 | 34 | **NOTE:** You might have to use `sudo sh start` instead of `sh start` if you encounter permission issues with Docker on Linux. 35 | 36 | The quickstart sequence: 37 | 38 | 1. Downloads the Stacks node code 39 | 2. Downloads the Stacks API code 40 | 3. Builds the Stacks node to run on your system (can take upwards of 10min) 41 | 4. Builds the Stacks API to run on your system (usually around 5min) 42 | 5. Boots up the database, node, API and explorer 43 | 44 | It can take anywhere from a few hours to weeks to sync up to the blockchain based on how fast your internet connection is. The API might take a while to be available. 45 | 46 | More details are shown in your console after the bootup sequence. 47 | -------------------------------------------------------------------------------- /start: -------------------------------------------------------------------------------- 1 | NODE_TAG="2.0.11.3.0" 2 | NODE_SRC="https://github.com/syvita/stacks" 3 | API_TAG="v0.70.1" 4 | API_SRC="https://github.com/syvita/stacks-blockchain-api" 5 | 6 | echo "ℹ️ Cloning Stacks node..." 7 | git clone https://github.com/syvita/stacks 8 | git clone --depth 1 --branch $NODE_TAG $NODE_SRC 9 | echo "\nℹ️ Cloning Stacks API..." 10 | git clone --depth 1 --branch $API_TAG $API_SRC 11 | 12 | echo "\nℹ️ Building Stacks node..." 13 | cd stacks 14 | docker build . -t stacks-blockchain:$NODE_TAG 15 | echo "✅ Built Stacks node successfully" 16 | cd .. 17 | 18 | echo "\nℹ️ Building Stacks API..." 19 | cd stacks-blockchain-api 20 | docker build . -t stacks-api:$API_TAG 21 | echo "✅ Built Stacks API successfully" 22 | cd .. 23 | 24 | echo "\nℹ️ Creating Postgres volume..." 25 | docker volume create --name=postgres 26 | echo "✅ Created Postgres volume" 27 | 28 | echo "\nℹ️ Attempting bootup sequence" 29 | docker-compose up -d 30 | echo "✅ System bootup complete. Congrats!" 31 | 32 | echo "\nYou now have a: 33 | - Stacks node running on ports 20443 & 20444 34 | - API available at http://localhost:3999 (with 3700 for the Stacks node to send events to) 35 | - Postgres database (used for the API) on port 5432 36 | - Syvirean Explorer available at http://localhost:3099 37 | 38 | Make sure to wait a while for the node to fully sync. 39 | 40 | ℹ️ This could take a few hours to a week or so depending on how fast your connection is. 41 | 42 | After you're fully synced up, you'll be able to switch your wallets over to use your local API. 43 | 44 | You won't need to use Syvita's or Hiro's explorer either - just use yours running on http://localhost:3099 45 | 46 | Congrats again! Welcome to the Revolution! ⚒️ 🔥" 47 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | postgres: 4 | restart: always 5 | image: "postgres:alpine" 6 | ports: 7 | - "5432:5432" 8 | environment: 9 | POSTGRES_USER: postgres 10 | POSTGRES_PASSWORD: postgres 11 | POSTGRES_DB: stacks_blockchain_api 12 | POSTGRES_PORT: 5432 13 | volumes: 14 | - postgres:/var/lib/postgresql/data 15 | networks: 16 | - backend 17 | stacks-blockchain: 18 | image: "stacks-blockchain:2.0.11.3.0" 19 | command: /bin/stacks-node start --config /src/stacks-node/Config.toml 20 | restart: always 21 | ports: 22 | - "20443:20443" 23 | - "20444:20444" 24 | volumes: 25 | - ./config:/src/stacks-node 26 | - ./persistent-data/stacks-blockchain:/root/stacks-node/data 27 | networks: 28 | - backend 29 | depends_on: 30 | - stacks-blockchain-api 31 | environment: 32 | STACKS_LOG_DEBUG: 1 33 | stacks-explorer: 34 | image: "ghcr.io/syvita/explorer:latest" 35 | restart: always 36 | environment: 37 | NEXT_PUBLIC_MAINNET_API_SERVER: http://0.0.0.0:3999 38 | ports: 39 | - "3099:3000" 40 | networks: 41 | - backend 42 | depends_on: 43 | - stacks-blockchain-api 44 | stacks-blockchain-api: 45 | image: "stacks-api:v0.70.1" 46 | restart: always 47 | environment: 48 | NODE_ENV: production 49 | GIT_TAG: master 50 | PG_HOST: postgres 51 | PG_PORT: 5432 52 | PG_USER: postgres 53 | PG_PASSWORD: postgres 54 | PG_DATABASE: stacks_blockchain_api 55 | STACKS_CHAIN_ID: 0x00000001 56 | V2_POX_MIN_AMOUNT_USTX: 90000000260 57 | STACKS_CORE_EVENT_PORT: 3700 58 | STACKS_CORE_EVENT_HOST: 0.0.0.0 59 | STACKS_BLOCKCHAIN_API_PORT: 3999 60 | STACKS_BLOCKCHAIN_API_HOST: 0.0.0.0 61 | STACKS_BLOCKCHAIN_API_DB: pg 62 | STACKS_CORE_RPC_HOST: stacks-blockchain 63 | STACKS_CORE_RPC_PORT: 20443 64 | #BNS_IMPORT_DIR: /bns-data 65 | ports: 66 | - "3700:3700" 67 | - "3999:3999" 68 | volumes: 69 | - ./bns:/bns-data 70 | networks: 71 | - backend 72 | depends_on: 73 | - postgres 74 | 75 | volumes: 76 | postgres: 77 | external: true 78 | 79 | networks: 80 | backend: 81 | 82 | --------------------------------------------------------------------------------