diff --git a/.github/workflows/internal-build.yml b/.github/workflows/internal-build.yml index 08ae8997..cf41ecee 100644 --- a/.github/workflows/internal-build.yml +++ b/.github/workflows/internal-build.yml @@ -234,6 +234,12 @@ jobs: pattern: image-xdr-${{ steps.ids.outputs.xdr }}-${{ matrix.arch }}.* merge-multiple: true path: /tmp/images + - name: Download Image Strkey + uses: actions/download-artifact@v4 + with: + pattern: image-strkey-${{ steps.ids.outputs.strkey }}-${{ matrix.arch }}.* + merge-multiple: true + path: /tmp/images - name: Download Image Core uses: actions/download-artifact@v4 with: diff --git a/Dockerfile b/Dockerfile index 846834fc..1266049c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ # | node:22-trixie | 13 (trixie) | ARG XDR_IMAGE=stellar-xdr-stage +ARG STRKEY_IMAGE=stellar-strkey-stage ARG CORE_IMAGE=stellar-core-stage ARG HORIZON_IMAGE=stellar-horizon-stage ARG FRIENDBOT_IMAGE=stellar-friendbot-stage @@ -35,6 +36,22 @@ FROM scratch AS stellar-xdr-stage COPY --from=stellar-xdr-builder /usr/local/cargo/bin/stellar-xdr /stellar-xdr +# strkey + +FROM rust:1-trixie AS stellar-strkey-builder +ARG STRKEY_REPO +ARG STRKEY_REF +WORKDIR /wd +RUN git clone https://github.com/${STRKEY_REPO} /wd +RUN git fetch origin ${STRKEY_REF} +RUN git checkout ${STRKEY_REF} +RUN rustup show active-toolchain || rustup toolchain install +RUN cargo install stellar-strkey --features cli --path . --locked + +FROM scratch AS stellar-strkey-stage + +COPY --from=stellar-strkey-builder /usr/local/cargo/bin/stellar-strkey /stellar-strkey + # core FROM ubuntu:24.04 AS stellar-core-builder @@ -186,6 +203,7 @@ COPY --from=stellar-lab-builder /usr/local/bin/node /node # quickstart FROM $XDR_IMAGE AS xdr +FROM $STRKEY_IMAGE AS strkey FROM $CORE_IMAGE AS core FROM $HORIZON_IMAGE AS horizon FROM $FRIENDBOT_IMAGE AS friendbot @@ -210,6 +228,7 @@ ADD dependencies / RUN /dependencies COPY --from=xdr /stellar-xdr /usr/local/bin/stellar-xdr +COPY --from=strkey /stellar-strkey /usr/local/bin/stellar-strkey COPY --from=core /stellar-core /usr/bin/stellar-core COPY --from=horizon /stellar-horizon /usr/bin/stellar-horizon COPY --from=friendbot /friendbot /usr/local/bin/friendbot diff --git a/Makefile b/Makefile index 5c61e893..a7a8ed00 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ IMAGE_JSON=.image.json # Extract configuration from selected image XDR_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "xdr") | .repo') XDR_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "xdr") | .sha') +STRKEY_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "strkey") | .repo') +STRKEY_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "strkey") | .sha') CORE_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "core") | .repo') CORE_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "core") | .sha') CORE_OPTIONS = $(shell < $(IMAGE_JSON) jq -c '.deps[] | select(.name == "core") | .options // {}') @@ -38,6 +40,7 @@ build: $(IMAGE_JSON) docker build -t stellar/quickstart:$(TAG) -f Dockerfile . \ --build-arg REVISION=$(REVISION) \ --build-arg XDR_REPO=$(XDR_REPO) --build-arg XDR_REF=$(XDR_SHA) \ + --build-arg STRKEY_REPO=$(STRKEY_REPO) --build-arg STRKEY_REF=$(STRKEY_SHA) \ --build-arg CORE_REPO="$(CORE_REPO)" --build-arg CORE_REF="$(CORE_SHA)" --build-arg CORE_OPTIONS='$(CORE_OPTIONS)' \ --build-arg RPC_REPO="$(RPC_REPO)" --build-arg RPC_REF="$(RPC_SHA)" \ --build-arg HORIZON_REPO="$(HORIZON_REPO)" --build-arg HORIZON_REF="$(HORIZON_SHA)" --build-arg HORIZON_OPTIONS='$(HORIZON_OPTIONS)' \ diff --git a/images.json b/images.json index cbd8cf4a..f0206d3b 100644 --- a/images.json +++ b/images.json @@ -7,6 +7,7 @@ }, "deps": [ { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "v24.0.0" }, + { "name": "strkey", "repo": "stellar/rs-stellar-strkey", "ref": "v0.0.14" }, { "name": "core", "repo": "stellar/stellar-core", "ref": "v24.1.0", "options": { "configure_flags": "--disable-tests" } }, { "name": "rpc", "repo": "stellar/stellar-rpc", "ref": "v24.0.0" }, { "name": "horizon", "repo": "stellar/go", "ref": "horizon-v24.0.0", "options": { "pkg": "github.com/stellar/go/services/horizon" } }, @@ -28,6 +29,7 @@ }, "deps": [ { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "v24.0.0" }, + { "name": "strkey", "repo": "stellar/rs-stellar-strkey", "ref": "v0.0.14" }, { "name": "core", "repo": "stellar/stellar-core", "ref": "v24.1.0", "options": { "configure_flags": "--disable-tests" } }, { "name": "rpc", "repo": "stellar/stellar-rpc", "ref": "v24.0.0" }, { "name": "horizon", "repo": "stellar/go", "ref": "horizon-v24.0.0", "options": { "pkg": "github.com/stellar/go/services/horizon" } }, @@ -51,6 +53,7 @@ }, "deps": [ { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "89cc1cbadf1b9a16843826954dede7fec514d8e7" }, + { "name": "strkey", "repo": "stellar/rs-stellar-strkey", "ref": "v0.0.14" }, { "name": "core", "repo": "stellar/stellar-core", "ref": "bc46d6004548ed52b0f8b7552e2351c0aa190a45", "options": { "configure_flags": "--disable-tests" } }, { "name": "rpc", "repo": "stellar/stellar-rpc", "ref": "1695c9c53a4cfc52ffb53c10da7fef60076e7bba" }, { "name": "horizon", "repo": "stellar/stellar-horizon", "ref": "88d8ba74bee93f274559d4cc67172538267ee3f2", "options": { "pkg": "github.com/stellar/stellar-horizon" } }, @@ -70,6 +73,7 @@ }, "deps": [ { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "main" }, + { "name": "strkey", "repo": "stellar/rs-stellar-strkey", "ref": "main" }, { "name": "core", "repo": "stellar/stellar-core", "ref": "master", "options": { "configure_flags": "--disable-tests" } }, { "name": "rpc", "repo": "stellar/stellar-rpc", "ref": "main" }, { "name": "horizon", "repo": "stellar/stellar-horizon", "ref": "main", "options": { "pkg": "github.com/stellar/stellar-horizon" } }, @@ -90,6 +94,7 @@ }, "deps": [ { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "main" }, + { "name": "strkey", "repo": "stellar/rs-stellar-strkey", "ref": "main" }, { "name": "core", "repo": "stellar/stellar-core", "ref": "master", "options": { "configure_flags": "--disable-tests --enable-next-protocol-version-unsafe-for-production" } }, { "name": "rpc", "repo": "stellar/stellar-rpc", "ref": "main" }, { "name": "horizon", "repo": "stellar/stellar-horizon", "ref": "main", "options": { "pkg": "github.com/stellar/stellar-horizon" } }, diff --git a/start b/start index 5fff324e..67a55c95 100755 --- a/start +++ b/start @@ -84,6 +84,8 @@ function start() { echo " quickstart: $REVISION" echo " xdr:" echo "$(stellar-xdr version | sed 's/^/ /')" + echo " strkey:" + echo "$(stellar-strkey version | sed 's/^/ /')" echo " core:" echo "$(stellar-core version 2>/dev/null | sed 's/^/ /')" echo " rpc:" @@ -101,6 +103,7 @@ function start() { echo "network id: $NETWORK_ID" echo "network root secret key: $NETWORK_ROOT_SECRET_KEY" echo "network root account id: $NETWORK_ROOT_ACCOUNT_ID" + echo "native asset contract address: $NATIVE_ASSET_CONTRACT_ADDRESS" echo "protocol version default: $PROTOCOL_VERSION_DEFAULT" echo "protocol version set: $PROTOCOL_VERSION" @@ -256,6 +259,7 @@ function process_args() { local network_id_keys=$(stellar-core convert-id $NETWORK_ID | awk -F': ' '/strKey: /{print $2}' | tail -2) export NETWORK_ROOT_SECRET_KEY=$(printf "$network_id_keys" | head -1) export NETWORK_ROOT_ACCOUNT_ID=$(printf "$network_id_keys" | tail -1) + export NATIVE_ASSET_CONTRACT_ADDRESS=$(native_asset_contract_address $NETWORK_ID) # Are we ephemeral or persistent? if [ -z "$STELLAR_MODE" ]; then @@ -868,4 +872,19 @@ function horizon_status() { echo "horizon: ingestion caught up" } +function native_asset_contract_address() { + local network_id=$1 + local contract_hash=$( + jq -nc --arg network_id "$network_id" '{"contract_id":{"network_id":$network_id,"contract_id_preimage":{"asset":"native"}}}' | + stellar-xdr encode --type HashIdPreimage --output single | + sha256sum | + cut -f 1 -d " " + ) + local contract_address=$( + stellar-strkey encode \ + $(jq -nc --arg contract_hash "$contract_hash" '{"contract":$contract_hash}') + ) + printf '%s' "$contract_address" +} + main $@