BitHive is a native staking protocol for Bitcoin. It has a modular architecture to provide shared security for all types of PoS blockchains and AVSs.
Docs: https://docs.bithive.fi/
Audits: https://docs.bithive.fi/security
NOTE: If you are building on an ARM mac, run brew install llvm first, and put the following in your .zshrc or .bashrc:
export AR=/opt/homebrew/opt/llvm/bin/llvm-ar
export CC=/opt/homebrew/opt/llvm/bin/clang
make all
Prepare:
- have
nodejsversion >= 20 - complete
Buildpreparations - if you want to run integration tests, follow
tests/__tests__/integration/README.mdto setup for integration tests
make test-unit: run rust unit testsmake test-ava: run near workspace testsmake test-integration: run integration testsmake test: run all tests
Note: If you face issues like {"CompilationError":{"PrepareError":"Deserialization"}} when running tests, try the following commands:
make build-docker: build assets via dockermake test-ava-no-build: run ava tests with assets built by dockermake test-integration-no-build: run integration tests with assets built by docker
Redeem scripts, along with const values used by them, are strictly versioned. Once a specific version of the redeem script goes alive it should NEVER be changed.
In order to use a new deposit redeem script (the script itself or its consts), please follow these steps:
- Define a new deposit message
DEPOSIT_MSG_HEX_Vxand put the hex encoded string inconsts.rs - Specify chain signatures path
CHAIN_SIGNATURES_PATH_Vxand key versionCHAIN_SIGNATURES_KEY_VERSION_Vxinconsts.rs - Add a new entry for
RedeemVersionintypes.rs - Define a function that could verify if a deposit txn is of the newly-created version in
deposit.rs, likeverify_deposit_output_v1 - Update the
redeem_versionmatch insubmit_deposit_txwith the new verify function above - Update the
deposit.redeem_version()match insign_withdrawalwith new consts defined in step 2