Stacker DB
Endpoints for interacting with StackerDB instances.
Get the latest version of a chunk of data from a StackerDB instance.
Standard Stacks address (standard principal, not contract principal). Must be 28-41 characters long using Stacks c32check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^S[PTMN][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26,39}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Slot ID (u32 range)
StackerDB chunk data
Bad request
Not found
Internal Server Error
GET /v2/stackerdb/{principal}/{contract_name}/{slot_id} HTTP/1.1
Host: localhost:20443
Accept: */*
binaryGet StackerDB chunk (specific version)
Get a specific version of a chunk of data from a StackerDB instance.
Standard Stacks address (standard principal, not contract principal). Must be 28-41 characters long using Stacks c32check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^S[PTMN][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26,39}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Slot ID (u32 range)
Specific slot version (u32 range)
StackerDB chunk data
Bad request
Not found
Internal Server Error
GET /v2/stackerdb/{principal}/{contract_name}/{slot_id}/{slot_version} HTTP/1.1
Host: localhost:20443
Accept: */*
binaryGet metadata about a StackerDB instance, including slot information.
Standard Stacks address (standard principal, not contract principal). Must be 28-41 characters long using Stacks c32check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^S[PTMN][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26,39}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$StackerDB metadata
Slot identifier (unique for each DB instance)
Slot version (a lamport clock)
Data hash (hex, no 0x prefix)
signature over the above (hex, no 0x prefix)
Bad request
Not found
Internal Server Error
GET /v2/stackerdb/{principal}/{contract_name} HTTP/1.1
Host: localhost:20443
Accept: */*
[
{
"slot_id": 0,
"slot_version": 1,
"data_hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"signature": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}
]Write a chunk of data to a StackerDB instance.
The request body should contain a JSON object with the chunk data including slot_id, slot_version, signature, and hex-encoded data.
The response indicates whether the chunk was accepted, and if not, provides detailed error information. Note that failed writes return HTTP 200 with accepted: false, not HTTP error codes.
Standard Stacks address (standard principal, not contract principal). Must be 28-41 characters long using Stacks c32check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^S[PTMN][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26,39}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Slot identifier (u32 range)
Slot version (lamport clock, u32 range)
Hex-encoded signature from the stacker
^[0-9a-f]{130}$Hex-encoded chunk data (must be even length)
^([0-9a-f]{2})*$Chunk submission result (both success and failure cases)
Whether the chunk was accepted
JSON-encoded reason for rejection (only present when accepted is false)
Error code (only present when accepted is false)
Bad request
Not found
Internal Server Error
POST /v2/stackerdb/{principal}/{contract_name}/chunks HTTP/1.1
Host: localhost:20443
Content-Type: application/json
Accept: */*
Content-Length: 195
{
"slot_id": 1,
"slot_version": 2,
"sig": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01",
"data": "deadbeefcafebabe"
}{
"accepted": true,
"reason": null,
"metadata": {
"slot_id": 1,
"slot_version": 2,
"data_hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"signature": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01"
},
"code": null
}Get a list of replicas for a StackerDB instance.
Standard Stacks address (standard principal, not contract principal). Must be 28-41 characters long using Stacks c32check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^S[PTMN][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26,39}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$List of StackerDB replicas
20-byte public key hash
Bad request
Not found
Internal Server Error
GET /v2/stackerdb/{principal}/{contract_name}/replicas HTTP/1.1
Host: localhost:20443
Accept: */*
[
{
"ip": "127.0.0.1",
"port": 20444,
"public_key_hash": "03abc123..."
}
]Last updated
Was this helpful?