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: 2 additions & 0 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
.env*
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@ coverage
/.direnv/
.claude/
.cursor/
.serena/
_bmad*
# Local MPC p-shares (never commit)
local-pshares/
**/local-pshares/
# MPCv2 two-script workspace (sensitive state; never commit)
mpc-keygen-workspace/
**/mpc-keygen-workspace/
mpc-sign-workspace/
**/mpc-sign-workspace/
multisig-workspace/
**/multisig-workspace/
multisig-sign-workspace/
**/multisig-sign-workspace/
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 24.6.0
current 25.4.0
52 changes: 52 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# AGENTS.md — MCP Routing (Always Apply)

The agent must choose **exactly one primary MCP** per task. Priority order: **Semantic (code) → Physical (file) → External (web/docs)**. Do not duplicate sources of truth; only persist **stable human decisions**.

---

## 1. Choose MCP by user request type

| User request / Intent | Action: use which MCP |
|------------------------|------------------------|
| **Read or modify existing code** — trace logic, refactor, find symbol, understand flow, fix bug in codebase | → **Serena** (prefer symbolic/overview; avoid reading whole files unless needed). |
| **Plain file operations** — create/edit/delete files, docs, ADRs, config, copy files | → **filesystem**. |
| **View structure / architecture** — map modules, dependencies, packages, overall architecture | → **GKG**. |
| **Long-term memory** — invariants, design decisions, fixed conventions | → **server-memory** (one fact = one short observation). |
| **Look up official API** — official docs, signatures, specific versions | → **Context7**. |
| **Broad research / comparison** — news, tech comparisons, high-level research | → **Perplexity**. |
| **Complex reasoning** — architecture design, hard bug analysis, multi-step planning | → **sequential-thinking**. |

---

## 2. When NOT to use each MCP

- **Serena**: Do not use when you only need simple read/write of files (use filesystem).
- **filesystem**: Do not use when you need code semantics or symbol relationships (use Serena/GKG).
- **GKG**: Do not use when you only need a single symbol in one file (Serena is enough).
- **server-memory**: Do not use for temporary state or information already in code/docs.
- **Context7**: Do not use for open-ended research or broad comparison (use Perplexity).
- **Perplexity**: Do not use when docs/source are already known (use Context7 or Serena).
- **sequential-thinking**: Do not use for simple questions or quick Q&A.

---

## 3. Sources of truth (no duplication)

- **Code truth** → get from **Serena** or **GKG**; do not store copies in memory.
- **Decision truth** (conventions, invariants, ADRs) → **server-memory**; one fact = one short observation.

---

## 4. Quick examples by request

| User says / wants | MCP to use |
|-------------------|------------|
| "Find where function X is called", "Refactor module Y", "Bug in file Z" | **Serena** |
| "Create README", "Write ADR", "Edit config" | **filesystem** |
| "Draw dependencies", "Package structure", "System architecture" | **GKG** |
| "Remember to always use pattern A", "Naming convention B" | **server-memory** |
| "React 19 use() API", "Signature of function X in lib Y" | **Context7** |
| "Compare Next vs Remix", "Latest way to do X" | **Perplexity** |
| "Design login flow", "Analyze root cause of complex bug" | **sequential-thinking** |

If the request does not match any row: follow **Semantic → Physical → External** and pick the single most fitting MCP; do not invoke multiple MCPs for the same purpose.
71 changes: 71 additions & 0 deletions README.bitgo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# BitGo JavaScript SDK

The BitGo Platform and SDK makes it easy to build multi-signature crypto-currency applications today with support for Bitcoin, Ethereum and many other coins.
The SDK is fully integrated with the BitGo co-signing service for managing all of your BitGo wallets.

Included in the SDK are examples for how to use the API to manage your multi-signature wallets.

Please email us at support@bitgo.com if you have questions or comments about this API.

## Module Overview

The BitGo SDK repository is a monorepo composed of separate modules, each of which implement some subset of the features of the SDK.

| Package Name | Module | Description | |
| ------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| bitgo | `bitgo` | Authentication, wallet management, user authentication, cryptographic primitives, abstract coin interfaces, coin implementations. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/bitgo) |
| @bitgo/account-lib | `account-lib` | Build and sign transactions for account-based coins. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/account-lib) |
| @bitgo/blake2b | `blake2b` | Blake2b (64-bit version) in pure JavaScript. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/blake2b) |
| @bitgo/blake2b-wasm | `blake2b-wasm` | Blake2b implemented in WASM. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/blake2b-wasm) |
| @bitgo/blockapis | `blockapis` | Access public block explorer APIs for a variety of coins. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/blockapis) |
| @bitgo/express | `express` | Local BitGo transaction signing server and proxy. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/express) |
| @bitgo/statics | `statics` | Static configuration values used across the BitGo platform. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/statics) |
| @bitgo/unspents | `unspents` | Defines the chain codes used for different unspent types and methods to calculate bitcoin transaction sizes. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/unspents) |
| @bitgo/utxo-bin | `utxo-bin` | Command-line utility for BitGo UTXO transactions. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-bin) |
| @bitgo/utxo-lib | `utxo-lib` | Build and sign transactions for utxo-based coins. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib) |

# Release Notes

Each module provides release notes in `modules/*/CHANGELOG.md`.

The release notes for the `bitgo` module are [here](https://github.com/BitGo/BitGoJS/blob/master/modules/bitgo/CHANGELOG.md).

## Release Cycle

The BitGoJS SDK use a number of branches to control the development of various packages throughout the deployment lifecycle. Provided below is an overview to how branches relate to one another.

| Branch | Status | NPM | Description |
| ------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `master` | Unstable | N/A | Ongoing development of SDK packages |
| `rel/latest` | Stable | `latest` | Deployed packages from `master` to `rel/latest`. This includes Express and is recommended to use `rel/latest` when not using Docker images for Express. |

Other tags may be released to npm (e.g. `hotfix`, `dev`, etc...), but are not considered critical to the common path for consumers usage of SDK packages unless otherwise stated.

# Examples

Examples can be found in each of the modules specific to the module use cases. Starter examples can be found [here](https://github.com/BitGo/BitGoJS/tree/master/examples).

# NodeJS Version Support Policy

BitGoJS currently provides support for the following Node versions per package.json engines policy:

```
"engines": {
"node": ">=20 <25",
"npm": ">=3.10.10"
}
```

We specifically limit our support to these versions of Node, not because this package won't work on other versions, but because these versions tend to be the most widely used in practice. It's possible the packages in this repository will work correctly on newer or older versions of Node, but we typically don't run automated tests against non-specified versions of Node (including odd versions), with the possible exception of the latest odd numbered version for advanced awareness of upcoming breaks in version support.

As each Node LTS version reaches its end-of-life we will exclude that version from the node engines property of our package's package.json file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node, and any pull requests or issues regarding support for an end-of-life version of Node will be closed. We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs the full test suite on the latest release of the following versions of node:

- `20`
- `22`
- `24`

JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node engines property. If you encounter issues installing this package on a supported version of Node, please report the issue to us.

# Notes for Developers

See [DEVELOPERS.md](https://github.com/BitGo/BitGoJS/blob/master/DEVELOPERS.md)
78 changes: 12 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,17 @@
# BitGo JavaScript SDK

The BitGo Platform and SDK makes it easy to build multi-signature crypto-currency applications today with support for Bitcoin, Ethereum and many other coins.
The SDK is fully integrated with the BitGo co-signing service for managing all of your BitGo wallets.
This is a forked version of BitGo JS SDK, checkout from tag `bitgo@50.23.0`.

Included in the SDK are examples for how to use the API to manage your multi-signature wallets.
The purpose is to document and research BitGo cryptography implementation.

Please email us at support@bitgo.com if you have questions or comments about this API.
## Document index

## Module Overview

The BitGo SDK repository is a monorepo composed of separate modules, each of which implement some subset of the features of the SDK.

| Package Name | Module | Description | |
| ------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| bitgo | `bitgo` | Authentication, wallet management, user authentication, cryptographic primitives, abstract coin interfaces, coin implementations. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/bitgo) |
| @bitgo/account-lib | `account-lib` | Build and sign transactions for account-based coins. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/account-lib) |
| @bitgo/blake2b | `blake2b` | Blake2b (64-bit version) in pure JavaScript. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/blake2b) |
| @bitgo/blake2b-wasm | `blake2b-wasm` | Blake2b implemented in WASM. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/blake2b-wasm) |
| @bitgo/blockapis | `blockapis` | Access public block explorer APIs for a variety of coins. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/blockapis) |
| @bitgo/express | `express` | Local BitGo transaction signing server and proxy. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/express) |
| @bitgo/statics | `statics` | Static configuration values used across the BitGo platform. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/statics) |
| @bitgo/unspents | `unspents` | Defines the chain codes used for different unspent types and methods to calculate bitcoin transaction sizes. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/unspents) |
| @bitgo/utxo-bin | `utxo-bin` | Command-line utility for BitGo UTXO transactions. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-bin) |
| @bitgo/utxo-lib | `utxo-lib` | Build and sign transactions for utxo-based coins. | [Link](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib) |

# Release Notes

Each module provides release notes in `modules/*/CHANGELOG.md`.

The release notes for the `bitgo` module are [here](https://github.com/BitGo/BitGoJS/blob/master/modules/bitgo/CHANGELOG.md).

## Release Cycle

The BitGoJS SDK use a number of branches to control the development of various packages throughout the deployment lifecycle. Provided below is an overview to how branches relate to one another.

| Branch | Status | NPM | Description |
| ------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `master` | Unstable | N/A | Ongoing development of SDK packages |
| `rel/latest` | Stable | `latest` | Deployed packages from `master` to `rel/latest`. This includes Express and is recommended to use `rel/latest` when not using Docker images for Express. |

Other tags may be released to npm (e.g. `hotfix`, `dev`, etc...), but are not considered critical to the common path for consumers usage of SDK packages unless otherwise stated.

# Examples

Examples can be found in each of the modules specific to the module use cases. Starter examples can be found [here](https://github.com/BitGo/BitGoJS/tree/master/examples).

# NodeJS Version Support Policy

BitGoJS currently provides support for the following Node versions per package.json engines policy:

```
"engines": {
"node": ">=20 <25",
"npm": ">=3.10.10"
}
```

We specifically limit our support to these versions of Node, not because this package won't work on other versions, but because these versions tend to be the most widely used in practice. It's possible the packages in this repository will work correctly on newer or older versions of Node, but we typically don't run automated tests against non-specified versions of Node (including odd versions), with the possible exception of the latest odd numbered version for advanced awareness of upcoming breaks in version support.

As each Node LTS version reaches its end-of-life we will exclude that version from the node engines property of our package's package.json file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node, and any pull requests or issues regarding support for an end-of-life version of Node will be closed. We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs the full test suite on the latest release of the following versions of node:

- `20`
- `22`
- `24`

JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node engines property. If you encounter issues installing this package on a supported version of Node, please report the issue to us.

# Notes for Developers

See [DEVELOPERS.md](https://github.com/BitGo/BitGoJS/blob/master/DEVELOPERS.md)
1. The origin document is [here](README.bitgo.md)
2. MPC related research documents:
- [MPC terminologies](examples/docs/self-custody/mpc/terminology-guide.md)
- [MPC v2 create wallet example](examples/docs/self-custody/mpc/create-wallet-mpcv2-script.md)
- [MPC v2 sign tx example](examples/docs/self-custody/mpc/sign-transaction-mpcv2-script.md)
3. Multisig self-custody:
- [Multisig terminologies](examples/docs/self-custody/multisig/terminology-guide.md)
- [Multisig create wallet example](examples/docs/self-custody/multisig/create-wallet-multisig-script.md)
- [Multisig sign tx example](examples/docs/self-custody/multisig/sign-transaction-multisig-script.md)
32 changes: 32 additions & 0 deletions examples/docs/self-custody/eddsa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# EdDSA TSS Self-Custody — Documentation Index

Scripts live in [`examples/js/self-custody-eddsa/`](../../../js/self-custody-eddsa/).

**Start here:** [README in script folder](../../../js/self-custody-eddsa/README.md) — overview, file inventory, env vars, copy-between-machines guide, troubleshooting.

## Detailed guides

| Topic | Document |
|-------|----------|
| Create wallet (offline/online, 5 steps) | [create-wallet-eddsa-script.md](./create-wallet-eddsa-script.md) |
| Sign transaction (offline/online, 7 steps) | [sign-transaction-eddsa-script.md](./sign-transaction-eddsa-script.md) |

## Scripts quick reference

| Script | Purpose |
|--------|---------|
| `eddsa-self-custody-online.js` | Wallet creation — online steps 0, 1, 2 |
| `eddsa-self-custody-offline.js` | Wallet creation — offline steps 1, 2 |
| `eddsa-self-custody-sign-online.js` | Transaction signing — online steps 0–3 |
| `eddsa-self-custody-sign-offline.js` | Transaction signing — offline steps 1–3 |
| `eddsa-create-wallet-address.js` | Create receive address (online only) |

## External references

- [Create MPC Keys (EdDSA)](https://developers.bitgo.com/docs/wallets-create-mpc-keys)
- [Withdraw - Self-Custody MPC Hot (Manual)](https://developers.bitgo.com/docs/withdraw-wallet-type-self-custody-mpc-hot-manual)

## Related

- ECDSA MPCv2: [../mpc/create-wallet-mpcv2-script.md](../mpc/create-wallet-mpcv2-script.md)
- Single-host TSS: `examples/js/create-tss-wallet.js`
Loading