Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 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
f793d8f
fix: bump python-keepkey submodule to current master
BitHighlander Mar 4, 2026
14dd816
fix: bump python-keepkey submodule to current master (pb2 fix + mayac…
BitHighlander Mar 5, 2026
3d8dec4
Merge pull request #364 from keepkey/fix/bump-python-keepkey-submodule
BitHighlander Mar 6, 2026
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
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
134 changes: 75 additions & 59 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,81 @@
version: 2.1
jobs:
emulator-build-test:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
name: Update Submodules
command: |
git submodule update --init --recursive
- setup_remote_docker
- run:
name: Build Emulator and Run Tests
command: |
pushd ./scripts/emulator
set +e
docker-compose up --build firmware-unit
docker-compose up --build python-keepkey
set -e
mkdir -p ../../test-reports
docker cp "$(docker-compose ps -q firmware-unit)":/kkemu/test-reports/. ../../test-reports/
docker cp "$(docker-compose ps -q python-keepkey)":/kkemu/test-reports/. ../../test-reports/
popd
[ "$(cat test-reports/python-keepkey/status)$(cat test-reports/firmware-unit/status)" == "00" ] || exit 1
- store_test_results:
path: test-reports
emulator-build-test:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
name: Update Submodules
command: |
git submodule update --init --recursive
- setup_remote_docker
- run:
name: Install Compose v2 plugin
command: |
mkdir -p ~/.docker/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 \
-o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
docker compose version
- run:
name: Build Emulator and Run Tests
command: |
pushd ./scripts/emulator
set +e
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 ../../test-reports
docker cp "$(docker compose -f docker-compose-btc.yml ps -a -q firmware-unit)":/kkemu/test-reports/. ../../test-reports/
docker cp "$(docker compose -f docker-compose-btc.yml ps -a -q python-keepkey)":/kkemu/test-reports/. ../../test-reports/
popd
[ "$(cat test-reports/python-keepkey/status)$(cat test-reports/firmware-unit/status)" == "00" ] || exit 1
- store_test_results:
path: test-reports

emulator-publish:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
name: Update Submodules
command: |
git submodule update --init --recursive
- setup_remote_docker
- run:
name: Build Emulator
command: |
pushd ./scripts/emulator
docker-compose build kkemu
popd
- run:
name: Publish Emulator
command: |
docker login -u $KK_DOCKERHUB_USER -p $KK_DOCKERHUB_PASS
docker push kktech/kkemu
LATEST_IMAGE_ID=$(docker images | grep -i kktech/kkemu | grep -i latest | awk '{print $3}' )
FW_VERSION=$(cat ./CMakeLists.txt | tr -d '\n' | awk -v FS="(KeepKeyFirmwareVERSION|LANGUAGES)" '{print $1}' | awk '{print $4}')
docker tag $LATEST_IMAGE_ID kktech/kkemu:v$FW_VERSION
docker push kktech/kkemu
emulator-publish:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
name: Update Submodules
command: |
git submodule update --init --recursive
- setup_remote_docker
- run:
name: Install Compose v2 plugin
command: |
mkdir -p ~/.docker/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.29.2/docker-compose-linux-x86_64 \
-o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
docker compose version
- run:
name: Build Emulator
command: |
pushd ./scripts/emulator
docker compose -f docker-compose-btc.yml build kkemu
popd
- run:
name: Publish Emulator
command: |
docker login -u $KK_DOCKERHUB_USER -p $KK_DOCKERHUB_PASS
docker push kktech/kkemu
LATEST_IMAGE_ID=$(docker images | grep -i kktech/kkemu | grep -i latest | awk '{print $3}' )
FW_VERSION=$(cat ./CMakeLists.txt | tr -d '\n' | awk -v FS="(KeepKeyFirmwareVERSION|LANGUAGES)" '{print $1}' | awk '{print $4}')
docker tag $LATEST_IMAGE_ID kktech/kkemu:v$FW_VERSION
docker push kktech/kkemu

workflows:
version: 2
emulator:
jobs:
- emulator-build-test
- emulator-publish:
filters:
branches:
only: master
requires:
version: 2
emulator:
jobs:
- emulator-build-test
- emulator-publish:
filters:
branches:
only: master
requires:
- emulator-build-test
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
2 changes: 1 addition & 1 deletion deps/python-keepkey
Submodule python-keepkey updated 47 files
+41 −12 .circleci/config.yml
+1 −0 .gitignore
+1 −1 device-protocol
+85 −0 keepkeylib/client.py
+57 −0 keepkeylib/mayachain.py
+7 −0 tests/common.py
+1 −0 tests/test_msg_2thorchain_signtx.py
+2 −0 tests/test_msg_binance_sign_tx.py
+4 −0 tests/test_msg_cosmos_getaddress.py
+4 −0 tests/test_msg_cosmos_signtx.py
+2 −0 tests/test_msg_eos_getpublickey.py
+35 −0 tests/test_msg_eos_signtx.py
+1 −0 tests/test_msg_ethereum_cfunc.py
+4 −0 tests/test_msg_ethereum_erc20_0x_signtx.py
+3 −0 tests/test_msg_ethereum_erc20_approve.py
+5 −2 tests/test_msg_ethereum_erc20_uniswap_liquidity.py
+1 −0 tests/test_msg_ethereum_getaddress.py
+4 −0 tests/test_msg_ethereum_makerdao.py
+7 −0 tests/test_msg_ethereum_message.py
+1 −0 tests/test_msg_ethereum_sablier.py
+11 −0 tests/test_msg_ethereum_signtx.py
+6 −0 tests/test_msg_ethereum_signtx_xfer.py
+4 −0 tests/test_msg_getaddress.py
+2 −0 tests/test_msg_getaddress_segwit.py
+1 −0 tests/test_msg_getaddress_segwit_native.py
+21 −0 tests/test_msg_mayachain_getaddress.py
+311 −0 tests/test_msg_mayachain_signtx.py
+1 −0 tests/test_msg_nano_getaddress.py
+15 −0 tests/test_msg_nano_signtx.py
+2 −0 tests/test_msg_ripple_get_address.py
+2 −0 tests/test_msg_ripple_sign_tx.py
+1 −0 tests/test_msg_signmessage.py
+1 −0 tests/test_msg_signmessage_segwit.py
+1 −0 tests/test_msg_signmessage_segwit_native.py
+1 −0 tests/test_msg_signtx_bgold.py
+2 −0 tests/test_msg_signtx_dash.py
+3 −0 tests/test_msg_signtx_ethereum_erc20.py
+1 −0 tests/test_msg_signtx_grs.py
+2 −0 tests/test_msg_signtx_segwit_grs.py
+2 −0 tests/test_msg_signtx_segwit_native_grs.py
+4 −0 tests/test_msg_signtx_zcash.py
+1 −0 tests/test_msg_thorchain_getaddress.py
+7 −0 tests/test_msg_thorchain_signtx.py
+1 −0 tests/test_msg_verifymessage.py
+1 −1 tests/test_protect_call.py
+1 −0 tests/test_sign_typed_data.py
+1 −0 tests/test_verify_typed_data.py
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
45 changes: 40 additions & 5 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
#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