Skip to content

Commit

Permalink
fix: add peer network id
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Sep 18, 2023
1 parent 90d15c9 commit db5a596
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions packages/common/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
/**
* The **chain** ID.
* Is used for signing, so transactions can't be replayed on other chains.
*/
export enum ChainID {
Testnet = 0x80000000,
Mainnet = 0x00000001,
}

/**
* The **transaction** version.
* Is used for signing, so transactions can't be replayed on other networks.
*/
export enum TransactionVersion {
Mainnet = 0x00,
Testnet = 0x80,
}

/**
* @ignore
* The **peer** network ID.
* Typically not used in signing, but used for broadcasting to the P2P network.
* It can also be used to determine the parent of a subnet.
*
* Attention:
* For mainnet/testnet the v2/info response `.network_id` refers to the chain ID
* For subnets the v2/info response `.network_id` refers to the peer network ID and the chain ID (they are the same for subnets)
* The `.parent_network_id` refers to the actual peer network ID (of the parent) in both cases
*/
export enum PeerNetworkID {
Mainnet = 0x17000000,
Testnet = 0xff000000,
}

/** @ignore internal */
export const PRIVATE_KEY_COMPRESSED_LENGTH = 33;

/**
* @ignore
*/
/** @ignore internal */
export const PRIVATE_KEY_UNCOMPRESSED_LENGTH = 32;

/**
* @ignore
*/
/** @ignore internal */
export const BLOCKSTACK_DEFAULT_GAIA_HUB_URL = 'https://hub.blockstack.org';

0 comments on commit db5a596

Please sign in to comment.