Stacker DB
Endpoints for interacting with StackerDB instances.
Get the latest version of a chunk of data from a StackerDB instance.
Stacks address (28-41 characters) or a Contract identifier in format {address}.{contract_name}
(e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info).
Contract names have a maximum length of 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-infoPattern: ^([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41})|([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}\.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127})$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
StackerDB chunk data
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.
Stacks address (28-41 characters) or a Contract identifier in format {address}.{contract_name}
(e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info).
Contract names have a maximum length of 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-infoPattern: ^([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41})|([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}\.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127})$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
Specific slot version
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.
Stacks address (28-41 characters) or a Contract identifier in format {address}.{contract_name}
(e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info).
Contract names have a maximum length of 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-infoPattern: ^([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41})|([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}\.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127})$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.
Stacks address (28-41 characters) or a Contract identifier in format {address}.{contract_name}
(e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info).
Contract names have a maximum length of 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-infoPattern: ^([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41})|([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}\.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127})$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
Slot version (lamport clock)
Hex-encoded signature from the stacker
^[0-9a-f]{130}$Hex-encoded chunk data
^[0-9a-f]*$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.
Stacks address (28-41 characters) or a Contract identifier in format {address}.{contract_name}
(e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info).
Contract names have a maximum length of 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-infoPattern: ^([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41})|([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}\.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127})$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?