File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- /target
2- Cargo.lock
1+ ** /target
2+ ** / Cargo.lock
Original file line number Diff line number Diff line change @@ -28,3 +28,9 @@ sha2 = "0.10.9"
2828
2929[dev-dependencies ]
3030bitcoinkernel = " 0.0.22"
31+
32+
33+ [workspace ]
34+ members = [
35+ " examples"
36+ ]
Original file line number Diff line number Diff line change 1+ FROM ubuntu:24.04 AS builder
2+
3+ ARG RUST=1.89.0
4+ ARG ZIG_VER=0.14.1
5+ ARG TARGET=aarch64-unknown-linux-musl
6+
7+ RUN apt-get update && apt-get install -y \
8+ curl xz-utils cmake libboost1.83-dev libclang-17-dev \
9+ && rm -rf /var/lib/apt/lists/*
10+
11+ RUN curl -fSL "https://ziglang.org/download/${ZIG_VER}/zig-aarch64-linux-${ZIG_VER}.tar.xz" -o /tmp/zig.tar.xz \
12+ && tar -C /opt -xJf /tmp/zig.tar.xz \
13+ && mv /opt/zig-aarch64-linux-* /opt/zig \
14+ && ln -sf /opt/zig/zig /usr/local/bin/zig \
15+ && rm /tmp/zig.tar.xz
16+
17+ RUN curl -sSf https://sh.rustup.rs | RUSTUP_INIT_SKIP_PATH_CHECK=yes sh -s -- -y --profile minimal --default-toolchain "${RUST}" \
18+ && /root/.cargo/bin/rustup target add "${TARGET}" \
19+ && /root/.cargo/bin/cargo install --locked cargo-zigbuild
20+ ENV PATH="/root/.cargo/bin:${PATH}"
21+
22+ ENV ZIG_TARGET=aarch64-linux-musl
23+ ENV CC="zig cc -target ${ZIG_TARGET}"
24+ ENV CXX="zig c++ -target ${ZIG_TARGET}"
25+ ENV CXXFLAGS="-UNDEBUG"
26+
27+ WORKDIR /app
28+ COPY . ./
29+
30+ ENV Boost_DIR=/usr/lib/aarch64-linux-gnu/cmake/Boost-1.83.0
31+
32+ RUN cargo zigbuild --release --target aarch64-unknown-linux-musl -p examples --bin covenants_example
33+
34+ FROM alpine:3.22.1
35+ COPY --from=builder /app/target/*/release/covenants_example /covenants_example
36+ CMD ["/covenants_example","--port","5005"]
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " examples"
3+ version = " 0.0.1"
4+ edition = " 2021"
5+ publish = false
6+
7+ [[bin ]]
8+ name = " covenants_example"
9+ path = " src/covenants_example.rs"
10+
11+ [dependencies ]
12+ bitcoin = { version = " 0.32.7" , features = [" serde" ] }
13+ serde = { version = " 1.0" , features = [" derive" ] }
14+ vsock = " 0.5.1"
15+ serde_json = " 1.0"
16+ bitcoinkernel-covenants = " 0.0.23"
17+ confidential-script-lib = { path = " ../" }
18+ hex = " 0.4.3"
Original file line number Diff line number Diff line change 1+ # Covenants Example
2+
3+ > ** Experimental build using [ ` bitcoinkernel-covenants ` ] ( https://github.com/stutxo/rust-bitcoinkernel-covenants ) ** with OP_CAT, OP_CSFS and OP_CTV enabled
4+ > Not intended for production use. Use at your own risk.
5+
6+ ## Run Tests
7+
8+ ``` bash
9+ cargo test
10+ ```
11+
12+ ## Build Docker Image for Nitro Enclave
13+
14+ ``` bash
15+ docker build -f Dockerfile.example -t covenants-example .
16+ ```
17+
18+ ## Build and Run Nitro Enclave
19+
20+ ``` bash
21+ # Build the enclave image
22+ nitro-cli build-enclave \
23+ --docker-uri covenants-example \
24+ --output-file covenants_example.eif
25+
26+ # Run the enclave with specified CPU, memory, and CID
27+ nitro-cli run-enclave \
28+ --cpu-count 2 \
29+ --memory 512 \
30+ --enclave-cid 16 \
31+ --eif-path covenants_example.eif \
32+ --debug-mode
33+
34+ # Inspect running enclaves
35+ nitro-cli describe-enclaves
36+
37+ # Connect to the enclave console (replace <id> with the Enclave ID)
38+ nitro-cli console --enclave-id < id>
39+ ```
You can’t perform that action at this time.
0 commit comments