You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-31Lines changed: 45 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
## Quick start
9
9
10
-
A self-contained Docker image is provided which starts a Stacks 2.05 blockchain and API instance.
10
+
A self-contained Docker image is provided, which starts a Stacks 2.05 blockchain and API instance.
11
11
12
12
Ensure Docker is installed, then run the command:
13
13
@@ -21,7 +21,7 @@ Similarly, a "mocknet" instance can be started. This runs a local node, isolated
21
21
docker run -p 3999:3999 -e STACKS_NETWORK=mocknet hirosystems/stacks-blockchain-api-standalone
22
22
```
23
23
24
-
Once the blockchain has synced with network, the API will be available at:
24
+
Once the blockchain has synced with the network, the API will be available at:
25
25
[http://localhost:3999](http://localhost:3999)
26
26
27
27
## Development quick start
@@ -40,7 +40,7 @@ Check to see if the server started successfully by visiting http://localhost:399
40
40
41
41
### Setup Services
42
42
43
-
Then run `npm run devenv:deploy` which uses docker-compose to deploy the service dependencies (e.g. PostgreSQL, Stacks core node, etc).
43
+
Then run `npm run devenv:deploy`, which uses docker-compose to deploy the service dependencies (e.g., PostgreSQL, Stacks core node, etc.)
44
44
45
45
### Running the server
46
46
@@ -54,66 +54,80 @@ See [overview.md](overview.md) for architecture details.
54
54
55
55
# Deployment
56
56
57
-
For optimal performance, we recommend running the API database on PostgreSQL version 14 or newer.
57
+
We recommend running the API database on PostgreSQL version 14 or newer for optimal performance.
58
58
59
59
## Upgrading
60
60
61
-
If upgrading the API to a new major version (e.g. `3.0.0` to `4.0.0`) then the Postgres database from the previous version will not be compatible and the process will fail to start.
61
+
If upgrading the API to a new major version (e.g.,`3.0.0` to `4.0.0`), then the Postgres database from the previous version will not be compatible, and the process will fail to start.
62
62
63
-
[Event Replay](#event-replay) must be used when upgrading major versions. Follow the event replay [instructions](#event-replay-instructions) below. Failure to do so will require wiping both the Stacks Blockchain chainstate data and the API Postgres database, and re-syncing from scratch.
63
+
[Event Replay](#event-replay) must be used when upgrading major versions. Follow the event replay [instructions](#event-replay-instructions) below. Failure to do so will require wiping the Stacks Blockchain chain state data and the API Postgres database and re-syncing from scratch.
64
64
65
65
## API Run Modes
66
66
67
-
The API supports a series of run modes, each accommodating different use cases for scaling and data access by toggling [architecture](#architecture) components on or off depending on its objective.
67
+
The API supports a series of run modes, each accommodating different use cases for scaling and data access by toggling [architecture](#architecture) components on or off, depending on its objective.
68
68
69
69
### Default mode (Read-write)
70
70
71
-
The default mode runs with all components enabled. It consumes events from a Stacks node, writes them to a postgres database, and serves API endpoints.
71
+
The default mode runs with all components enabled. It consumes events from a Stacks node, writes them to a Postgres database, and serves API endpoints.
72
72
73
73
### Write-only mode
74
74
75
-
During Write-only mode, the API only runs the Stacks node events server to populate the postgres database but it does not serve any API endpoints.
75
+
During Write-only mode, the API only runs the Stacks node events server to populate the Postgres database, but it does not serve any API endpoints.
76
76
77
-
This mode is very useful when you need to consume blockchain data from the postgres database directly and you're not interested in taking on the overhead of running an API web server.
77
+
This mode is very useful when you need to consume blockchain data from the Postgres database directly, and you're not interested in taking on the overhead of running an API web server.
78
78
79
79
For write-only mode, set the environment variable `STACKS_API_MODE=writeonly`.
80
80
81
81
### Read-only mode
82
82
83
83
During Read-only mode, the API runs without an internal event server that listens to events from a Stacks node.
84
-
The API only reads data from the connected postgres database when building endpoint responses.
84
+
The API only reads data from the connected Postgres database when building endpoint responses.
85
85
In order to keep serving updated blockchain data, this mode requires the presence of another API instance that keeps writing stacks-node events to the same database.
86
86
87
-
This mode is very useful when building an environment that load-balances incoming HTTP requests between multiple API instances that can be scaled up and down very quickly.
88
-
Read-only instances support websockets and socket.io clients.
87
+
This mode is very useful when building an environment that load-balances incoming HTTP requests between multiple API instances that can be scaled up and down quickly.
88
+
Read-only instances support WebSockets and socket.io clients.
89
89
90
90
For read-only mode, set the environment variable `STACKS_API_MODE=readonly`.
91
91
92
92
### Offline mode
93
93
94
-
In Offline modeapp runs without a stacks-node or postgres connection. In this mode, only the given rosetta endpoints are supported:
94
+
In Offline mode, the app runs without a stacks-node or Postgres connection. In this mode, only the given rosetta endpoints are supported:
For running offline mode set an environment variable `STACKS_API_MODE=offline`
97
+
For running offline mode, set an environment variable `STACKS_API_MODE=offline`
98
98
99
99
## Event Replay
100
100
101
101
The stacks-node is only able to emit events live as they happen. This poses a problem in the
102
-
scenario where the stacks-blockchain-api needs to be upgraded and its database cannot be migrated to
102
+
scenario where the stacks-blockchain-API needs to be upgraded, and its database cannot be migrated to
103
103
a new schema. One way to handle this upgrade is to wipe the stacks-blockchain-api's database and
104
-
stacks-node working directory, and re-sync from scratch.
104
+
stacks-node working directory and re-sync from scratch.
105
105
106
106
Alternatively, an event-replay feature is available where the API records the HTTP POST requests
107
107
from the stacks-node event emitter, then streams these events back to itself. Essentially simulating
108
108
a wipe & full re-sync, but much quicker.
109
109
110
-
The feature can be used via program args. For example, if there are breaking changes in the API's
111
-
sql schema, like adding a new column which requires event's to be re-played, the following steps
112
-
could be ran:
110
+
The feature can be used via program args. For example, if there are breaking changes in the APIs
111
+
SQL schema, like adding a new column that requires events to be re-played, the following steps
112
+
could be run:
113
113
114
-
### Event Replay Instructions
114
+
### Event Replay V2
115
115
116
-
#### V1 BNS Data
116
+
This version of the replay process relies on parquet files processing instead of TSV files.
117
+
118
+
There are some improvements on the replay process and this version is is, around, 10x times faster than the previous (V1) one.
119
+
120
+
__Note: the previous event-replay version is still available and can be used as well, for the same purpose.__
121
+
122
+
#### Instructions
123
+
124
+
To run the new event-replay, please follow the instructions at [stacks-event-replay](https://github.com/hirosystems/stacks-event-replay#installation) repository.
125
+
126
+
### Event Replay V1
127
+
128
+
#### Instructions
129
+
130
+
##### V1 BNS Data
117
131
118
132
**Optional but recommended** - If you want the V1 BNS data, there are going to be a few extra steps:
119
133
@@ -139,7 +153,7 @@ could be ran:
139
153
```
140
154
1. Set the data's location as the value of `BNS_IMPORT_DIR` in your `.env` file.
141
155
142
-
#### Export and Import
156
+
##### Export and Import
143
157
144
158
1. Ensure the API process is not running. When stopping the API, let the process exit gracefully so
145
159
that any in-progress SQL writes can finish.
@@ -162,29 +176,29 @@ could be ran:
162
176
* `archival` (default): The process will import and ingest *all* blockchain events that have
163
177
happened since the first block.
164
178
* `pruned`: The import process will ignore some prunable events (mempool, microblocks) until the
165
-
import block height has reached `chain tip - 256` blocks. This saves a considerable amount of
166
-
time during import, but sacrifices some historical data. You can use this mode if you're mostly
167
-
interested in running an API that prioritizes realtime information.
179
+
import block height has reached `chain tip - 256` blocks. This saves considerable
180
+
time during import but sacrifices some historical data. You can use this mode if you're mostly
181
+
interested in running an API that prioritizes real-time information.
168
182
169
183
## Bugs and feature requests
170
184
171
185
If you encounter a bug or have a feature request, we encourage you to follow the steps below:
172
186
173
187
1. **Search for existing issues:** Before submitting a new issue, please search [existing and closed issues](../../issues) to check if a similar problem or feature request has already been reported.
174
188
1. **Open a new issue:** If it hasn't been addressed, please [open a new issue](../../issues/new/choose). Choose the appropriate issue template and provide as much detail as possible, including steps to reproduce the bug or a clear description of the requested feature.
175
-
1. **Evaluation SLA:** Our team reads and evaluates all the issues and pull requests. We are avaliable Monday to Friday and we make a best effort to respond within 7 business days.
189
+
1. **Evaluation SLA:** Our team reads and evaluates all the issues and pull requests. We are available Monday to Friday and make our best effort to respond within 7 business days.
176
190
177
191
Please **do not** use the issue tracker for personal support requests or to ask for the status of a transaction. You'll find help at the [#support Discord channel](https://discord.gg/SK3DxdsP).
178
192
179
193
## Contribute
180
194
181
-
Development of this product happens in the open on GitHub, and we are grateful to the community forcontributing bugfixes and improvements. Read below to learn how you can take partin improving the product.
195
+
Development of this product happens in the open on GitHub, and we are grateful to the community forcontributing bug fixes and improvements. Read below to learn how you can take partin improving the product.
182
196
183
197
### Code of Conduct
184
-
Please read our [Code of conduct](../../../.github/blob/main/CODE_OF_CONDUCT.md) since we expect project participants to adhere to it.
198
+
Please read our [Code of Conduct](../../../.github/blob/main/CODE_OF_CONDUCT.md) since we expect project participants to adhere to it.
185
199
186
200
### Contributing Guide
187
-
Read our [contributing guide](.github/CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes.
201
+
Read our [contributing guide](.github/CONTRIBUTING.md) to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes.
188
202
189
203
### Community
190
204
@@ -199,4 +213,4 @@ Join our community and stay connected with the latest updates and discussions:
199
213
200
214
## Client library
201
215
202
-
You can use the Stacks Blockchain API Client library if you require a way to call the API via JavaScript or receive real-time updates via Websockets or Socket.io. Learn more [here](client/README.md).
216
+
You can use the Stacks Blockchain API Client library if you need to call the API via JavaScript or receive real-time updates via WebSockets or Socket.io. Learn more [here](client/README.md).
Copy file name to clipboardExpand all lines: content/faqs.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
---
2
-
Title: FAQ's
2
+
Title: FAQs
3
3
---
4
4
5
-
# FAQ's
5
+
# FAQs
6
6
7
7
#### **I am attempting to receive the status from a local Stacks Blockchain node API and present to a user how close it is to being synced. I can retrieve the current height of the local node (`/v2/info`). Is there any way for me to retrieve the real current height from an API node that is not completely synced? I want to avoid going directly to the centrally-hosted node.**
0 commit comments