# Mining

Endpoints related to Stacks block production and mining.

## Validate a proposed Stacks block

> Used by stackers to validate a proposed Stacks block from a miner.\
> \*\*This API endpoint requires a basic Authorization header.\*\*<br>

```json
{"openapi":"3.1.0","info":{"title":"Stacks 3.0+ RPC API","version":"1.0.0"},"tags":[{"name":"Mining","description":"Endpoints related to Stacks block production and mining."}],"servers":[{"url":"http://localhost:20443","description":"Local Stacks Node"},{"url":"https://api.mainnet.hiro.so","description":"Stacks Mainnet API"},{"url":"https://api.testnet.hiro.so","description":"Stacks Testnet API"}],"security":[{"rpcAuth":[]}],"components":{"securitySchemes":{"rpcAuth":{"type":"apiKey","in":"header","name":"authorization","description":"Plain-text secret value that must exactly equal the node's\nconfigured password, which is set as `connection_options.auth_token`\nin the node's configuration file.\n"}}},"paths":{"/v3/block_proposal":{"post":{"summary":"Validate a proposed Stacks block","tags":["Mining"],"operationId":"postBlockProposal","description":"Used by stackers to validate a proposed Stacks block from a miner.\n**This API endpoint requires a basic Authorization header.**\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["block","chain_id"],"properties":{"block":{"type":"string","minLength":400,"pattern":"^([0-9a-fA-F]{2})+$","description":"Hex-encoded block data (must be valid SIP-003 serialized block, typically 200+ bytes)"},"chain_id":{"type":"integer","minimum":0,"description":"Chain ID for the block"}}}}}},"responses":{"202":{"description":"Block proposal has been accepted for processing.\nThe result will be returned via the event observer.\n","content":{"application/json":{"schema":{"description":"Get Response for Block Proposal","type":"object","additionalProperties":false,"required":["result","message"],"properties":{"result":{"type":"string","enum":["Error","Accepted"]},"message":{"type":"string","description":"A message describing the result or error message."}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"description":"Get Response for Block Proposal","type":"object","additionalProperties":false,"required":["result","message"],"properties":{"result":{"type":"string","enum":["Error","Accepted"]},"message":{"type":"string","description":"A message describing the result or error message."}}}},"text/plain":{"schema":{"type":"string"}}}},"401":{"description":"Unauthorized. Invalid or missing authentication token.","content":{"text/plain":{"schema":{"type":"string"}}}},"429":{"description":"There is an ongoing proposal validation being processed, the new\nrequest cannot be accepted until the prior request has been processed.\n","content":{"application/json":{"schema":{"description":"Get Response for Block Proposal","type":"object","additionalProperties":false,"required":["result","message"],"properties":{"result":{"type":"string","enum":["Error","Accepted"]},"message":{"type":"string","description":"A message describing the result or error message."}}}}}},"500":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}}}
```

## Upload a Stacks block

> Upload a Stacks block to the node for processing.\
> The block must be in binary format and associated with the given consensus hash.<br>

```json
{"openapi":"3.1.0","info":{"title":"Stacks 3.0+ RPC API","version":"1.0.0"},"tags":[{"name":"Mining","description":"Endpoints related to Stacks block production and mining."}],"servers":[{"url":"http://localhost:20443","description":"Local Stacks Node"},{"url":"https://api.mainnet.hiro.so","description":"Stacks Mainnet API"},{"url":"https://api.testnet.hiro.so","description":"Stacks Testnet API"}],"security":[],"paths":{"/v2/blocks/upload/{consensus_hash}":{"post":{"summary":"Upload a Stacks block","tags":["Mining"],"operationId":"uploadLegacyBlock","description":"Upload a Stacks block to the node for processing.\nThe block must be in binary format and associated with the given consensus hash.\n","parameters":[{"name":"consensus_hash","in":"path","required":true,"description":"Consensus hash (40 hex characters)","schema":{"type":"string","pattern":"^[0-9a-f]{40}$"}}],"requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary","minLength":1,"description":"Binary-encoded Stacks block"}}}},"responses":{"200":{"description":"Block upload result","content":{"application/json":{"schema":{"type":"object","properties":{"stacks_block_id":{"type":"string","description":"The ID of the uploaded block"},"accepted":{"type":"boolean","description":"Whether the block was accepted"}}}}}},"400":{"description":"Bad request","content":{"text/plain":{"schema":{"type":"string"}}}},"404":{"description":"Not found","content":{"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stacks.co/reference/api/stacks-node-rpc/mining.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
