Skip to content

Reading snapshot state: RPC interface for fetching snapshot state by given a burnchain hash or a burnchain height #3114

Open
@gzelda

Description

@gzelda

This issue is related to #1969 which aims to split mining program from origin stacks-node

Describe the solution you'd like
Two endpoints:
GET /v2/snapshot/{burnchain_height}
GET /v2/snapshot/{hash}

The params includes the following information:

  • burnchain_height is the burnChain block height
  • burnchain_hash is the burnChain block hash

They are all uniqueIndex in snapshot table which can points to a unique row in SQLite query.

If the node cannot provide a valid snapshot state (e.g., if the node haven't reached burnchain_height or there is no burnchain_hash in the database) a 400 response is returned.

The 200 response should contain the following data:

  • block_height
  • burn_header_hash
  • sortition_hash
  • consensus_hash
  • winner_block_txid

Example response data

{
  "block_height":  666090,
  "burn_header_hash" : "000000000000000000092cb34cb90e88c39fc70f75d786d0f26ebbfc15dd872d",
  "sortition_hash": "e3d7b4e06944adba6a461b2ae50f5b0a7882ff7bbd98e2280ee88df493814439",
  "consensus_hash": "1660396b37a3441508fa954e80f578dc5805e5ed",
  "winner_block_txid": "0a3ee8755e62d83b589adc957286f5f9b09695e2e52c4cea68555be0686da0a4",
}

Metadata

Metadata

Assignees

Labels

iceboxIssues that are not being worked on

Type

No type

Projects

Status

Status: 🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions