Bitcoin full node and query server

Feb 9, 2020

View in context in the libbitcoin Slack #general mirror.

skaht01:38
FYSA - almost have SLIP10 functioning for ed25519. Lessons learned could feed libbitcoin hd-new and hd-private code to accomodate SLIP 10.
(edited)
👍 3
4 replies · skaht · last Feb 18, 2020
skaht21:18
The bottom of https://monero.stackexchange.com/questions/9815/support-for-a-ledger-nano-s-recovery-plan-b/10922#10922 shows the piped scripting for how SLIP 10 can be implemented to support ed25519 to mimic Trezor’s Model T XMR key and address behaviors. The indices for m/44'/128'/0' were implicitly assumed to be hardened. The C++ code used to implement hd_hmac had a libsodium dependency.
Monero Stack Exchange
For a Ledger Nano S recovery contingency plan, how can one compute an associated vector of 25 Electrum wallet recovery words for each primary address using BIP 44 technology that is seeded from BIP...
skaht21:22
hd_hmac.cpp C++ · 14.6 KB
#include <iostream>
#include <string>
#include <regex>

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <sodium.h>

using namespace std;

static const int MAX = 512;                                // MAX input data-message size of 512 bits to hashed using hmac-sha512
static void      sprintkey( unsigned char*, const char* ); // Converts hexadecimal char* to a MPI represented as an unsigned char sequence

enum class Curve { undefined, ed25519, secp256k1, nistp256 };

/** 
    From libgcrypt-1.8.5/cipher/ecc-curves.c:

    --ed25519   = apply Bernstein's ed25519 curve   ( order = 0x1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED }
    --secp256k1 = apply the Bitcoin secp256k1 curve { order = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 }
    --nistp256  = apply the NIST nistp256 curve     { oder  = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 }
**/

int main( const int   argc, 
          const char *argv[] )
{
  const char    *root_chaincode_ed25519   = "656432353531392073656564",     // "ed25519 seed"
                *root_chaincode_secp256k1 = "426974636f696e2073656564",     // "Bitcoin seed";
                *root_chaincode_nistp256  = "4e69737432353670312073656564"; // "Nist256p1 seed";

  string         line;
  smatch         matches;
  regex          pattern_help1{     R"(-h)"          },         // help
                 pattern_help2{     R"(--help)"      },         // help
                 pattern_index1{    R"(-i)"          },         // index
                 pattern_index2{    R"(--index)"     },         // index
                 pattern_index_val{ R"([0-9]{1,10})" },         // extracts integer index to be treated as hardened
                 pattern_ed25519{   R"(--ed25519)"   },         // sets SLIP 10 defined          chaincode of root for the ed25519 curve
full file
skaht21:24
Most of the overhead was to parse the input arguments.
skaht02:50
Forgot to mention that only SLIP 10 ed25519 behaviors are functional for hardened index numbers.