Skip to content

Commit 59510c4

Browse files
authored
Merge pull request #1092 from hirosystems/beta
Release v3.0.0 - merge beta into master
2 parents ee80601 + a2692fa commit 59510c4

Some content is hidden

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

51 files changed

+1426
-776
lines changed

.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,8 @@ MAINNET_SEND_MANY_CONTRACT_ID=SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-man
118118
# Specify max number of STX address to store in an in-memory LRU cache (CPU optimization).
119119
# Defaults to 50,000, which should result in around 25 megabytes of additional memory usage.
120120
# STACKS_ADDRESS_CACHE_SIZE=10000
121+
122+
# Specify a URL to redirect from /doc. If this URL is not provided, server renders local documentation
123+
# of openapi.yaml for test / development NODE_ENV.
124+
# For production, /doc is not served if this env var is not provided.
125+
# API_DOCS_URL="https://docs.hiro.so/api"

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- master
77
- develop
8+
- beta
89
tags-ignore:
910
- '**'
1011
paths-ignore:

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
# [3.0.0-beta.3](https://github.com/hirosystems/stacks-blockchain-api/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2022-02-28)
2+
3+
4+
### Bug Fixes
5+
6+
* remove unused indices, add others for re-org queries ([#1087](https://github.com/hirosystems/stacks-blockchain-api/issues/1087)) ([2a2fb8d](https://github.com/hirosystems/stacks-blockchain-api/commit/2a2fb8d415e1910cb4e7ae721c28c0f711a11601))
7+
8+
# [3.0.0-beta.2](https://github.com/hirosystems/stacks-blockchain-api/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2022-02-28)
9+
10+
11+
### Bug Fixes
12+
13+
* deactivate indices before subdomain import ([#1086](https://github.com/hirosystems/stacks-blockchain-api/issues/1086)) ([d8d4d4c](https://github.com/hirosystems/stacks-blockchain-api/commit/d8d4d4c35e0fd197668b0b6c56700f437290c734))
14+
* index principal_stx_txs tx_id to speed up reorg updates ([#1080](https://github.com/hirosystems/stacks-blockchain-api/issues/1080)) ([f6d7d0c](https://github.com/hirosystems/stacks-blockchain-api/commit/f6d7d0cbf6b0bfd5a2cf0406570ed1c5d99e9220))
15+
16+
# [3.0.0-beta.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v2.1.1...v3.0.0-beta.1) (2022-02-25)
17+
18+
19+
### Bug Fixes
20+
21+
* capture re-organized txs correctly in `/extended/v1/:address/transactions` ([#1074](https://github.com/hirosystems/stacks-blockchain-api/issues/1074)) ([81d039d](https://github.com/hirosystems/stacks-blockchain-api/commit/81d039d72219c51d517d27e69cedfc0cc8e10c7e))
22+
* principal_stx_txs sorting ([#1056](https://github.com/hirosystems/stacks-blockchain-api/issues/1056)) ([b0a0e94](https://github.com/hirosystems/stacks-blockchain-api/commit/b0a0e94ecd40bab5ea7d3c7705198ac9ea0ab399))
23+
* sort NFT events by event_index too ([#1063](https://github.com/hirosystems/stacks-blockchain-api/issues/1063)) ([77b2587](https://github.com/hirosystems/stacks-blockchain-api/commit/77b25878f652393a6066dad5c6b39569eb8a194a))
24+
25+
26+
* chore!: major version bump for breaking db schema changes ([296c619](https://github.com/hirosystems/stacks-blockchain-api/commit/296c619f81c480db9246ab8ea0b9fbf3c7b982b1))
27+
28+
29+
### Features
30+
31+
* add `chain_tip` materialized view to track chain tip stats ([#1028](https://github.com/hirosystems/stacks-blockchain-api/issues/1028)) ([803ac18](https://github.com/hirosystems/stacks-blockchain-api/commit/803ac189c25b6a31ae94063a6f1a4ede1f0dba98))
32+
* add chain tip info to `/extended/v1/status` ([#1070](https://github.com/hirosystems/stacks-blockchain-api/issues/1070)) ([fb573b1](https://github.com/hirosystems/stacks-blockchain-api/commit/fb573b11e4b8768d87e6b9c557fec92945fadd9a))
33+
* added feature for rendering docs ([#991](https://github.com/hirosystems/stacks-blockchain-api/issues/991)) ([a521a39](https://github.com/hirosystems/stacks-blockchain-api/commit/a521a390b2d973851f94a8962ec2b70a5937c6a7))
34+
* change string and hex column indices to Hash method ([#1042](https://github.com/hirosystems/stacks-blockchain-api/issues/1042)) ([aae6cc0](https://github.com/hirosystems/stacks-blockchain-api/commit/aae6cc0c643a5c6056e596768080119e2c84bb21))
35+
36+
37+
### BREAKING CHANGES
38+
39+
* use event-replay to upgrade, this version includes breaking changes to the db sql schema
40+
141
## [2.1.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v2.1.0...v2.1.1) (2022-02-09)
242

343

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ COPY . .
55

66
RUN apk add --no-cache --virtual .build-deps alpine-sdk python3 git openjdk8-jre cmake
77
RUN echo "GIT_TAG=$(git tag --points-at HEAD)" >> .env
8-
RUN npm config set unsafe-perm true && npm install && npm run build && npm prune --production
8+
RUN npm config set unsafe-perm true && npm install && npm run build && npm run build:docs && npm prune --production
99
RUN apk del .build-deps
1010

1111
CMD ["node", "./lib/index.js"]

docs/api/info/get-status.example.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
2-
"server_version": "stacks-blockchain-api v0.64.1 (master:439d4f46)",
3-
"status": "ready"
2+
"server_version": "stacks-blockchain-api v1.0.7 (master:77b25878)",
3+
"status": "ready",
4+
"chain_tip": {
5+
"block_height": 48902,
6+
"block_hash": "0xa5a2923c405f8356925213bb8c479beb06d3b68ca66dd2b7397b54f8c08c5eac",
7+
"index_block_hash": "0xf46401bf3cb6a6b6181536b7de414a1fd9e004a6ece99a05de72a781b17f9819",
8+
"microblock_hash": "0xec89a572d3583b959e490bc45e0f521b775ed51d7ed13087b6df8eb82cbe75d3",
9+
"microblock_sequence": 0
10+
}
411
}

docs/api/info/get-status.schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"status": {
1616
"type": "string",
1717
"description": "the current server status"
18+
},
19+
"chain_tip": {
20+
"$ref": "../../entities/info/chain-tip.schema.json"
1821
}
1922
}
2023
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"block_height": 48902,
3+
"block_hash": "0xa5a2923c405f8356925213bb8c479beb06d3b68ca66dd2b7397b54f8c08c5eac",
4+
"index_block_hash": "0xf46401bf3cb6a6b6181536b7de414a1fd9e004a6ece99a05de72a781b17f9819",
5+
"microblock_hash": "0xec89a572d3583b959e490bc45e0f521b775ed51d7ed13087b6df8eb82cbe75d3",
6+
"microblock_sequence": 0
7+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "ChainTip",
4+
"description": "Current chain tip information",
5+
"type": "object",
6+
"additionalProperties": false,
7+
"required": [
8+
"block_height",
9+
"block_hash",
10+
"index_block_hash"
11+
],
12+
"properties": {
13+
"block_height": {
14+
"type": "integer",
15+
"description": "the current block height"
16+
},
17+
"block_hash": {
18+
"type": "string",
19+
"description": "the current block hash"
20+
},
21+
"index_block_hash": {
22+
"type": "string",
23+
"description": "the current index block hash"
24+
},
25+
"microblock_hash": {
26+
"type": "string",
27+
"description": "the current microblock hash"
28+
},
29+
"microblock_sequence": {
30+
"type": "integer",
31+
"description": "the current microblock sequence number"
32+
}
33+
}
34+
}

docs/generated.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export type SchemaMergeRootStub =
151151
| {
152152
target_block_time: number;
153153
}
154+
| ChainTip
154155
| AbstractMempoolTransaction
155156
| MempoolTokenTransferTransaction
156157
| MempoolSmartContractTransaction
@@ -1707,6 +1708,32 @@ export interface ServerStatusResponse {
17071708
* the current server status
17081709
*/
17091710
status: string;
1711+
chain_tip?: ChainTip;
1712+
}
1713+
/**
1714+
* Current chain tip information
1715+
*/
1716+
export interface ChainTip {
1717+
/**
1718+
* the current block height
1719+
*/
1720+
block_height: number;
1721+
/**
1722+
* the current block hash
1723+
*/
1724+
block_hash: string;
1725+
/**
1726+
* the current index block hash
1727+
*/
1728+
index_block_hash: string;
1729+
/**
1730+
* the current microblock hash
1731+
*/
1732+
microblock_hash?: string;
1733+
/**
1734+
* the current microblock sequence number
1735+
*/
1736+
microblock_sequence?: number;
17101737
}
17111738
/**
17121739
* GET request that returns network target block times

docs/openapi.yaml

Lines changed: 85 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ info:
1212
description: |
1313
Welcome to the API reference overview for the <a href="https://docs.hiro.so/get-started/stacks-blockchain-api">Stacks Blockchain API</a>.
1414
15-
<a href="/collection.json" download="stacks-api-collection.json">Download Postman collection</a>
15+
<a href="https://hirosystems.github.io/stacks-blockchain-api/collection.json" download="stacks-api-collection.json">Download Postman collection</a>
1616
tags:
1717
- name: Accounts
1818
description: Read-only endpoints to obtain Stacks account details
@@ -234,7 +234,10 @@ paths:
234234
tags:
235235
- Transactions
236236
operationId: get_mempool_transaction_list
237-
description: Retrieves all transactions that have been recently broadcast to the mempool. These are pending transactions awaiting confirmation.
237+
description: |
238+
Retrieves all transactions that have been recently broadcast to the mempool. These are pending transactions awaiting confirmation.
239+
240+
If you need to monitor new transactions, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates.
238241
parameters:
239242
- name: sender_address
240243
in: query
@@ -487,7 +490,10 @@ paths:
487490
tags:
488491
- Microblocks
489492
operationId: get_microblock_list
490-
description: Retrieves a list of microblocks.
493+
description: |
494+
Retrieves a list of microblocks.
495+
496+
If you need to actively monitor new microblocks, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates.
491497
parameters:
492498
- name: limit
493499
in: query
@@ -557,7 +563,10 @@ paths:
557563
/extended/v1/block:
558564
get:
559565
summary: Get recent blocks
560-
description: Retrieves a list of recently mined blocks
566+
description: |
567+
Retrieves a list of recently mined blocks
568+
569+
If you need to actively monitor new blocks, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates.
561570
tags:
562571
- Blocks
563572
operationId: get_block_list
@@ -1247,7 +1256,10 @@ paths:
12471256
/extended/v1/address/{principal}/transactions:
12481257
get:
12491258
summary: Get account transactions
1250-
description: Retrieves a list of all Transactions for a given Address or Contract Identifier. More information on Transaction types can be found [here](https://docs.stacks.co/understand-stacks/transactions#types).
1259+
description: |
1260+
Retrieves a list of all Transactions for a given Address or Contract Identifier. More information on Transaction types can be found [here](https://docs.stacks.co/understand-stacks/transactions#types).
1261+
1262+
If you need to actively monitor new transactions for an address or contract id, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates.
12511263
tags:
12521264
- Accounts
12531265
operationId: get_account_transactions
@@ -1658,10 +1670,11 @@ paths:
16581670
$ref: ./api/core-node/get-info.schema.json
16591671
example:
16601672
$ref: ./api/core-node/get-info.example.json
1673+
16611674
/extended/v1/status:
16621675
get:
1663-
summary: Get Blockchain API status
1664-
description: Retrieves the current status of the blockchain API, including the server version
1676+
summary: API status
1677+
description: Retrieves the running status of the Stacks Blockchain API, including the server version and current chain tip information.
16651678
tags:
16661679
- Info
16671680
operationId: get_status
@@ -2649,71 +2662,71 @@ paths:
26492662
example:
26502663
$ref: ./api/bns/errors/bns-unsupported-blockchain.example.json
26512664

2652-
/v1/subdomains:
2653-
get:
2654-
summary: Get All Subdomains
2655-
description: Retrieves a list of all subdomains known to the node.
2656-
tags:
2657-
- Names
2658-
operationId: get_all_subdomains
2659-
parameters:
2660-
- name: page
2661-
in: query
2662-
description: names are returned in pages of size 100, so specify the page number.
2663-
required: true
2664-
example: 3
2665-
schema:
2666-
type: integer
2667-
responses:
2668-
200:
2669-
description: Success
2670-
content:
2671-
application/json:
2672-
schema:
2673-
$ref: ./api/bns/name-querying/bns-get-all-subdomains-response.schema.json
2674-
example:
2675-
$ref: ./api/bns/name-querying/bns-get-all-subdomains-response.example.json
2676-
400:
2677-
description: Error
2678-
content:
2679-
application/json:
2680-
schema:
2681-
$ref: ./api/bns/errors/bns-error.schema.json
2682-
example:
2683-
$ref: ./api/bns/errors/bns-invalid-page.example.json
2684-
2685-
/v1/subdomains/{txid}:
2686-
get:
2687-
summary: Get Subdomain at Transaction
2688-
description: Retrieves the list of subdomain operations processed by a given transaction. The returned array includes subdomain operations that have not yet been accepted as part of any subdomain’s history (checkable via the accepted field). If the given transaction ID does not correspond to a Stacks transaction that introduced new subdomain operations, and empty array will be returned.
2689-
tags:
2690-
- Names
2691-
operationId: get_subdomain_at_transaction
2692-
parameters:
2693-
- name: txid
2694-
in: path
2695-
description: transaction id
2696-
required: true
2697-
example: d04d708472ea3c147f50e43264efdb1535f71974053126dc4db67b3ac19d41fe
2698-
schema:
2699-
type: string
2700-
responses:
2701-
200:
2702-
description: Success
2703-
content:
2704-
application/json:
2705-
schema:
2706-
$ref: ./api/bns/name-querying/bns-get-subdomain-at-tx-response.schema.json
2707-
example:
2708-
$ref: ./api/bns/name-querying/bns-get-subdomain-at-tx-response.example.json
2709-
400:
2710-
description: Error
2711-
content:
2712-
application/json:
2713-
schema:
2714-
$ref: ./api/bns/errors/bns-error.schema.json
2715-
example:
2716-
$ref: ./api/bns/errors/bns-invalid-tx-id.example.json
2665+
# /v1/subdomains:
2666+
# get:
2667+
# summary: Get All Subdomains
2668+
# description: Retrieves a list of all subdomains known to the node.
2669+
# tags:
2670+
# - Names
2671+
# operationId: get_all_subdomains
2672+
# parameters:
2673+
# - name: page
2674+
# in: query
2675+
# description: names are returned in pages of size 100, so specify the page number.
2676+
# required: true
2677+
# example: 3
2678+
# schema:
2679+
# type: integer
2680+
# responses:
2681+
# 200:
2682+
# description: Success
2683+
# content:
2684+
# application/json:
2685+
# schema:
2686+
# $ref: ./api/bns/name-querying/bns-get-all-subdomains-response.schema.json
2687+
# example:
2688+
# $ref: ./api/bns/name-querying/bns-get-all-subdomains-response.example.json
2689+
# 400:
2690+
# description: Error
2691+
# content:
2692+
# application/json:
2693+
# schema:
2694+
# $ref: ./api/bns/errors/bns-error.schema.json
2695+
# example:
2696+
# $ref: ./api/bns/errors/bns-invalid-page.example.json
2697+
#
2698+
# /v1/subdomains/{txid}:
2699+
# get:
2700+
# summary: Get Subdomain at Transaction
2701+
# description: Retrieves the list of subdomain operations processed by a given transaction. The returned array includes subdomain operations that have not yet been accepted as part of any subdomain’s history (checkable via the accepted field). If the given transaction ID does not correspond to a Stacks transaction that introduced new subdomain operations, and empty array will be returned.
2702+
# tags:
2703+
# - Names
2704+
# operationId: get_subdomain_at_transaction
2705+
# parameters:
2706+
# - name: txid
2707+
# in: path
2708+
# description: transaction id
2709+
# required: true
2710+
# example: d04d708472ea3c147f50e43264efdb1535f71974053126dc4db67b3ac19d41fe
2711+
# schema:
2712+
# type: string
2713+
# responses:
2714+
# 200:
2715+
# description: Success
2716+
# content:
2717+
# application/json:
2718+
# schema:
2719+
# $ref: ./api/bns/name-querying/bns-get-subdomain-at-tx-response.schema.json
2720+
# example:
2721+
# $ref: ./api/bns/name-querying/bns-get-subdomain-at-tx-response.example.json
2722+
# 400:
2723+
# description: Error
2724+
# content:
2725+
# application/json:
2726+
# schema:
2727+
# $ref: ./api/bns/errors/bns-error.schema.json
2728+
# example:
2729+
# $ref: ./api/bns/errors/bns-invalid-tx-id.example.json
27172730

27182731
/extended/v1/tx/block/{block_hash}:
27192732
get:

0 commit comments

Comments
 (0)