2017-07-04 18:51:39 +02:00
|
|
|
#ifndef LIGHTNING_BITCOIN_CHAINPARAMS_H
|
|
|
|
#define LIGHTNING_BITCOIN_CHAINPARAMS_H
|
|
|
|
|
|
|
|
#include "config.h"
|
2017-12-18 07:44:10 +01:00
|
|
|
#include <bitcoin/block.h>
|
2019-02-21 04:45:54 +01:00
|
|
|
#include <common/amount.h>
|
2020-05-16 03:29:05 +02:00
|
|
|
#include <common/bip32.h>
|
2017-07-04 18:51:39 +02:00
|
|
|
|
2020-07-10 23:09:46 +02:00
|
|
|
#define ELEMENTS_ASSET_LEN 33
|
|
|
|
|
2017-07-04 18:51:39 +02:00
|
|
|
struct chainparams {
|
|
|
|
const char *network_name;
|
2021-11-29 08:10:06 +01:00
|
|
|
/* Unfortunately starting with signet, we now have diverging
|
|
|
|
* conventions for the "BIP173" Human Readable Part (HRP).
|
|
|
|
* On onchain signet, the HRP is `tb` , but on Lightning
|
|
|
|
* signet the HRP is `tbs`.
|
|
|
|
*/
|
|
|
|
const char *onchain_hrp;
|
|
|
|
const char *lightning_hrp;
|
2019-06-30 16:58:52 +02:00
|
|
|
/*'bip70_name' is corresponding to the 'chain' field of
|
|
|
|
* the API 'getblockchaininfo' */
|
|
|
|
const char *bip70_name;
|
2017-12-18 07:44:10 +01:00
|
|
|
const struct bitcoin_blkid genesis_blockhash;
|
2017-07-04 18:51:39 +02:00
|
|
|
const int rpc_port;
|
2022-05-08 18:04:29 +02:00
|
|
|
/**
|
2022-06-18 15:18:38 +02:00
|
|
|
* BOLT 1:
|
|
|
|
*
|
|
|
|
* The default TCP port depends on the network used. The most common networks are:
|
2022-05-08 18:04:29 +02:00
|
|
|
*
|
|
|
|
* - Bitcoin mainet with port number 9735 or the corresponding hexadecimal `0x2607`;
|
|
|
|
* - Bitcoin testnet with port number 19735 (`0x4D17`);
|
|
|
|
* - Bitcoin signet with port number 39735 (`0xF87`).
|
|
|
|
*/
|
|
|
|
const int ln_port;
|
2017-07-13 15:36:50 +02:00
|
|
|
const char *cli;
|
|
|
|
const char *cli_args;
|
2019-07-27 17:20:05 +02:00
|
|
|
/* The min numeric version of cli supported */
|
|
|
|
const u64 cli_min_supported_version;
|
2019-02-21 04:45:54 +01:00
|
|
|
const struct amount_sat dust_limit;
|
|
|
|
const struct amount_sat max_funding;
|
|
|
|
const struct amount_msat max_payment;
|
2018-02-15 23:09:55 +01:00
|
|
|
const u32 when_lightning_became_cool;
|
2019-04-29 20:09:06 +02:00
|
|
|
const u8 p2pkh_version;
|
|
|
|
const u8 p2sh_version;
|
2017-07-04 18:51:39 +02:00
|
|
|
|
|
|
|
/* Whether this is a test network or not */
|
|
|
|
const bool testnet;
|
2019-03-11 20:03:14 +01:00
|
|
|
|
|
|
|
/* Version codes for BIP32 extended keys in libwally-core*/
|
|
|
|
const struct bip32_key_version bip32_key_version;
|
2019-04-11 17:41:58 +02:00
|
|
|
const bool is_elements;
|
2019-07-30 15:23:40 +02:00
|
|
|
const u8 *fee_asset_tag;
|
2017-07-04 18:51:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* chainparams_for_network - Look up blockchain parameters by its name
|
|
|
|
*/
|
|
|
|
const struct chainparams *chainparams_for_network(const char *network_name);
|
|
|
|
|
2017-10-26 04:57:19 +02:00
|
|
|
/**
|
|
|
|
* chainparams_by_bip173 - Helper to get a network by its bip173 name
|
|
|
|
*
|
|
|
|
* This lets us decode BOLT11 addresses.
|
|
|
|
*/
|
2021-11-29 08:10:06 +01:00
|
|
|
const struct chainparams *chainparams_by_lightning_hrp(const char *lightning_hrp);
|
2018-09-06 18:40:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* chainparams_by_chainhash - Helper to get a network by its genesis blockhash
|
|
|
|
*/
|
|
|
|
const struct chainparams *chainparams_by_chainhash(const struct bitcoin_blkid *chain_hash);
|
|
|
|
|
2019-07-19 04:37:33 +02:00
|
|
|
/**
|
|
|
|
* chainparams_get_network_names - Produce a comma-separated list of network names
|
|
|
|
*/
|
|
|
|
const char *chainparams_get_network_names(const tal_t *ctx);
|
|
|
|
|
2022-06-20 23:38:18 +02:00
|
|
|
/**
|
|
|
|
* chainparams_get_ln_port - Return the lightning network default port by
|
|
|
|
* network if the chainparams is initialized, otherwise 9735 as mock port
|
|
|
|
*/
|
|
|
|
int chainparams_get_ln_port(const struct chainparams *params);
|
2017-07-04 18:51:39 +02:00
|
|
|
#endif /* LIGHTNING_BITCOIN_CHAINPARAMS_H */
|