Skip to content

LayerTwo-Labs/bip300301_enforcer

Repository files navigation

Requirements

  1. Bitcoin Core, with ZMQ support. This needs be be running with the following flags:

    user=user
    password=password
    signetblocktime=60
    signetchallenge=00141f61d57873d70d28bd28b3c9f9d6bf818b5a0d6a
    
    # this can also be set to a different address, as long
    # as you set the CLI arg for bip300301_enforcer
    zmqpubsequence=tcp://0.0.0.0:29000
    txindex=1
    
  2. Rustc & Cargo, version 1.77.0 or higher. Installing via Rustup is recommended.

Getting started

Building/running:

# Check out git submodules
$ git submodule update --init --recursive
# Compiles the project
$ cargo build

# See available options
$ cargo run -- --help

# Starts the gRPC server at localhost:50001
# Adjust these parameters to match your local Bitcoin
# Core instance
$ cargo run -- \
  --node-rpc-port=38332 \
  --node-rpc-user=user \
  --node-rpc-pass=password \
  --node-zmq-addr-sequence=tcp://0.0.0.0:29000

# You should now be able to fetch data from the server!
$ buf curl  --http2-prior-knowledge --protocol grpc \
        http://localhost:50051/cusf.validator.v1.ValidatorService/GetChainInfo
{
  "network": "NETWORK_SIGNET"
}

Logging

The application uses the tracing crate for logging. Logging is configured through setting the --log-level argument. Some examples:

# Prints ALL debug logs
$ cargo run ... --log-level DEBUG

Logs can also be configured via env vars, which take precedence over CLI args.

# Prints logs at the "info" level and above, plus our logs the "debug" level and above
$ RUST_LOG=info,bip300301_enforcer=debug cargo run ...

Working with the proto files

Code is generated with protox, and happens automatically as part of the build process.

Files are linted with protolint.

To lint the files, run:

$ protolint lint --fix proto/validator/v1/validator.proto

Code formatting

Rust code is formatted with rustfmt.

Markdown and YAML files are formatted with Prettier. The easiest way to run it is to install the Prettier VSCode extension.

To run it from the command line, install the Prettier CLI and run it from the root of the repo:

$ prettier --write .

About

CUSF software enforcing BIP300 and BIP301 rules.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages