upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bip32.h
diff options
context:
space:
mode:
authormtg0001 <106211915+mtg0001@users.noreply.github.com>2026-08-03 15:11:55 -0300
committerGitHub <noreply@github.com>2026-08-03 15:11:55 -0300
commitaba252206bf39ac81e6627354062c28fae05b0aa (patch)
tree751691f0baaf925c54a2c03f9f02ca87fb29956f /src/bip32.h
parent1aee805b232a33484e3db1dc8ea4bfb3f585212e (diff)
Activate BIP44 wallet derivation (#124)
* Add BIP32 path derivation foundation * Add HD wallet schema metadata * Add provisional BIP44 coin type metadata * Activate BIP44 wallet derivation * wallet: scan BIP44 restore depth per branch * wallet: widen default BIP44 restore lookahead --------- Co-authored-by: Gilcimar Duarte <ti@gpm.infra>
Diffstat (limited to 'src/bip32.h')
-rw-r--r--src/bip32.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bip32.h b/src/bip32.h
index a029444..e9862d5 100644
--- a/src/bip32.h
+++ b/src/bip32.h
@@ -5,7 +5,7 @@
5// 5//
6// This module is deliberately independent from wallet.dat and GUI code. It is 6// This module is deliberately independent from wallet.dat and GUI code. It is
7// the auditable foundation: mnemonic generation/validation, seed derivation, 7// the auditable foundation: mnemonic generation/validation, seed derivation,
8// and hardened private child derivation over secp256k1. 8// and private child derivation over secp256k1.
9 9
10#ifndef BITFLASH_BIP32_H 10#ifndef BITFLASH_BIP32_H
11#define BITFLASH_BIP32_H 11#define BITFLASH_BIP32_H
@@ -16,6 +16,8 @@
16namespace bitflash 16namespace bitflash
17{ 17{
18 18
19static const unsigned int BIP32_HARDENED = 0x80000000U;
20
19struct BIP32PrivateNode 21struct BIP32PrivateNode
20{ 22{
21 std::vector<unsigned char> privateKey; // 32-byte scalar 23 std::vector<unsigned char> privateKey; // 32-byte scalar
@@ -43,6 +45,16 @@ bool BIP32MasterFromSeed(const std::vector<unsigned char>& seed,
43 BIP32PrivateNode& nodeOut, 45 BIP32PrivateNode& nodeOut,
44 std::string& errorOut); 46 std::string& errorOut);
45 47
48bool BIP32DeriveChild(const BIP32PrivateNode& parent,
49 unsigned int childNumber,
50 BIP32PrivateNode& childOut,
51 std::string& errorOut);
52
53bool BIP32DerivePath(const BIP32PrivateNode& root,
54 const std::vector<unsigned int>& path,
55 BIP32PrivateNode& nodeOut,
56 std::string& errorOut);
57
46bool BIP32DeriveHardenedChild(const BIP32PrivateNode& parent, 58bool BIP32DeriveHardenedChild(const BIP32PrivateNode& parent,
47 unsigned int childIndex, 59 unsigned int childIndex,
48 BIP32PrivateNode& childOut, 60 BIP32PrivateNode& childOut,