2015-06-12 03:23:27 +01:00
|
|
|
#ifndef LIGHTNING_BITCOIN_BASE58_H
|
|
|
|
#define LIGHTNING_BITCOIN_BASE58_H
|
2016-01-21 20:08:08 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2015-07-09 07:13:36 +01:00
|
|
|
#include <ccan/crypto/ripemd160/ripemd160.h>
|
2015-05-26 05:38:12 +01:00
|
|
|
#include <ccan/short_types/short_types.h>
|
2015-06-12 03:56:59 +01:00
|
|
|
#include <ccan/tal/tal.h>
|
2015-05-26 05:38:12 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
2015-06-02 03:23:59 +01:00
|
|
|
|
|
|
|
struct pubkey;
|
2015-06-26 03:24:07 +01:00
|
|
|
struct privkey;
|
2015-06-02 03:23:59 +01:00
|
|
|
struct bitcoin_address;
|
2015-05-26 05:38:12 +01:00
|
|
|
|
|
|
|
/* Bitcoin address encoded in base58, with version and checksum */
|
|
|
|
char *bitcoin_to_base58(const tal_t *ctx, bool test_net,
|
|
|
|
const struct bitcoin_address *addr);
|
|
|
|
bool bitcoin_from_base58(bool *test_net,
|
|
|
|
struct bitcoin_address *addr,
|
|
|
|
const char *base58, size_t len);
|
|
|
|
|
2016-01-21 20:11:46 +00:00
|
|
|
/* P2SH address encoded as base58, with version and checksum */
|
|
|
|
char *p2sh_to_base58(const tal_t *ctx, bool test_net,
|
|
|
|
const struct ripemd160 *p2sh);
|
|
|
|
bool p2sh_from_base58(bool *test_net,
|
|
|
|
struct ripemd160 *p2sh,
|
|
|
|
const char *base58, size_t len);
|
|
|
|
|
2016-12-02 07:42:58 +00:00
|
|
|
bool key_from_base58(const char *base58, size_t base58_len,
|
2015-06-26 03:24:07 +01:00
|
|
|
bool *test_net, struct privkey *priv, struct pubkey *key);
|
2015-05-26 05:38:12 +01:00
|
|
|
|
2019-04-30 19:43:18 +01:00
|
|
|
/* Decode a p2pkh or p2sh into the ripemd160 hash */
|
|
|
|
bool ripemd160_from_base58(u8 *version, struct ripemd160 *rmd,
|
|
|
|
const char *base58, size_t base58_len);
|
|
|
|
|
2017-08-28 17:06:01 +01:00
|
|
|
#endif /* LIGHTNING_BITCOIN_BASE58_H */
|