Skip to content

Commit 443203a

Browse files
authored
Merge pull request #1993 from hirosystems/develop
Cut release v7.11.0
2 parents a8cd825 + 5ce9b44 commit 443203a

File tree

74 files changed

+2303
-5186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2303
-5186
lines changed

.env

+5
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ STACKS_CORE_RPC_PORT=20443
9393
# STACKS_FAUCET_NODE_HOST=<IP or hostname>
9494
# STACKS_FAUCET_NODE_PORT=<port number>
9595

96+
# A comma-separated list of STX private keys which will send faucet transactions to accounts that
97+
# request them. Attempts will always be made from the first account, only once transaction chaining
98+
# gets too long the faucet will start using the next one.
99+
# FAUCET_PRIVATE_KEY=
100+
96101
## configure the chainID/networkID; testnet: 0x80000000, mainnet: 0x00000001
97102
STACKS_CHAIN_ID=0x00000001
98103

.github/workflows/ci.yml

+41-46
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ jobs:
158158
if: always()
159159

160160
- name: Upload coverage to Codecov
161-
uses: codecov/codecov-action@v3
161+
uses: codecov/codecov-action@v4
162+
with:
163+
token: ${{ secrets.CODECOV_TOKEN }}
162164
if: always()
163165

164166
- name: Upload coverage to Coveralls
@@ -214,7 +216,9 @@ jobs:
214216
if: always()
215217

216218
- name: Upload coverage to Codecov
217-
uses: codecov/codecov-action@v3
219+
uses: codecov/codecov-action@v4
220+
with:
221+
token: ${{ secrets.CODECOV_TOKEN }}
218222
if: always()
219223

220224
- name: Upload coverage to Coveralls
@@ -273,7 +277,9 @@ jobs:
273277
if: always()
274278

275279
- name: Upload coverage to Codecov
276-
uses: codecov/codecov-action@v3
280+
uses: codecov/codecov-action@v4
281+
with:
282+
token: ${{ secrets.CODECOV_TOKEN }}
277283
if: always()
278284

279285
- name: Upload coverage to Coveralls
@@ -332,7 +338,9 @@ jobs:
332338
if: always()
333339

334340
- name: Upload coverage to Codecov
335-
uses: codecov/codecov-action@v3
341+
uses: codecov/codecov-action@v4
342+
with:
343+
token: ${{ secrets.CODECOV_TOKEN }}
336344
if: always()
337345

338346
- name: Upload coverage to Coveralls
@@ -391,7 +399,9 @@ jobs:
391399
if: always()
392400

393401
- name: Upload coverage to Codecov
394-
uses: codecov/codecov-action@v3
402+
uses: codecov/codecov-action@v4
403+
with:
404+
token: ${{ secrets.CODECOV_TOKEN }}
395405
if: always()
396406

397407
- name: Upload coverage to Coveralls
@@ -450,7 +460,9 @@ jobs:
450460
if: always()
451461

452462
- name: Upload coverage to Codecov
453-
uses: codecov/codecov-action@v3
463+
uses: codecov/codecov-action@v4
464+
with:
465+
token: ${{ secrets.CODECOV_TOKEN }}
454466
if: always()
455467

456468
- name: Upload coverage to Coveralls
@@ -509,7 +521,9 @@ jobs:
509521
if: always()
510522

511523
- name: Upload coverage to Codecov
512-
uses: codecov/codecov-action@v3
524+
uses: codecov/codecov-action@v4
525+
with:
526+
token: ${{ secrets.CODECOV_TOKEN }}
513527
if: always()
514528

515529
- name: Upload coverage to Coveralls
@@ -586,7 +600,9 @@ jobs:
586600
if: always()
587601

588602
- name: Upload coverage to Codecov
589-
uses: codecov/codecov-action@v3
603+
uses: codecov/codecov-action@v4
604+
with:
605+
token: ${{ secrets.CODECOV_TOKEN }}
590606
if: always()
591607

592608
- name: Upload coverage to Coveralls
@@ -645,7 +661,9 @@ jobs:
645661
if: always()
646662

647663
- name: Upload coverage to Codecov
648-
uses: codecov/codecov-action@v3
664+
uses: codecov/codecov-action@v4
665+
with:
666+
token: ${{ secrets.CODECOV_TOKEN }}
649667
if: always()
650668

651669
- name: Upload coverage to Coveralls
@@ -704,7 +722,9 @@ jobs:
704722
if: always()
705723

706724
- name: Upload coverage to Codecov
707-
uses: codecov/codecov-action@v3
725+
uses: codecov/codecov-action@v4
726+
with:
727+
token: ${{ secrets.CODECOV_TOKEN }}
708728
if: always()
709729

710730
- name: Upload coverage to Coveralls
@@ -771,7 +791,9 @@ jobs:
771791
if: always()
772792

773793
- name: Upload coverage to Codecov
774-
uses: codecov/codecov-action@v3
794+
uses: codecov/codecov-action@v4
795+
with:
796+
token: ${{ secrets.CODECOV_TOKEN }}
775797
if: always()
776798

777799
- name: Upload coverage to Coveralls
@@ -838,7 +860,9 @@ jobs:
838860
if: always()
839861

840862
- name: Upload coverage to Codecov
841-
uses: codecov/codecov-action@v3
863+
uses: codecov/codecov-action@v4
864+
with:
865+
token: ${{ secrets.CODECOV_TOKEN }}
842866
if: always()
843867

844868
- name: Upload coverage to Coveralls
@@ -851,13 +875,6 @@ jobs:
851875

852876
build-publish:
853877
runs-on: ubuntu-latest
854-
needs:
855-
- lint
856-
- lint-docs
857-
- test
858-
- test-bns
859-
- test-rosetta
860-
- test-rosetta-cli-construction
861878
steps:
862879
- uses: actions/checkout@v3
863880
with:
@@ -886,6 +903,9 @@ jobs:
886903
@semantic-release/exec@6.0.3
887904
conventional-changelog-conventionalcommits@6.1.0
888905
906+
- name: Set up QEMU
907+
uses: docker/setup-qemu-action@v3
908+
889909
- name: Set up Docker Buildx
890910
uses: docker/setup-buildx-action@v3
891911

@@ -901,21 +921,7 @@ jobs:
901921
type=ref,event=pr
902922
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
903923
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
904-
type=raw,value=latest,enable={{is_default_branch}}
905-
906-
- name: Docker Standalone Meta
907-
id: meta_standalone
908-
uses: docker/metadata-action@v5
909-
with:
910-
images: |
911-
blockstack/${{ github.event.repository.name }}-standalone
912-
hirosystems/${{ github.event.repository.name }}-standalone
913-
tags: |
914-
type=ref,event=branch
915-
type=ref,event=pr
916-
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
917-
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
918-
type=raw,value=latest,enable={{is_default_branch}}
924+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
919925
920926
- name: Login to DockerHub
921927
uses: docker/login-action@v3
@@ -927,23 +933,12 @@ jobs:
927933
uses: docker/build-push-action@v5
928934
with:
929935
context: .
936+
platforms: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
930937
tags: ${{ steps.meta.outputs.tags }}
931938
labels: ${{ steps.meta.outputs.labels }}
932939
# Only push if (there's a new release on main branch, or if building a non-main branch) and (Only run on non-PR events or only PRs that aren't from forks)
933940
push: ${{ (github.ref != 'refs/heads/master' || steps.semantic.outputs.new_release_version != '') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
934941

935-
- name: Build/Tag/Push Standalone Image
936-
uses: docker/build-push-action@v5
937-
with:
938-
context: .
939-
build-args: |
940-
STACKS_API_VERSION=${{ github.head_ref || github.ref_name }}
941-
file: docker/rosetta.Dockerfile
942-
tags: ${{ steps.meta_standalone.outputs.tags }}
943-
labels: ${{ steps.meta_standalone.outputs.labels }}
944-
# Only push if (there's a new release on main branch, or if building a non-main branch) and (Only run on non-PR events or only PRs that aren't from forks)
945-
push: ${{ (github.ref != 'refs/heads/master' || steps.semantic.outputs.new_release_version != '') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
946-
947942
- name: API Discord notification
948943
if: steps.semantic.outputs.new_release_version != ''
949944
uses: Ilshidur/action-discord@master

README.md

+14-20
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,43 @@
22

33
[![CI](https://github.com/hirosystems/stacks-blockchain-api/actions/workflows/ci.yml/badge.svg)](https://github.com/hirosystems/stacks-blockchain-api/actions/workflows/ci.yml)
44
[![GitHub Releases](https://img.shields.io/github/v/release/hirosystems/stacks-blockchain-api?display_name=release)](https://github.com/hirosystems/stacks-blockchain-api/releases/latest)
5-
[![Docker Pulls](https://img.shields.io/docker/pulls/blockstack/stacks-blockchain-api-standalone)](https://hub.docker.com/r/hirosystems/stacks-blockchain-api-standalone/)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/blockstack/stacks-blockchain-api)](https://hub.docker.com/r/hirosystems/stacks-blockchain-api/)
66
[![NPM client package](https://img.shields.io/badge/npm-%40stacks%2Fblockchain--api--client-blue)](https://www.npmjs.org/package/@stacks/blockchain-api-client)
77

88
## Quick start
99

10-
A self-contained Docker image is provided, which starts a Stacks 2.05 blockchain and API instance.
10+
### Local
1111

12-
Ensure Docker is installed, then run the command:
12+
This service requires `postgres`, `stacks-node`, `bitcoind`, and a few other components in order to run.
13+
The [`clarinet`](https://github.com/hirosystems/clarinet) project provides an easy way to spin up the API and all these services:
14+
> clarinet devnet - a local standalone development environment that simulates Bitcoin, Stacks node and other helpful components, similar to a staging environment.
1315
14-
```shell
15-
docker run -p 3999:3999 hirosystems/stacks-blockchain-api-standalone
16-
```
16+
Get started at https://docs.hiro.so/clarinet/getting-started
1717

18-
Similarly, a "mocknet" instance can be started. This runs a local node, isolated from the testnet/mainnet:
18+
### Production
1919

20-
```shell
21-
docker run -p 3999:3999 -e STACKS_NETWORK=mocknet hirosystems/stacks-blockchain-api-standalone
22-
```
20+
The docker image `hirosystems/stacks-blockchain-api` is recommended when running the API in a mainnet or testnet environment.
21+
22+
Note that this image cannot be ran standalone. Other services need to be configured correctly and running. For more information see https://docs.hiro.so/stacks-blockchain-api/how-to-guides/how-to-run-api-node
2323

24-
Once the blockchain has synced with the network, the API will be available at:
25-
[http://localhost:3999](http://localhost:3999)
2624

2725
## Development quick start
2826

2927
First, ensure Docker is installed on your machine.
3028

3129
Clone repo and install dependencies with `npm install`.
3230

33-
Run `npm run dev:integrated`.
31+
VSCode is recommended for development. Pre-configured "run and debug" configurations are included. Run using `Launch: w/ postgres`.
3432

35-
This command will concurrently start the API server app and the service dependencies.
33+
Alternatively, use the command `npm run dev:integrated` -- this command will concurrently start the API server app and the service dependencies.
3634

3735
Check to see if the server started successfully by visiting http://localhost:3999/extended/v1/status
3836

3937
## Local Development
4038

41-
### Setup Services
42-
43-
Then run `npm run devenv:deploy`, which uses docker-compose to deploy the service dependencies (e.g., PostgreSQL, Stacks core node, etc.)
44-
45-
### Running the server
39+
To run the server, run `npm run dev:integrated`, which uses docker-compose to deploy the service dependencies (e.g., PostgreSQL, Stacks core node, etc.).
4640

47-
To run the server in 'watch' mode (restart for every code change), run `npm run dev:watch`. You'll have a server on port 3999.
41+
You'll have a server on port 3999.
4842

4943
# Architecture
5044

client/README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ await sub.unsubscribe();
4545
### Socket.io
4646

4747
```js
48-
import { io } from "socket.io-client";
49-
import * as stacks from '@stacks/blockchain-api-client';
48+
import { StacksApiSocketClient } from '@stacks/blockchain-api-client';
5049

51-
// for testnet, replace with https://api.testnet.hiro.so/
52-
const socketUrl = "https://api.mainnet.hiro.so/";
50+
// for testnet, replace with https://api.testnet.hiro.so
51+
const socketUrl = "https://api.mainnet.hiro.so";
5352

54-
const socket = io(socketUrl);
55-
const sc = new stacks.StacksApiSocketClient(socket);
53+
const sc = new StacksApiSocketClient({ url: socketUrl });
5654

5755
sc.subscribeAddressTransactions('ST3GQB6WGCWKDNFNPSQRV8DY93JN06XPZ2ZE9EVMA', (address, tx) => {
5856
console.log('address:', address);

client/src/socket-io/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ function createStacksApiSocket(opts?: StacksApiSocketConnectionOptions) {
4646
subscriptions: Array.from(new Set(opts?.subscriptions)).join(','),
4747
},
4848
};
49+
if (!socketOpts.transports) {
50+
socketOpts.transports = ['websocket'];
51+
}
4952
const socket: StacksApiSocket = io(getWsUrl(opts?.url ?? BASE_PATH).href, socketOpts);
5053
return socket;
5154
}

config/token-metadata-image-cache-imgix.js

-7
This file was deleted.

docker/docker-compose.dev.stacks-blockchain.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.7'
22
services:
33
stacks-blockchain:
4-
image: 'hirosystems/stacks-api-e2e:stacks3.0-4d11d85'
4+
image: 'hirosystems/stacks-api-e2e:stacks3.0-0a2c0e2'
55
restart: on-failure
66
environment:
77
STACKS_EVENT_OBSERVER: host.docker.internal:3700

docker/docker-compose.dev.stacks-krypton.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.7'
22
services:
33
stacks-blockchain:
4-
image: 'hirosystems/stacks-api-e2e:stacks3.0-4d11d85'
4+
image: 'hirosystems/stacks-api-e2e:stacks3.0-0a2c0e2'
55
ports:
66
- '18443:18443' # bitcoin regtest JSON-RPC interface
77
- '18444:18444' # bitcoin regtest p2p

docker/rosetta.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Running with `SEED_CHAINSTATE=true` will require the container to be launched with `--shm-size=xxxxMB` where at least 256MB is recommended
22
ARG STACKS_API_VERSION=v7.1.10
3-
ARG STACKS_BLOCKCHAIN_VERSION=2.3.0.0.2
3+
ARG STACKS_BLOCKCHAIN_VERSION=2.5.0.0.2
44
ARG PG_VERSION=15
55
ARG STACKS_NETWORK=mainnet
66
ARG PG_HOST=127.0.0.1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"last_1h": 846.75,
3+
"last_24h": 635.2,
4+
"last_7d": 731.26,
5+
"last_30d": 738.67
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"type": "object",
3+
"title": "AverageBlockTimesResponse",
4+
"description": "Request to fetch average block times (in seconds)",
5+
"additionalProperties": false,
6+
"required": [
7+
"last_1h",
8+
"last_24h",
9+
"last_7d",
10+
"last_30d"
11+
],
12+
"properties": {
13+
"last_1h": {
14+
"type": "number",
15+
"description": "Average block times over the last hour (in seconds)"
16+
},
17+
"last_24h": {
18+
"type": "number",
19+
"description": "Average block times over the last 24 hours (in seconds)"
20+
},
21+
"last_7d": {
22+
"type": "number",
23+
"description": "Average block times over the last 7 days (in seconds)"
24+
},
25+
"last_30d": {
26+
"type": "number",
27+
"description": "Average block times over the last 30 days (in seconds)"
28+
}
29+
}
30+
}

docs/api/blocks/get-burn-blocks.example.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"0xdaf61d2b355f35c94cf019af99aeb73d8e7db7301c7cd693a464ebd1cfc2228c",
1414
"0xb9e9b308cf9621ecbf66ca7b4689fe384b9b67c4588ec827d8163ab602fb935e",
1515
"0x754562cba6ec243f90485e97778ab472f462fd123ef5b83cc79d8759ca8875f5"
16-
]
16+
],
17+
"avg_block_time": 15.3,
18+
"total_tx_count": 728
1719
}
1820
]
1921
}

0 commit comments

Comments
 (0)