Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement the stacks client #228

Merged
merged 8 commits into from
Jun 5, 2024
Merged

feat: implement the stacks client #228

merged 8 commits into from
Jun 5, 2024

Conversation

djordon
Copy link
Contributor

@djordon djordon commented Jun 4, 2024

Description

Closes #176.

One of the things that we need is to fetch all stacks blocks that have been anchored to a specific bitcoin block id/hash. The core of this PR adds the code to do that. Specifically, we:

  • Fetch the stacks block IDs associated with a bitcoin block hash from the stacks API.
  • Use the stacks block IDs to get the raw stacks Blocks from a stacks node.

Note that the code here uses the new /v3/blocks/[block ID] endpoint to get the raw block data from the stacks node. This endpoint only fetches Nakamoto blocks, so we cannot test this code path without running a Nakamoto stacks node.

Changes

This PR has the following changes:

  1. Do chmod +x devenv/local/docker-compose/tests/devnet-liveness.sh
  2. Update the docker-compose.local.yml to test out running a stacks node post-Nakamoto. These changes are intended to be removed/merged with our docker-compose devnet setup when we have Nakamoto running.
  3. Updated our Dockerfiles to use the LABEL command instead of the deprecated MAINTAINER command.
  4. Add code for the Stacks client implementation. This client is assumed to be configured from a config.yaml file, which right now is signer/src/config/default.toml.

Follow-up Changes

There are some caveats that need to be addressed in follow-up PRs. The big ones are:

  1. I was unable to test the /v3/blocks/[block ID] endpoint! Getting Nakamoto to work locally has been challenging, so this PR doesn't have a working integration test. @jferrant pointed me to the docker-compose file in the stacks-regtest-env repo, which has what I need to get this over the finish line ([Feature]: Add integration tests for the Stacks Client #227).
  2. Support more stacks-node and stacks-api endpoints in the config.toml ([Feature]: Support multiple Stacks node URLs #225).

Testing information

I tested one of the StacksClient functions using a locally running stacks setup. This function hits the stacks API for stacks block IDs. I was unable to test the function that fetches the nakamoto block given the stacks block ID.

Copy link
Contributor

@netrome netrome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! I have a few comments and questions, but nothing that can't be tackled as a follow-up.

signer/src/block_observer.rs Show resolved Hide resolved
signer/README.md Outdated Show resolved Hide resolved
signer/src/stacks_api.rs Outdated Show resolved Hide resolved
signer/src/stacks_api.rs Outdated Show resolved Hide resolved
signer/src/stacks_api.rs Outdated Show resolved Hide resolved
signer/src/stacks_api.rs Show resolved Hide resolved
@djordon djordon merged commit 86a2b9a into main Jun 5, 2024
3 checks passed
@djordon djordon deleted the 176-add-stacks-client branch June 5, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sbtc bootstrap signer The sBTC Bootstrap Signer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Stacks client
2 participants