1 #ifndef LIGHTNING_BITCOIN_CHAINPARAMS_H
2 #define LIGHTNING_BITCOIN_CHAINPARAMS_H
3 
4 #include "config.h"
5 #include <bitcoin/block.h>
6 #include <common/amount.h>
7 #include <common/bip32.h>
8 
9 #define ELEMENTS_ASSET_LEN 33
10 
11 struct chainparams {
12 	const char *network_name;
13 	const char *bip173_name;
14 	/*'bip70_name' is corresponding to the 'chain' field of
15 	 * the API 'getblockchaininfo' */
16 	const char *bip70_name;
17 	const struct bitcoin_blkid genesis_blockhash;
18 	const int rpc_port;
19 	const char *cli;
20 	const char *cli_args;
21 	/* The min numeric version of cli supported */
22 	const u64 cli_min_supported_version;
23 	const struct amount_sat dust_limit;
24 	const struct amount_sat max_funding;
25 	const struct amount_msat max_payment;
26 	const u32 when_lightning_became_cool;
27 	const u8 p2pkh_version;
28 	const u8 p2sh_version;
29 
30 	/* Whether this is a test network or not */
31 	const bool testnet;
32 
33 	/* Version codes for BIP32 extended keys in libwally-core*/
34 	const struct bip32_key_version bip32_key_version;
35 	const bool is_elements;
36 	const u8 *fee_asset_tag;
37 };
38 
39 /**
40  * chainparams_for_network - Look up blockchain parameters by its name
41  */
42 const struct chainparams *chainparams_for_network(const char *network_name);
43 
44 /**
45  * chainparams_for_networks - Get blockchain parameters for all known networks,
46  *                            as a tal array.
47  */
48 const struct chainparams **chainparams_for_networks(const tal_t *ctx);
49 
50 /**
51  * chainparams_by_bip173 - Helper to get a network by its bip173 name
52  *
53  * This lets us decode BOLT11 addresses.
54  */
55 const struct chainparams *chainparams_by_bip173(const char *bip173_name);
56 
57 /**
58  * chainparams_by_chainhash - Helper to get a network by its genesis blockhash
59  */
60 const struct chainparams *chainparams_by_chainhash(const struct bitcoin_blkid *chain_hash);
61 
62 /**
63  * chainparams_get_network_names - Produce a comma-separated list of network names
64  */
65 const char *chainparams_get_network_names(const tal_t *ctx);
66 
67 #endif /* LIGHTNING_BITCOIN_CHAINPARAMS_H */
68