2013-09-12 17:21:24 +00:00
|
|
|
#ifndef __BIP32_H__
|
|
|
|
#define __BIP32_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint32_t depth;
|
|
|
|
uint32_t fingerprint;
|
|
|
|
uint32_t child_num;
|
2014-01-14 13:35:13 +00:00
|
|
|
uint8_t chain_code[32];
|
2014-01-21 17:38:44 +00:00
|
|
|
uint8_t private_key[32];
|
2013-09-12 17:21:24 +00:00
|
|
|
uint8_t public_key[33];
|
2013-11-25 14:37:49 +00:00
|
|
|
} HDNode;
|
2013-09-12 17:21:24 +00:00
|
|
|
|
2014-02-21 21:51:49 +00:00
|
|
|
void hdnode_from_xpub(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *public_key, HDNode *out);
|
2013-11-28 01:47:00 +00:00
|
|
|
|
2014-02-21 21:51:49 +00:00
|
|
|
void hdnode_from_xprv(uint32_t depth, uint32_t fingerprint, uint32_t child_num, uint8_t *chain_code, uint8_t *private_key, HDNode *out);
|
2013-09-12 17:21:24 +00:00
|
|
|
|
2014-02-21 21:51:49 +00:00
|
|
|
void hdnode_from_seed(uint8_t *seed, int seed_len, HDNode *out);
|
2013-09-12 17:21:24 +00:00
|
|
|
|
2014-01-14 13:35:13 +00:00
|
|
|
#define hdnode_private_ckd_prime(X, I) hdnode_private_ckd((X), ((I) | 0x80000000))
|
2013-09-12 17:21:24 +00:00
|
|
|
|
2014-01-14 13:35:13 +00:00
|
|
|
int hdnode_private_ckd(HDNode *inout, uint32_t i);
|
|
|
|
|
|
|
|
int hdnode_public_ckd(HDNode *inout, uint32_t i);
|
2013-11-25 14:37:49 +00:00
|
|
|
|
2014-01-21 17:38:44 +00:00
|
|
|
void hdnode_fill_public_key(HDNode *node);
|
2013-11-25 14:37:49 +00:00
|
|
|
|
2014-01-21 17:38:44 +00:00
|
|
|
void hdnode_fill_address(HDNode *node);
|
2013-11-08 15:02:48 +00:00
|
|
|
|
2013-09-12 17:21:24 +00:00
|
|
|
#endif
|