Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d2aee71
refactored to support btc-only wallet
markrypt0 Feb 12, 2025
2a1676b
fix emulator build
markrypt0 Feb 14, 2025
fb8b79c
finish fw refactor and support docker build
markrypt0 Feb 15, 2025
7e6134f
bump version
markrypt0 Feb 15, 2025
210fef2
Merge branch 'master' into btc-only
pastaghost Jun 13, 2025
7f69553
fix broken submodule reference
pastaghost Jun 13, 2025
5acbc9f
update ci config for btc-only firmware
pastaghost Jun 13, 2025
1c1350c
empty commit to trigger CI
pastaghost Jun 13, 2025
a427f3b
update python-keepkey submodule
pastaghost Jun 13, 2025
a72c62d
update command ordering in CI config
pastaghost Jun 13, 2025
a96ce14
update CI config to use Docker Compose V2
pastaghost Jun 13, 2025
1c83276
fix docker-compose invocation in CI config
pastaghost Jun 13, 2025
58fc51a
configure docker-compose v2 on CI runner
pastaghost Jun 13, 2025
6c55532
Merge remote-tracking branch 'origin/master' into btc-only
BitHighlander Mar 6, 2026
7637460
fix: 3 blocking issues in BTC-only build
BitHighlander Mar 6, 2026
28280f8
fix: use btc compose file for all docker compose commands in CI
BitHighlander Mar 6, 2026
1fe10fb
fix: use -a flag in docker compose ps to find stopped containers
BitHighlander Mar 6, 2026
8cd1ef7
Merge remote-tracking branch 'upstream/develop' into btc-only
BitHighlander Mar 12, 2026
ba62024
feat(ci): adapt GitHub Actions workflows for BTC-only firmware build
BitHighlander Mar 12, 2026
d5f7183
fix(ci): remove explicit ref from checkout steps for fork PR compatib…
BitHighlander Mar 12, 2026
c91f342
fix(ci): remove docker/setup-buildx-action (not needed, causes 401)
BitHighlander Mar 12, 2026
6a94013
fix: cleanup BTC-only build and skip ETH tests on BTC-only firmware
BitHighlander Mar 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 12 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ name: CI

on:
push:
branches: [master, develop, 'feature/**', 'fix/**', 'release/**', 'hotfix/**']
branches: [master, develop, btc-only, 'feature/**', 'fix/**', 'release/**', 'hotfix/**']
pull_request:
branches: [master, develop]
branches: [master, develop, btc-only]
workflow_dispatch:
inputs:
publish_emulator:
Expand All @@ -49,8 +49,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Install clang-format
run: sudo apt-get install -y clang-format-14
Expand Down Expand Up @@ -80,7 +78,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0

- name: Install gitleaks
Expand All @@ -101,7 +98,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: false

- name: Install cppcheck
Expand Down Expand Up @@ -171,8 +167,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Verify submodules are declared
run: |
Expand Down Expand Up @@ -207,8 +201,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Init submodules
run: |
Expand All @@ -219,9 +211,6 @@ jobs:
git submodule update --init deps/qrenc/QR-Code-generator
git submodule update --init deps/sca-hardening/SecAESSTM32

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache base image
id: cache-base
uses: actions/cache@v4
Expand All @@ -242,6 +231,7 @@ jobs:
- name: Build emulator image
run: |
docker build \
--build-arg coinsupport="-DCOIN_SUPPORT=BTC" \
-t ${{ env.EMU_IMAGE }} \
-f scripts/emulator/Dockerfile \
.
Expand All @@ -263,8 +253,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Init submodules
run: |
Expand Down Expand Up @@ -301,13 +289,15 @@ jobs:
echo "git_short=${GIT_SHORT}" >> "$GITHUB_OUTPUT"
echo "Firmware version: ${FW_VERSION} (${GIT_SHORT})"

- name: Cross-compile firmware for ARM
- name: Cross-compile firmware for ARM (BTC-only)
run: |
docker run --rm \
-v ${{ github.workspace }}:/root/keepkey-firmware:z \
${{ env.BASE_IMAGE }} /bin/sh -c "\
mkdir /root/build && cd /root/build && \
cmake -C /root/keepkey-firmware/cmake/caches/device.cmake /root/keepkey-firmware \
-DCOIN_SUPPORT=BTC \
-DVARIANTS=NoObsoleteVariants \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_COLOR_MAKEFILE=ON && \
make && \
Expand Down Expand Up @@ -385,8 +375,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Init submodules
run: |
Expand All @@ -397,16 +385,16 @@ jobs:
git submodule update --init deps/qrenc/QR-Code-generator
git submodule update --init deps/sca-hardening/SecAESSTM32

- name: Build and run tests (docker compose)
- name: Build and run tests (docker compose, BTC-only)
working-directory: scripts/emulator
run: |
set +e
docker compose up --build firmware-unit
docker compose up --build python-keepkey
docker compose -f docker-compose-btc.yml up --build firmware-unit
docker compose -f docker-compose-btc.yml up --build python-keepkey
set -e
mkdir -p ${{ github.workspace }}/test-reports
docker cp "$(docker compose ps -a -q firmware-unit)":/kkemu/test-reports/. ${{ github.workspace }}/test-reports/ 2>/dev/null || true
docker cp "$(docker compose ps -a -q python-keepkey)":/kkemu/test-reports/. ${{ github.workspace }}/test-reports/ 2>/dev/null || true
docker cp "$(docker compose -f docker-compose-btc.yml ps -a -q firmware-unit)":/kkemu/test-reports/. ${{ github.workspace }}/test-reports/ 2>/dev/null || true
docker cp "$(docker compose -f docker-compose-btc.yml ps -a -q python-keepkey)":/kkemu/test-reports/. ${{ github.workspace }}/test-reports/ 2>/dev/null || true
UNIT_STATUS=$(cat ${{ github.workspace }}/test-reports/firmware-unit/status 2>/dev/null || echo "1")
PY_STATUS=$(cat ${{ github.workspace }}/test-reports/python-keepkey/status 2>/dev/null || echo "1")
echo "Unit tests exit status: $UNIT_STATUS"
Expand All @@ -424,7 +412,7 @@ jobs:
- name: Tear down
if: always()
working-directory: scripts/emulator
run: docker compose down -v || true
run: docker compose -f docker-compose-btc.yml down -v || true

# ═══════════════════════════════════════════════════════════
# STAGE 4: PUBLISH — manual trigger only, all tests must pass
Expand All @@ -440,8 +428,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Download emulator image
uses: actions/download-artifact@v4
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ jobs:
if: steps.cache-base.outputs.cache-hit == 'true'
run: docker load -i /tmp/base-image.tar

- name: Cross-compile firmware
- name: Cross-compile firmware (BTC-only)
run: |
docker run --rm \
-v ${{ github.workspace }}:/root/keepkey-firmware:z \
${{ env.BASE_IMAGE }} /bin/sh -c "\
mkdir /root/build && cd /root/build && \
cmake -C /root/keepkey-firmware/cmake/caches/device.cmake /root/keepkey-firmware \
-DCOIN_SUPPORT=BTC \
-DVARIANTS=NoObsoleteVariants \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_COLOR_MAKEFILE=ON && \
make && \
Expand Down Expand Up @@ -147,9 +149,11 @@ jobs:
if: steps.cache-base.outputs.cache-hit == 'true'
run: docker load -i /tmp/base-image.tar

- name: Build and test emulator
- name: Build and test emulator (BTC-only)
run: |
docker build -t kkemu-release -f scripts/emulator/Dockerfile .
docker build \
--build-arg coinsupport="-DCOIN_SUPPORT=BTC" \
-t kkemu-release -f scripts/emulator/Dockerfile .
docker run --rm --entrypoint /bin/sh kkemu-release \
-c "make xunit; RC=\$?; exit \$RC"

Expand Down Expand Up @@ -178,9 +182,9 @@ jobs:
cat > release-body.md <<EOF
## KeepKey Firmware v${VER}

### Reproducible Build Verification
### Reproducible Build Verification (BTC-only)
\`\`\`bash
./scripts/build/docker/device/release.sh
./scripts/build/docker/device/btcrelease.sh
tail -c +257 bin/firmware.keepkey.bin | shasum -a 256
\`\`\`

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin
build
bin/
build/
.DS_Store
.vscode/

4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ else()
add_definitions(-DDEBUG_LINK=0)
endif()

if("${COIN_SUPPORT}" STREQUAL "BTC")
add_definitions(-DBITCOIN_ONLY)
endif()

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_definitions(-DDEBUG_ON)
add_definitions(-DMEMORY_PROTECT=0)
Expand Down
3 changes: 2 additions & 1 deletion include/keepkey/firmware/coins.def
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//coin_name coin_shortcut address_type maxfee_kb p2sh signed_message_header bip44_account_path forkid/chain_id decimals contract_address xpub_magic segwit force_bip143 curve_name cashaddr_prefix bech32_prefix decred xpub_magic_segwit_p2sh xpub_mmagic_segwit_native nanoaddr_prefix taproot
X(true, "Bitcoin", true, "BTC", true, 0, true, 100000, true, 5, true, "Bitcoin Signed Message:\n", true, 0x80000000, false, 0, true, 8, false, NO_CONTRACT, true, 76067358, true, true, true, false, true, SECP256K1_STRING, false, "", true, "bc", false, false, true, 77429938, true, 78792518, false, "", true, true )
X(true, "Testnet", true, "TEST", true, 111, true, 10000000, true, 196, true, "Bitcoin Signed Message:\n", true, 0x80000001, false, 0, true, 8, false, NO_CONTRACT, true, 70617039, true, true, true, false, true, SECP256K1_STRING, false, "", true, "tb", false, false, true, 71979618, true, 73342198, false, "", true, true )
#ifndef BITCOIN_ONLY
X(true, "BitcoinCash", true, "BCH", true, 0, true, 500000, true, 5, true, "Bitcoin Signed Message:\n", true, 0x80000091, true, 0, true, 8, false, NO_CONTRACT, true, 76067358, true, false, true, true, true, SECP256K1_STRING, true, "bitcoincash", false, "", false, false, false, 0, false, 0, false, "", true, false )
X(true, "Namecoin", true, "NMC", true, 52, true, 10000000, true, 5, true, "Namecoin Signed Message:\n", true, 0x80000007, false, 0, true, 8, false, NO_CONTRACT, true, 27108450, true, false, true, false, true, SECP256K1_STRING, false, "", false, "", false, false, false, 0, false, 0, false, "", true, false )
X(true, "Litecoin", true, "LTC", true, 48, true, 1000000, true, 50, true, "Litecoin Signed Message:\n", true, 0x80000002, false, 0, true, 8, false, NO_CONTRACT, true, 27108450, true, true, true, false, true, SECP256K1_STRING, false, "", true, "ltc", false, false, true, 28471030, true, 78792518, false, "", true, false )
Expand Down Expand Up @@ -46,6 +47,6 @@ X(true, "Terra", true, "LUNA", false, NA, false, NA, false, N
X(true, "Kava", true, "KAVA", false, NA, false, NA, false, NA, false, {0}, true, 0x800001cb, false, 0, true, 6, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "kava", false, false, false, 0, false, 0, false, "", true, false )
X(true, "Secret", true, "SCRT", false, NA, false, NA, false, NA, false, {0}, true, 0x80000211, false, 0, true, 6, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "secret", false, false, false, 0, false, 0, false, "", true, false )
X(true, "MAYAChain", true, "CACAO", false, NA, false, NA, false, NA, false, {0}, true, 0x800003a3, false, 0, true, 10, false, NO_CONTRACT, false, 0, false, false, false, false, true, SECP256K1_STRING, false, "", false, "maya", false, false, false, 0, false, 0, false, "", true, false )

#endif // BITCOIN_ONLY
#undef X
#undef NO_CONTRACT
8 changes: 7 additions & 1 deletion include/keepkey/firmware/coins.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@ enum {
CONCAT(CoinIndex, __COUNTER__),
#include "keepkey/firmware/coins.def"

#ifdef BITCOIN_ONLY
// For full-featured keepkey, this is defined in ethereum_tokens.h. For bitcoin only keepkey, need to
// define it here because ethereum_tokens.h is not included in any file
#define TOKENS_COUNT 0
#else
#define X(INDEX, NAME, SYMBOL, DECIMALS, CONTRACT_ADDRESS) \
CONCAT(CoinIndex, __COUNTER__),
#include "keepkey/firmware/tokens.def"

#endif
CoinIndexLast,
CoinIndexFirst = 0
};


#define COINS_COUNT ((int)CoinIndexLast - (int)CoinIndexFirst)
#define NODE_STRING_LENGTH 50

Expand Down
3 changes: 3 additions & 0 deletions include/keepkey/firmware/fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void fsm_msgWordAck(WordAck *msg);
void fsm_msgCharacterAck(CharacterAck *msg);
void fsm_msgApplyPolicies(ApplyPolicies *msg);

#ifndef BITCOIN_ONLY
// ethereum
void fsm_msgEthereumGetAddress(EthereumGetAddress *msg);
void fsm_msgEthereumSignTx(EthereumSignTx *msg);
Expand Down Expand Up @@ -118,6 +119,8 @@ void fsm_msgMayachainGetAddress(const MayachainGetAddress *msg);
void fsm_msgMayachainSignTx(const MayachainSignTx *msg);
void fsm_msgMayachainMsgAck(const MayachainMsgAck *msg);

#endif // BITCOIN_ONLY

#if DEBUG_LINK
// void fsm_msgDebugLinkDecision(DebugLinkDecision *msg);
void fsm_msgDebugLinkGetState(DebugLinkGetState *msg);
Expand Down
9 changes: 8 additions & 1 deletion include/keepkey/transport/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@
#ifndef INTERFACE_H
#define INTERFACE_H

#include "types.pb.h"
// Allow this file to be used from C++ by renaming an unfortunately named field:
#define delete del
#include "messages.pb.h"
#undef delete

#ifndef BITCOIN_ONLY
// Allow this file to be used from C++ by renaming an unfortunately named field:
#define delete del
#include "messages-nano.pb.h"
#undef delete

Expand All @@ -36,7 +42,8 @@
#include "messages-thorchain.pb.h"
#include "messages-mayachain.pb.h"

#include "types.pb.h"
#endif // BITCOIN_ONLY

#include "trezor_transport.h"

#ifndef EMULATOR
Expand Down
43 changes: 39 additions & 4 deletions include/keepkey/variant/keepkey.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,51 @@
/*
* This file is part of the KeepKey project.
*
* Copyright (C) 2025 markrypto
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KEEPKEY_VARIANT_KEEPKEY_H
#define KEEPKEY_VARIANT_KEEPKEY_H

#include "keepkey/board/variant.h"

#define VARIANTINFO_KEEPKEY \
.version = 1, .name = "KeepKey", .logo = &kk_logo, \
.logo_reversed = &kk_logo_reversed, \
.screensaver_timeout = ONE_SEC * 60 * 10, .screensaver = &kk_screensaver,
#ifdef BITCOIN_ONLY
// use the bitcoin-only logo
#define VARIANTINFO_KEEPKEY \
.version = 1, .name = "KeepKeyBTC", .logo = &kkbtc_logo, \
.logo_reversed = &kkbtc_logo_reversed, \
.screensaver_timeout = ONE_SEC * 60 * 10, .screensaver = &kkbtc_screensaver,

extern const VariantInfo variant_keepkey;
extern const VariantAnimation kkbtc_logo;
extern const VariantAnimation kkbtc_logo_reversed;
extern const VariantAnimation kkbtc_screensaver;

#else

#define VARIANTINFO_KEEPKEY \
.version = 1, .name = "KeepKey", .logo = &kk_logo, \
.logo_reversed = &kk_logo_reversed, \
.screensaver_timeout = ONE_SEC * 60 * 10, .screensaver = &kk_screensaver,

extern const VariantInfo variant_keepkey;
extern const VariantAnimation kk_logo;
extern const VariantAnimation kk_logo_reversed;
extern const VariantAnimation kk_screensaver;

#endif // BITCOIN_ONLY

#endif
10 changes: 9 additions & 1 deletion lib/board/variant.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ const VariantInfo *__attribute__((weak)) variant_getInfo(void) {
case MODEL_KEEPKEY:
return &variant_keepkey;
case MODEL_SALT:
#ifndef BITCOIN_ONLY
return &variant_salt;
#else
return &variant_keepkey;
#endif
case MODEL_FOX:
return &variant_keepkey;
case MODEL_KASPERSKY:
Expand Down Expand Up @@ -152,7 +156,11 @@ const VariantAnimation *variant_getLogo(bool reversed) {

const char *variant_getName(void) {
#ifdef EMULATOR
return "Emulator";
#ifdef BITCOIN_ONLY
return "EmulatorBTC";
#else
return "Emulator";
#endif
#else
if (name) {
return name;
Expand Down
Loading
Loading