Skip to content

stacks-network/stacks-core

This branch is 33 commits behind master.

Folders and files

NameName
Last commit message
Last commit date
May 16, 2024
Jan 9, 2025
Sep 24, 2024
Dec 20, 2024
Dec 18, 2024
Mar 12, 2022
Dec 18, 2024
Jan 2, 2025
Aug 23, 2024
Aug 30, 2021
Jan 18, 2024
Jan 9, 2025
Jan 9, 2025
Feb 15, 2021
Jan 9, 2025
Jan 9, 2025
Jan 9, 2025
Dec 31, 2024
Jan 9, 2025
Jan 7, 2021
Nov 15, 2022
Jan 24, 2023
Apr 15, 2020
Jan 9, 2025
Jul 12, 2024
Jan 17, 2024
Dec 5, 2024
Jan 1, 2025
Dec 12, 2024
May 20, 2024
May 20, 2024
Mar 2, 2020
Aug 11, 2015
Dec 18, 2024
Aug 6, 2024
Jan 7, 2021
Feb 21, 2024
Dec 19, 2019

Repository files navigation

Stacks

Stacks Blockchain

Reference implementation of the Stacks blockchain in Rust.

Stacks is a layer-2 blockchain that uses Bitcoin as a base layer for security and enables decentralized apps and predictable smart contracts using the Clarity language. Stacks implements Proof of Transfer (PoX) mining that anchors to Bitcoin security. Leader election happens at the Bitcoin blockchain and Stacks (STX) miners write new blocks on the separate Stacks blockchain. With PoX there is no need to modify Bitcoin to enable smart contracts and decentralized apps.

License: GPL v3 Release Discord Chat

Building

1. Download and install Rust

For building on Windows, follow the rustup installer instructions at https://rustup.rs/.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup component add rustfmt
  • When building the master branch, ensure you are using the latest stable release:
rustup update

2. Clone the source repository:

git clone --depth=1 https://github.com/stacks-network/stacks-core.git
cd stacks-core

3. Build the project

# Fully optimized release build
cargo build --release
# Faster but less optimized build. Necessary if < 16 GB RAM
cargo build --profile release-lite

Note on building: you may set RUSTFLAGS to build binaries for your native cpu:

RUSTFLAGS="-Ctarget-cpu=native"

or uncomment these lines in ./cargo/config.toml:

# [build]
# rustflags = ["-Ctarget-cpu=native"]

Testing

Run the tests:

cargo test testnet  -- --test-threads=1

Run all unit tests in parallel using nextest:

Warning, this typically takes a few minutes

cargo nextest run

Run the testnet

You can observe the state machine in action locally by running:

cargo run --bin stacks-node -- start --config ./sample/conf/testnet-follower-conf.toml

On Windows, many tests will fail if the line endings aren't LF. Please ensure that you have git's core.autocrlf set to input when you clone the repository to avoid any potential issues. This is due to the Clarity language currently being sensitive to line endings.

Additional testnet documentation is available here and here

Release Process

The release process for the stacks blockchain is defined here

Further Reading

You can learn more by visiting the Stacks Website and checking out the documentation:

You can also read the technical papers:

Copyright and License

The code and documentation copyright are attributed to stacks.org.

This code is released under the GPL v3 license, and the docs are released under the Creative Commons license.