Skip to content

Commit 6d5e278

Browse files
feat: v1.0.0 release
* Release initial coins to first stable version * Updated types to better reflect consistent naming with source code BREAKING CHANGE: v1.0.0 changes main and test to mainnet and testnet
1 parent d9ae8ed commit 6d5e278

File tree

166 files changed

+30984
-8999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+30984
-8999
lines changed

README.md

Lines changed: 1272 additions & 1272 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 21639 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.7.0",
2+
"version": "1.0.0",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",
@@ -20,7 +20,6 @@
2020
"size": "size-limit",
2121
"analyze": "size-limit --why"
2222
},
23-
"peerDependencies": {},
2423
"husky": {
2524
"hooks": {
2625
"pre-commit": "tsdx lint"
@@ -52,6 +51,7 @@
5251
],
5352
"devDependencies": {
5453
"@size-limit/preset-small-lib": "^8.1.0",
54+
"@types/jest": "^29.5.3",
5555
"husky": "^8.0.2",
5656
"size-limit": "^8.1.0",
5757
"tsdx": "^0.14.1",
@@ -60,6 +60,5 @@
6060
},
6161
"publishConfig": {
6262
"access": "public"
63-
},
64-
"dependencies": {}
63+
}
6564
}

src/chains/bch.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/chains/bitcoin/base.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Common } from '../../types';
2+
3+
export const common: Common = {
4+
name: 'Bitcoin',
5+
decimalPlaces: 1e8,
6+
unit: 'BTC',
7+
/** https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/networks.js#L5 */
8+
messagePrefix: '\u0018Bitcoin Signed Message:\n',
9+
messagePrefixAlts: [
10+
/** https://github.com/bitcoin/bitcoin/blob/01e1627e25bc5477c40f51da03c3c31b609a85c9/src/util/message.cpp#L25 */
11+
'Bitcoin Signed Message:\n',
12+
'\x18Bitcoin Signed Message:\n',
13+
'\x19Bitcoin Signed Message:\n',
14+
],
15+
};

src/chains/bitcoin/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { mainnet } from './mainnet';
2+
import { testnet } from './testnet';
3+
import { regtest } from './regtest';
4+
import { simnet } from './simnet';
5+
import { Networks } from '../../types';
6+
7+
export const btc: Networks = {
8+
mainnet,
9+
testnet,
10+
regtest,
11+
simnet,
12+
};

src/chains/bitcoin/mainnet.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { MainNet } from '../../types';
2+
import { common } from './base';
3+
4+
export const mainnet: MainNet = {
5+
...common,
6+
hashGenesisBlock:
7+
'000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f',
8+
// nDefaultPort
9+
port: 8333,
10+
portRpc: 8332,
11+
protocol: {
12+
// pchMessageStart
13+
magic: 0xd9b4bef9, // careful, sent over wire as little endian
14+
},
15+
bech32: 'bc',
16+
// vSeeds
17+
seedsDns: [
18+
'seed.bitcoin.sipa.be',
19+
'dnsseed.bluematt.me',
20+
'seed.bitcoinstats.com',
21+
'seed.bitcoin.jonasschnelli.ch',
22+
'seed.btc.petertodd.org',
23+
'seed.bitcoin.sprovoost.nl',
24+
'dnsseed.emzy.de',
25+
],
26+
// base58Prefixes
27+
versions: {
28+
bip32: {
29+
private: 0x0488ade4,
30+
public: 0x0488b21e,
31+
},
32+
bip44: 0,
33+
private: 0x80,
34+
public: 0x00,
35+
scripthash: 0x05,
36+
},
37+
};

src/chains/bitcoin/regtest.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { RegTest } from '../../types';
2+
import { common } from './base';
3+
4+
export const regtest: RegTest = {
5+
...common,
6+
hashGenesisBlock:
7+
'0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206',
8+
port: 18444,
9+
portRpc: 18332,
10+
protocol: {
11+
magic: 0xdab5bffa,
12+
},
13+
bech32: 'bcrt',
14+
seedsDns: [],
15+
versions: {
16+
bip32: {
17+
private: 0x04358394,
18+
public: 0x043587cf,
19+
},
20+
bip44: 1,
21+
private: 0xef,
22+
public: 0x6f,
23+
scripthash: 0xc4,
24+
},
25+
};

src/chains/bitcoin/simnet.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { SimNet } from '../../types';
2+
import { common } from './base';
3+
4+
// source: https://github.com/btcsuite/btcd/blob/6867ff32788a1beb9d148e414d7f84f50958f0d2/chaincfg/params.go#L508
5+
export const simnet: SimNet = {
6+
...common,
7+
hashGenesisBlock:
8+
'f67ad7695d9b662a72ff3d8edbbb2de0bfa67b13974bb9910d116d5cbd863e68',
9+
port: 18555,
10+
portRpc: 18556,
11+
protocol: {
12+
magic: 0x12141c16,
13+
},
14+
bech32: 'sb',
15+
seedsDns: [],
16+
versions: {
17+
bip32: {
18+
private: 0x0420b900,
19+
public: 0x0420bd3a,
20+
},
21+
bip44: 115,
22+
private: 0x64,
23+
public: 0x3f,
24+
scripthash: 0x7b,
25+
},
26+
};

src/chains/bitcoin/testnet.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { TestNet } from '../../types';
2+
import { common } from './base';
3+
4+
export const testnet: TestNet = {
5+
...common,
6+
hashGenesisBlock:
7+
'000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943',
8+
port: 18333,
9+
portRpc: 18332,
10+
protocol: {
11+
magic: 0x0709110b,
12+
},
13+
bech32: 'tb',
14+
seedsDns: [
15+
'testnet-seed.alexykot.me',
16+
'testnet-seed.bitcoin.schildbach.de',
17+
'testnet-seed.bitcoin.petertodd.org',
18+
'testnet-seed.bluematt.me',
19+
],
20+
versions: {
21+
bip32: {
22+
private: 0x04358394,
23+
public: 0x043587cf,
24+
},
25+
bip44: 1,
26+
private: 0xef,
27+
public: 0x6f,
28+
scripthash: 0xc4,
29+
},
30+
};

0 commit comments

Comments
 (0)