Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/components/built/Auth.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Computer } from '@bitcoin-computer/lib';
import type { Chain, Network, ModuleStorageType } from './common/types';
export type TBCChain = 'LTC' | 'BTC' | 'PEPE' | 'DOGE';
export type TBCChain = 'LTC' | 'BTC' | 'PEPE' | 'DOGE' | 'GRS';
export type TBCNetwork = 'testnet' | 'mainnet' | 'regtest';
export type AddressType = 'p2pkh' | 'p2wpkh' | 'p2tr';
export type ComputerOptions = Partial<{
Expand Down
4 changes: 3 additions & 1 deletion packages/components/built/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function getCoinType(chain, network) {
return 3434;
if (chain === 'BCH')
return 145;
if (chain === 'GRS')
return 17;
throw new Error("Unsupported chain ".concat(chain, " or network ").concat(network));
}
function getBip44Path(_a) {
Expand Down Expand Up @@ -75,7 +77,7 @@ function MnemonicInput(_a) {
}
function ChainInput(_a) {
var chain = _a.chain, setChain = _a.setChain;
return (_jsxs(_Fragment, { children: [_jsx("label", { className: "block mt-4 mb-2 text-sm font-medium text-gray-900 dark:text-white", children: "Chain" }), _jsxs("fieldset", { className: "flex", children: [_jsx("legend", { className: "sr-only", children: "Chain" }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('LTC'); }, checked: chain === 'LTC', id: "chain-ltc", type: "radio", name: "chain", value: "LTC", className: "w-4 h-4 border-gray-300 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:focus:bg-blue-600 dark:bg-gray-700 dark:border-gray-600" }), _jsx("label", { htmlFor: "chain-ltc", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "LTC" })] }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('BTC'); }, checked: chain === 'BTC', id: "chain-btc", type: "radio", name: "chain", value: "BTC", className: "w-4 h-4 border-gray-300 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:focus:bg-blue-600 dark:bg-gray-700 dark:border-gray-600" }), _jsx("label", { htmlFor: "chain-btc", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "BTC" })] }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('PEPE'); }, id: "chain-pepe", type: "radio", name: "chain", value: "PEPE", className: "w-4 h-4 border-gray-200 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:bg-gray-700 dark:border-gray-600" }), _jsx("label", { htmlFor: "chain-pepe", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "PEPE" })] }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('DOGE'); }, id: "chain-doge", type: "radio", name: "chain", value: "DOGE", className: "w-4 h-4 border-gray-200 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:bg-gray-700 dark:border-gray-600", disabled: true }), _jsx("label", { htmlFor: "chain-doge", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "DOGE" })] })] })] }));
return (_jsxs(_Fragment, { children: [_jsx("label", { className: "block mt-4 mb-2 text-sm font-medium text-gray-900 dark:text-white", children: "Chain" }), _jsxs("fieldset", { className: "flex", children: [_jsx("legend", { className: "sr-only", children: "Chain" }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('LTC'); }, checked: chain === 'LTC', id: "chain-ltc", type: "radio", name: "chain", value: "LTC", className: "w-4 h-4 border-gray-300 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:focus:bg-blue-600 dark:bg-gray-700 dark:border-gray-600" }), _jsx("label", { htmlFor: "chain-ltc", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "LTC" })] }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('BTC'); }, checked: chain === 'BTC', id: "chain-btc", type: "radio", name: "chain", value: "BTC", className: "w-4 h-4 border-gray-300 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:focus:bg-blue-600 dark:bg-gray-700 dark:border-gray-600" }), _jsx("label", { htmlFor: "chain-btc", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "BTC" })] }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('PEPE'); }, id: "chain-pepe", type: "radio", name: "chain", value: "PEPE", className: "w-4 h-4 border-gray-200 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:bg-gray-700 dark:border-gray-600" }), _jsx("label", { htmlFor: "chain-pepe", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "PEPE" })] }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('DOGE'); }, id: "chain-doge", type: "radio", name: "chain", value: "DOGE", className: "w-4 h-4 border-gray-200 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:bg-gray-700 dark:border-gray-600", disabled: true }), _jsx("label", { htmlFor: "chain-doge", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "DOGE" })] }), _jsxs("div", { className: "flex items-center mr-4", children: [_jsx("input", { onChange: function () { return setChain('GRS'); }, id: "chain-grs", type: "radio", name: "chain", value: "GRS", className: "w-4 h-4 border-gray-200 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:bg-gray-700 dark:border-gray-600", disabled: true }), _jsx("label", { htmlFor: "chain-grs", className: "block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300", children: "GRS" })] })] })] }));
}
function NetworkInput(_a) {
var network = _a.network, setNetwork = _a.setNetwork;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/built/common/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export type Chain = 'LTC' | 'BTC' | 'DOGE' | 'PEPE';
export type Chain = 'LTC' | 'BTC' | 'DOGE' | 'PEPE' | 'GRS';
export type Network = 'testnet' | 'mainnet' | 'regtest';
export type ModuleStorageType = 'taproot' | 'multisig';
5 changes: 4 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
},
"devDependencies": {
"@babel/preset-react": "^7.23.3",
"@types/node": "^22.15.2",
"@types/react": "^19.1.2",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0"
"@typescript-eslint/parser": "^7.9.0",
"vite": "^6.3.3"
}
}
22 changes: 20 additions & 2 deletions packages/components/src/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Modal } from './Modal'
import type { Chain, Network, ModuleStorageType } from './common/types'
import { getEnv } from './common/utils'

export type TBCChain = 'LTC' | 'BTC' | 'PEPE' | 'DOGE'
export type TBCChain = 'LTC' | 'BTC' | 'PEPE' | 'DOGE' | 'GRS'
export type TBCNetwork = 'testnet' | 'mainnet' | 'regtest'
export type AddressType = 'p2pkh' | 'p2wpkh' | 'p2tr'

Expand Down Expand Up @@ -48,6 +48,7 @@ function getCoinType(chain: string, network: string): number {
if (chain === 'DOGE') return 3
if (chain === 'PEPE') return 3434
if (chain === 'BCH') return 145
if (chain === 'GRS') return 17

throw new Error(`Unsupported chain ${chain} or network ${network}`)
}
Expand Down Expand Up @@ -187,6 +188,23 @@ function ChainInput({ chain, setChain }: { chain: Chain | undefined; setChain: D
DOGE
</label>
</div>
<div className="flex items-center mr-4">
<input
onChange={() => setChain('GRS')}
id="chain-grs"
type="radio"
name="chain"
value="GRS"
className="w-4 h-4 border-gray-200 focus:ring-2 focus:ring-blue-300 dark:focus:ring-blue-600 dark:bg-gray-700 dark:border-gray-600"
disabled
/>
<label
htmlFor="chain-grs"
className="block ms-2 text-sm font-medium text-gray-900 dark:text-gray-300"
>
GRS
</label>
</div>
</fieldset>
</>
)
Expand Down Expand Up @@ -332,7 +350,7 @@ function LoginForm() {
<MnemonicInput mnemonic={mnemonic} setMnemonic={setMnemonic} />
{!chain && <ChainInput chain={chain} setChain={setChain} />}
{!network && <NetworkInput network={network} setNetwork={setNetwork} />}
{!url && <UrlInput urlInputRef={urlInputRef} />}
{!url && <UrlInput urlInputRef={urlInputRef as React.RefObject<HTMLInputElement>} />}
</div>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/common/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export type Chain = 'LTC' | 'BTC' | 'DOGE' | 'PEPE'
export type Chain = 'LTC' | 'BTC' | 'DOGE' | 'PEPE' | 'GRS'
export type Network = 'testnet' | 'mainnet' | 'regtest'
export type ModuleStorageType = 'taproot' | 'multisig'
2 changes: 1 addition & 1 deletion packages/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _The Bitcoin Computer is a protocol for building applications that are as secure

**Free Computation** - Smart contracts are executed on the client. Execution costs are fixed and independent of the number of computational steps.

**Multicoin**. Deploy on Bitcoin, Litecoin, Dogecoin, and Pepecoin (Bitcoin Cash coming soon) using the same code.
**Multicoin**. Deploy on Bitcoin, Litecoin, Dogecoin, Pepecoin and Groestlcoin (Bitcoin Cash coming soon) using the same code.

**JavaScript & Typescript** - Build decentralized applications that integrate seamlessly into web applications using your favorite tools and execute on high performance JavaScript engines.

Expand Down
2 changes: 1 addition & 1 deletion packages/lib/computer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ declare class Update {
isValid(fromTx: Update): boolean
}

type TBCChain = 'LTC' | 'BTC' | 'PEPE' | string
type TBCChain = 'LTC' | 'BTC' | 'PEPE' | 'DOGE' | 'GRS' | string
type TBCNetwork = 'testnet' | 'mainnet' | 'regtest' | string
type Fee = Partial<{
fee: number
Expand Down
11 changes: 9 additions & 2 deletions packages/nakamotojs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,42 @@
"bip174": "^2.1.0",
"bs58check": "^3.0.1",
"buffer": "^6.0.3",
"hashes-grs": "^1.2.0",
"typeforce": "^1.11.3",
"varuint-bitcoin": "^1.1.2"
},
"devDependencies": {
"@bitcoin-computer/secp256k1": "^0.24.3-beta.0",
"@types/bs58": "^4.0.0",
"@types/bs58check": "^2.1.0",
"@types/chai": "^5.2.1",
"@types/mocha": "^5.2.7",
"@types/node": "^16.11.7",
"@types/proxyquire": "^1.3.28",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"axios": "^1.9.0",
"bip32": "^4.0.0",
"bip39": "^3.1.0",
"bip65": "^1.0.1",
"bip68": "^1.0.3",
"bitcoind-rpc": "^0.9.1",
"bs58": "^4.0.0",
"chai": "^5.2.0",
"dotenv": "^16.4.5",
"ecpair": "^2.0.1",
"ecpairgrs": "^2.0.2",
"elliptic": "^6.6.1",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-prettier": "^5.2.6",
"hoodwink": "^2.0.0",
"minimaldata": "^1.0.2",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"prettier": "^3.2.5",
"prettier": "^3.5.3",
"proxyquire": "^2.0.1",
"ts-node": "^8.3.0",
"typescript": "^5.5.3"
"typescript": "^5.8.3"
},
"engines": {
"node": ">=8.0.0"
Expand Down
3 changes: 3 additions & 0 deletions packages/nakamotojs/src/networks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export declare const litecointestnet: Network;
export declare const pepecoin: Network;
export declare const pepecoinregtest: Network;
export declare const pepecointestnet: Network;
export declare const groestlcoin: Network;
export declare const groestlcoinregtest: Network;
export declare const groestlcointestnet: Network;
export declare const dogecoin: Network;
export declare const dogecoinregtest: Network;
export declare const dogecointestnet: Network;
Expand Down
44 changes: 44 additions & 0 deletions packages/nakamotojs/src/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,39 @@ export const pepecointestnet = {
scriptHash: 0xc4,
wif: 0xf1,
};
export const groestlcoin = {
messagePrefix: '\x1cGroestlCoin Signed Message:\n',
bech32: 'grs',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4,
},
pubKeyHash: 0x24,
scriptHash: 0x05,
wif: 0x80,
};
export const groestlcoinregtest = {
messagePrefix: '\x1cGroestlCoin Signed Message:\n',
bech32: 'grsrt',
bip32: {
public: 0x043587cf,
private: 0x04358394,
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef,
};
export const groestlcointestnet = {
messagePrefix: '\x1cGroestlCoin Signed Message:\n',
bech32: 'tgrs',
bip32: {
public: 0x043587cf,
private: 0x04358394,
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef,
};
export const dogecoin = {
messagePrefix: '\x19Dogecoin Signed Message:\n',
bech32: 'doge', // TODO: Dogecoin doesn't use bech32, make type optional
Expand Down Expand Up @@ -176,6 +209,17 @@ export function getNetwork(chain, network) {
default:
throw new Error(`Invalid network ${network}`);
}
case 'GRS':
switch (network) {
case 'mainnet':
return groestlcoin;
case 'testnet':
return groestlcointestnet;
case 'regtest':
return groestlcoinregtest;
default:
throw new Error(`Invalid network ${network}`);
}
default:
throw new Error(`Invalid chain ${network}`);
}
Expand Down
47 changes: 47 additions & 0 deletions packages/nakamotojs/ts_src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,42 @@ export const pepecointestnet: Network = {
wif: 0xf1,
};

export const groestlcoin: Network = {
messagePrefix: '\x1cGroestlCoin Signed Message:\n',
bech32: 'grs',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4,
},
pubKeyHash: 0x24,
scriptHash: 0x05,
wif: 0x80,
};

export const groestlcoinregtest: Network = {
messagePrefix: '\x1cGroestlCoin Signed Message:\n',
bech32: 'grsrt',
bip32: {
public: 0x043587cf,
private: 0x04358394,
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef,
};

export const groestlcointestnet: Network = {
messagePrefix: '\x1cGroestlCoin Signed Message:\n',
bech32: 'tgrs',
bip32: {
public: 0x043587cf,
private: 0x04358394,
},
pubKeyHash: 0x6f,
scriptHash: 0xc4,
wif: 0xef,
};

export const dogecoin: Network = {
messagePrefix: '\x19Dogecoin Signed Message:\n',
bech32: 'doge', // TODO: Dogecoin doesn't use bech32, make type optional
Expand Down Expand Up @@ -203,6 +239,17 @@ export function getNetwork(chain: string, network: string): Network {
default:
throw new Error(`Invalid network ${network}`);
}
case 'GRS':
switch (network) {
case 'mainnet':
return groestlcoin;
case 'testnet':
return groestlcointestnet;
case 'regtest':
return groestlcoinregtest;
default:
throw new Error(`Invalid network ${network}`);
}
default:
throw new Error(`Invalid chain ${network}`);
}
Expand Down
85 changes: 85 additions & 0 deletions packages/node/chain-setup/GRS/mainnet/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Chain: BTC, LTC, PEPE or GRS
BCN_CHAIN='GRS'
# Network: mainnet, testnet, or regtest
BCN_NETWORK='mainnet'

# Postgres Connection Credentials
POSTGRES_USER='bcn'
POSTGRES_PASSWORD='bcn'
POSTGRES_DB='bcn'
POSTGRES_HOST='db'
POSTGRES_PORT='5432'
POSTGRES_MAX_CONNECTIONS='20'
POSTGRES_IDLE_TIMEOUT_MILLIS='3000'

# Bitcoin Node Settings
BITCOIN_IMAGE='groestlcoin/groestlcoin-core:28-alpine'
BITCOIN_DATA_DIR='/home/groestlcoin/.groestlcoin'
BITCOIN_CONF_FILE='groestlcoin.conf'

# Node Settings
# RPC Client Credentials
BITCOIN_RPC_USER='bcn-admin'
BITCOIN_RPC_PASSWORD='kH4nU5Okm6-uyC0_mA5ztVNacJqZbYd_KGLl6mx722A='
BITCOIN_RPC_HOST='node'
BITCOIN_RPC_PORT='33873'
BITCOIN_P2P_PORT='33874'
BITCOIN_RPC_PROTOCOL='http'
# Default wallet name
BITCOIN_DEFAULT_WALLET='defaultwallet'

# Port for Bitcoin Computer Node
BCN_PORT='1031'

# Enable to launch with fixed number of parallel workers
# BCN_NUM_WORKERS='6'

BCN_ZMQ_URL='tcp://node:28332'
BCN_ZMQ_PORT='28332'
# Height of the block at which the zmq connection should start
BCN_ZMQ_ACTIVATION_HEIGHT=300000


# Url of the Bitcoin Computer Node, defaults to localhost
BCN_URL='http://127.0.0.1:1031'

# Allowed RPC Methods
BCN_ALLOWED_RPC_METHODS='^get|^gen|^send|^lis'

# Setup the environment to 'prod' (no console logs) or 'dev'
BCN_ENV='dev'

# Winston Logger Settings
# Log levels
# 0: Error logs only
# 1: Error and warning logs
# 2: Error, warning and info logs
# 3: Error, warning, info and http logs
# 4: Error, warning, info, http and debug logs
BCN_LOG_LEVEL='2'
# Maximum number of logs to keep. If not set, no logs will be removed. This can be
# a number of files or number of days. If using days, add 'd' as the suffix.
BCN_LOG_MAX_FILES='14d'
# Maximum log file size. You can use 'k' for KB, 'm' for MB, and 'g' for GB. Once
# the size of the log file exceeds the specified size, the log is rotated. If no
# size is specified the log is not rotated.
BCN_LOG_MAX_SIZE='20m'
# A boolean to define whether or not to gzip archived log files.
BCN_LOG_ZIP='false'

# Show logs at db service
BCN_SHOW_DB_LOGS='false'

# Rate Limiting Settings
BCN_RATE_LIMIT_ENABLED='false'
BCN_RATE_LIMIT_WINDOW='900000'
BCN_RATE_LIMIT_MAX='300'
BCN_RATE_LIMIT_STANDARD_HEADERS='true'
BCN_RATE_LIMIT_LEGACY_HEADERS='false'

# Comma separated list of banned countries, encoded as ISO-3166 alpha2 country.
# codes (see https://www.geonames.org/countries/)
BCN_BANNED_COUNTRIES=

# Default value for protocol in the _url parameter. Set to https if behind a load balancer.
BCN_OFFCHAIN_PROTOCOL=
Loading