2015-06-12 04:23:27 +02:00
|
|
|
#ifndef LIGHTNING_BITCOIN_BASE58_H
|
|
|
|
#define LIGHTNING_BITCOIN_BASE58_H
|
2016-01-21 21:08:08 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2015-07-09 08:13:36 +02:00
|
|
|
#include <ccan/crypto/ripemd160/ripemd160.h>
|
2015-05-26 06:38:12 +02:00
|
|
|
#include <ccan/short_types/short_types.h>
|
2015-06-12 04:56:59 +02:00
|
|
|
#include <ccan/tal/tal.h>
|
2015-05-26 06:38:12 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
2015-06-02 04:23:59 +02:00
|
|
|
|
|
|
|
struct pubkey;
|
2015-06-26 04:24:07 +02:00
|
|
|
struct privkey;
|
2015-06-02 04:23:59 +02:00
|
|
|
struct bitcoin_address;
|
2015-05-26 06:38:12 +02: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);
|
2019-04-30 22:10:50 +02:00
|
|
|
bool bitcoin_from_base58(u8 *version, struct bitcoin_address *addr,
|
2015-05-26 06:38:12 +02:00
|
|
|
const char *base58, size_t len);
|
|
|
|
|
2016-01-21 21:11:46 +01: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);
|
2019-04-30 22:10:50 +02:00
|
|
|
bool p2sh_from_base58(u8 *version, struct ripemd160 *p2sh, const char *base58,
|
|
|
|
size_t len);
|
2016-01-21 21:11:46 +01:00
|
|
|
|
2016-12-02 08:42:58 +01:00
|
|
|
bool key_from_base58(const char *base58, size_t base58_len,
|
2015-06-26 04:24:07 +02:00
|
|
|
bool *test_net, struct privkey *priv, struct pubkey *key);
|
2015-05-26 06:38:12 +02:00
|
|
|
|
2019-04-30 20:43:18 +02: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 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_BITCOIN_BASE58_H */
|