# drakensoftware/chaingate architecture

> Architecture diagram of the GitHub repository drakensoftware/chaingate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/drakensoftware/chaingate
- Repository: https://github.com/drakensoftware/chaingate

## Overview

ChainGate is a TypeScript SDK for creating or importing multi-chain wallets, selecting a network, exploring chain data, and preparing, signing, and broadcasting transactions. Its main entry point routes network-specific requests to explorer and connector implementations; the generated API client serves hosted-API operations, while RPC connectors communicate with caller-selected EVM endpoints. Wallet creation, encryption, and real-time event subscriptions are distinct capabilities. The README documents broader explorer and event features than the sampled excerpts show, so uncertain internal wiring is omitted.

Main entry points: [`src/ChainGate/ChainGate.ts`](https://github.com/drakensoftware/chaingate/blob/main/src/ChainGate/ChainGate.ts) (ChainGate), [`src/Explorer/UtxoExplorer.ts`](https://github.com/drakensoftware/chaingate/blob/main/src/Explorer/UtxoExplorer.ts) (UTXO explorer), [`src/Wallet/Wallet.ts`](https://github.com/drakensoftware/chaingate/blob/main/src/Wallet/Wallet.ts) (Wallets), [`src/Connector/UtxoConnector/UtxoConnector.ts`](https://github.com/drakensoftware/chaingate/blob/main/src/Connector/UtxoConnector/UtxoConnector.ts) (UTXO connector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["SDK and networks"]
  node_chaingate["ChainGate<br/>[ChainGate.ts]"]
  node_networks["Network descriptors"]
end

subgraph group_wallet["Wallets and keys"]
  node_walletfactory["Wallet factory<br/>[WalletFactory.ts]"]
  node_wallet["Wallets<br/>[Wallet.ts]"]
  node_keystore["Keystores<br/>[Keystore.ts]"]
end

subgraph group_chain["Chain access"]
  node_utxoconnector["UTXO connector<br/>[UtxoConnector.ts]"]
  node_bchconnector["Bitcoin Cash connector<br/>[BchConnector.ts]"]
  node_evmconnector["EVM connector<br/>[EvmConnector.ts]"]
  node_rpcconnector["EVM RPC connector<br/>[EvmRpcConnector.ts]"]
  node_utxoexplorer["UTXO explorer<br/>[UtxoExplorer.ts]"]
  node_evmexplorer["EVM explorer<br/>[EvmExplorer.ts]"]
  node_rpcexplorer["EVM RPC explorer<br/>[EvmRpcExplorer.ts]"]
  node_globalexplorer["Global explorer<br/>[GlobalExplorer.ts]"]
  node_api["Generated API client<br/>[client.gen.ts]"]
end

subgraph group_events["Live events"]
  node_eventstreams["Event stream manager<br/>[EventStreams.ts]"]
  node_eventstream["WebSocket stream<br/>[EventStream.ts]"]
end

subgraph group_support["Signing utilities"]
  node_signing["Signing wallets<br/>[SigningWallet.ts]"]
  node_amount["Amount and units<br/>[Amount.ts]"]
end

node_developer(("SDK user"))
node_hostedapi{{"ChainGate API"}}
node_evmrpc{{"EVM RPC service"}}
node_broadcast{{"Transaction broadcast"}}
node_websocket{{"ChainGate event service"}}

node_developer -->|"creates SDK"| node_chaingate
node_developer -->|"creates or imports"| node_walletfactory
node_developer -->|"selects network"| node_chaingate
node_chaingate -->|"provides networks"| node_networks
node_chaingate -->|"creates explorer"| node_utxoexplorer
node_chaingate -->|"creates explorer"| node_evmexplorer
node_chaingate -->|"creates explorer"| node_rpcexplorer
node_chaingate -->|"creates explorer"| node_globalexplorer
node_chaingate -->|"creates connector"| node_utxoconnector
node_chaingate -->|"creates connector"| node_bchconnector
node_chaingate -->|"creates connector"| node_evmconnector
node_chaingate -->|"creates connector"| node_rpcconnector
node_walletfactory -->|"builds wallet"| node_wallet
node_walletfactory -->|"imports keystore"| node_keystore
node_utxoconnector -->|"uses wallet"| node_wallet
node_bchconnector -->|"uses wallet"| node_wallet
node_evmconnector -->|"uses wallet"| node_wallet
node_rpcconnector -->|"uses wallet"| node_wallet
node_utxoconnector -->|"queries and broadcasts"| node_utxoexplorer
node_bchconnector -->|"queries and broadcasts"| node_utxoexplorer
node_evmconnector -->|"queries and broadcasts"| node_evmexplorer
node_rpcconnector -->|"queries and broadcasts"| node_rpcexplorer
node_utxoexplorer -->|"requests chain data"| node_api
node_evmexplorer -->|"requests chain data"| node_api
node_globalexplorer -->|"requests global data"| node_api
node_api -->|"sends HTTP requests"| node_hostedapi
node_rpcexplorer -->|"sends RPC requests"| node_evmrpc
node_utxoexplorer -->|"submits transactions"| node_broadcast
node_evmexplorer -->|"submits transactions"| node_broadcast
node_rpcconnector -->|"signs transactions"| node_signing
node_evmconnector -->|"signs transactions"| node_signing
node_utxoconnector -->|"signs transactions"| node_signing
node_developer -->|"subscribes events"| node_eventstreams
node_chaingate -->|"provides streams"| node_eventstreams
node_eventstreams -->|"manages streams"| node_eventstream
node_eventstream -->|"exchanges frames"| node_websocket
node_developer -->|"converts units"| node_amount

click node_chaingate "https://github.com/drakensoftware/chaingate/blob/main/src/ChainGate/ChainGate.ts"
click node_networks "https://github.com/drakensoftware/chaingate/blob/main/src/ChainGate/networks/NetworkCollection.ts"
click node_walletfactory "https://github.com/drakensoftware/chaingate/blob/main/src/WalletFactory.ts"
click node_wallet "https://github.com/drakensoftware/chaingate/blob/main/src/Wallet/Wallet.ts"
click node_keystore "https://github.com/drakensoftware/chaingate/blob/main/src/Keystore/Keystore.ts"
click node_utxoconnector "https://github.com/drakensoftware/chaingate/blob/main/src/Connector/UtxoConnector/UtxoConnector.ts"
click node_bchconnector "https://github.com/drakensoftware/chaingate/blob/main/src/Connector/UtxoConnector/BchConnector/BchConnector.ts"
click node_evmconnector "https://github.com/drakensoftware/chaingate/blob/main/src/Connector/EvmConnector/EvmConnector.ts"
click node_rpcconnector "https://github.com/drakensoftware/chaingate/blob/main/src/Connector/EvmRpcConnector/EvmRpcConnector.ts"
click node_utxoexplorer "https://github.com/drakensoftware/chaingate/blob/main/src/Explorer/UtxoExplorer.ts"
click node_evmexplorer "https://github.com/drakensoftware/chaingate/blob/main/src/Explorer/EvmExplorer.ts"
click node_rpcexplorer "https://github.com/drakensoftware/chaingate/blob/main/src/Connector/EvmRpcConnector/EvmRpcExplorer.ts"
click node_globalexplorer "https://github.com/drakensoftware/chaingate/blob/main/src/Explorer/GlobalExplorer.ts"
click node_api "https://github.com/drakensoftware/chaingate/blob/main/src/Client/client.gen.ts"
click node_eventstreams "https://github.com/drakensoftware/chaingate/blob/main/src/Events/EventStreams.ts"
click node_eventstream "https://github.com/drakensoftware/chaingate/blob/main/src/Events/EventStream.ts"
click node_signing "https://github.com/drakensoftware/chaingate/blob/main/src/Wallet/SigningWallet/SigningWallet.ts"
click node_amount "https://github.com/drakensoftware/chaingate/blob/main/src/utils/Amount.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chaingate,node_networks,node_developer toneBlue
class node_walletfactory,node_wallet,node_keystore toneAmber
class node_utxoconnector,node_bchconnector,node_evmconnector,node_rpcconnector,node_utxoexplorer,node_evmexplorer,node_rpcexplorer,node_globalexplorer,node_api,node_hostedapi toneMint
class node_eventstreams,node_eventstream toneRose
class node_signing,node_amount,node_evmrpc,node_broadcast,node_websocket toneIndigo
```

## Components

### SDK and networks

- [ChainGate](https://github.com/drakensoftware/chaingate/blob/main/src/ChainGate/ChainGate.ts): `src/ChainGate/ChainGate.ts`
- [Network descriptors](https://github.com/drakensoftware/chaingate/blob/main/src/ChainGate/networks/NetworkCollection.ts): `src/ChainGate/networks/NetworkCollection.ts`

### Wallets and keys

- [Wallet factory](https://github.com/drakensoftware/chaingate/blob/main/src/WalletFactory.ts): `src/WalletFactory.ts`
- [Wallets](https://github.com/drakensoftware/chaingate/blob/main/src/Wallet/Wallet.ts): `src/Wallet/Wallet.ts`
- [Keystores](https://github.com/drakensoftware/chaingate/blob/main/src/Keystore/Keystore.ts): `src/Keystore/Keystore.ts`

### Chain access

- [UTXO connector](https://github.com/drakensoftware/chaingate/blob/main/src/Connector/UtxoConnector/UtxoConnector.ts): `src/Connector/UtxoConnector/UtxoConnector.ts`
- [Bitcoin Cash connector](https://github.com/drakensoftware/chaingate/blob/main/src/Connector/UtxoConnector/BchConnector/BchConnector.ts): `src/Connector/UtxoConnector/BchConnector/BchConnector.ts`
- [EVM connector](https://github.com/drakensoftware/chaingate/blob/main/src/Connector/EvmConnector/EvmConnector.ts): `src/Connector/EvmConnector/EvmConnector.ts`
- [EVM RPC connector](https://github.com/drakensoftware/chaingate/blob/main/src/Connector/EvmRpcConnector/EvmRpcConnector.ts): `src/Connector/EvmRpcConnector/EvmRpcConnector.ts`
- [UTXO explorer](https://github.com/drakensoftware/chaingate/blob/main/src/Explorer/UtxoExplorer.ts): `src/Explorer/UtxoExplorer.ts`
- [EVM explorer](https://github.com/drakensoftware/chaingate/blob/main/src/Explorer/EvmExplorer.ts): `src/Explorer/EvmExplorer.ts`
- [EVM RPC explorer](https://github.com/drakensoftware/chaingate/blob/main/src/Connector/EvmRpcConnector/EvmRpcExplorer.ts): `src/Connector/EvmRpcConnector/EvmRpcExplorer.ts`
- [Global explorer](https://github.com/drakensoftware/chaingate/blob/main/src/Explorer/GlobalExplorer.ts): `src/Explorer/GlobalExplorer.ts`
- [Generated API client](https://github.com/drakensoftware/chaingate/blob/main/src/Client/client.gen.ts): `src/Client/client.gen.ts`

### Live events

- [Event stream manager](https://github.com/drakensoftware/chaingate/blob/main/src/Events/EventStreams.ts): `src/Events/EventStreams.ts`
- [WebSocket stream](https://github.com/drakensoftware/chaingate/blob/main/src/Events/EventStream.ts): `src/Events/EventStream.ts`

### Signing utilities

- [Signing wallets](https://github.com/drakensoftware/chaingate/blob/main/src/Wallet/SigningWallet/SigningWallet.ts): `src/Wallet/SigningWallet/SigningWallet.ts`
- [Amount and units](https://github.com/drakensoftware/chaingate/blob/main/src/utils/Amount.ts): `src/utils/Amount.ts`

### Other components

- **SDK user**
- **ChainGate API**
- **EVM RPC service**
- **Transaction broadcast**
- **ChainGate event service**

## Connections

- SDK user → ChainGate: creates SDK
- SDK user → Wallet factory: creates or imports
- SDK user → ChainGate: selects network
- ChainGate → Network descriptors: provides networks
- ChainGate → UTXO explorer: creates explorer
- ChainGate → EVM explorer: creates explorer
- ChainGate → EVM RPC explorer: creates explorer
- ChainGate → Global explorer: creates explorer
- ChainGate → UTXO connector: creates connector
- ChainGate → Bitcoin Cash connector: creates connector
- ChainGate → EVM connector: creates connector
- ChainGate → EVM RPC connector: creates connector
- Wallet factory → Wallets: builds wallet
- Wallet factory → Keystores: imports keystore
- UTXO connector → Wallets: uses wallet
- Bitcoin Cash connector → Wallets: uses wallet
- EVM connector → Wallets: uses wallet
- EVM RPC connector → Wallets: uses wallet
- UTXO connector → UTXO explorer: queries and broadcasts
- Bitcoin Cash connector → UTXO explorer: queries and broadcasts
- EVM connector → EVM explorer: queries and broadcasts
- EVM RPC connector → EVM RPC explorer: queries and broadcasts
- UTXO explorer → Generated API client: requests chain data
- EVM explorer → Generated API client: requests chain data
- Global explorer → Generated API client: requests global data
- Generated API client → ChainGate API: sends HTTP requests
- EVM RPC explorer → EVM RPC service: sends RPC requests
- UTXO explorer → Transaction broadcast: submits transactions
- EVM explorer → Transaction broadcast: submits transactions
- EVM RPC connector → Signing wallets: signs transactions
- EVM connector → Signing wallets: signs transactions
- UTXO connector → Signing wallets: signs transactions
- SDK user → Event stream manager: subscribes events
- ChainGate → Event stream manager: provides streams
- Event stream manager → WebSocket stream: manages streams
- WebSocket stream → ChainGate event service: exchanges frames
- SDK user → Amount and units: converts units
