Skip to content

Commit e9c088b

Browse files
committed
demos: add remote signing coordinator
1 parent 655aff3 commit e9c088b

27 files changed

Lines changed: 6986 additions & 0 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
COORDINATOR_LISTEN=127.0.0.1:8091
2+
COORDINATOR_API_URL=http://127.0.0.1:8091
3+
4+
TAP_TRANSPORT=grpc
5+
TAPD_HOST=localhost:10029
6+
TAPD_REST_URL=https://localhost:8089
7+
TAPD_NETWORK=regtest
8+
TAPD_TLS_PATH=.tapd/alice/tls.cert
9+
TAPD_MACAROON_PATH=.tapd/alice/admin.macaroon
10+
TAPD_TLS_INSECURE=false
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.env
2+
.tapd/
3+
server/remote-signing-coordinator
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Remote Signing Coordinator
2+
3+
This demo is a local coordinator for Taproot Assets Issuances that need an
4+
external signing device. It uses the Go SDK on the server side and a
5+
Next.js/Tailwind dashboard for the browser workflow.
6+
7+
The dashboard does not talk to `tapd` directly. The Go server connects to
8+
`tapd`, starts an SDK issuer call, pauses when the SDK asks for an external
9+
Issuance signature, exposes the unsigned virtual PSBT for review, accepts the
10+
signed virtual PSBT, and then lets the SDK finalize the Issuance.
11+
12+
## Requirements
13+
14+
- Docker with Compose
15+
- Go, using the version required by this repository
16+
- Node.js with Yarn 4 through Corepack
17+
18+
If Corepack is not enabled yet:
19+
20+
```bash
21+
corepack enable
22+
```
23+
24+
## Quick Start
25+
26+
From this directory:
27+
28+
```bash
29+
cd dashboard
30+
yarn install
31+
yarn regtest
32+
yarn dev
33+
```
34+
35+
Open the dashboard at:
36+
37+
```text
38+
http://127.0.0.1:3000
39+
```
40+
41+
`yarn regtest` starts the repository integration-test regtest stack and exports
42+
Alice and Bob `tapd` credentials into `.tapd/`. The default `.env` values point
43+
the coordinator at Alice on regtest.
44+
45+
Stop the regtest stack with:
46+
47+
```bash
48+
yarn regtest:down
49+
```
50+
51+
## Commands
52+
53+
Run from `dashboard/`:
54+
55+
| Command | Purpose |
56+
| --- | --- |
57+
| `yarn dev` | Run the Go coordinator and dashboard together |
58+
| `yarn server` | Run only the Go coordinator |
59+
| `yarn dashboard` | Run only the Next.js dashboard |
60+
| `yarn regtest` | Start the pinned regtest stack and export creds |
61+
| `yarn regtest:down` | Stop the pinned regtest stack |
62+
| `yarn test` | Typecheck, lint, build dashboard, build server |
63+
64+
## Configuration
65+
66+
Defaults live in `.env.example`. Running any demo command creates `.env` from
67+
that file if it does not exist.
68+
69+
| Variable | Default |
70+
| --- | --- |
71+
| `COORDINATOR_LISTEN` | `127.0.0.1:8091` |
72+
| `COORDINATOR_API_URL` | `http://127.0.0.1:8091` |
73+
| `TAP_TRANSPORT` | `grpc` |
74+
| `TAPD_HOST` | `localhost:10029` |
75+
| `TAPD_REST_URL` | `https://localhost:8089` |
76+
| `TAPD_NETWORK` | `regtest` |
77+
| `TAPD_TLS_PATH` | `.tapd/alice/tls.cert` |
78+
| `TAPD_MACAROON_PATH` | `.tapd/alice/admin.macaroon` |
79+
| `TAPD_TLS_INSECURE` | `false` |
80+
81+
Relative paths are resolved from this demo directory, so the default credential
82+
paths work after `corepack yarn regtest`.
83+
84+
## Flow
85+
86+
1. Enter the external Issuance key descriptor: account xpub, master
87+
fingerprint, and full child derivation path, such as
88+
`m/86'/1'/0'/0/0` on regtest.
89+
2. Start either a new Asset or a new Issuance for an existing AssetRef.
90+
3. The server calls the SDK issuer with an external signer callback.
91+
4. The SDK stages and funds the Issuance, then returns a signing request.
92+
5. The dashboard presents the SDK review fields:
93+
- the virtual PSBT authorizes a new Issuance
94+
- the AssetRef being affected
95+
- the amount by which supply increases
96+
- the Issuance key descriptor
97+
- the script key that controls the minted Asset
98+
- the anchor outpoint that commits the Issuance
99+
6. Sign the virtual PSBT externally.
100+
7. Paste the signed virtual PSBT into the dashboard.
101+
8. The SDK submits the signature, seals the batch, and finalizes the Issuance.
102+
103+
State is kept in memory. Restarting the Go coordinator clears sessions.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.next/
2+
node_modules/
3+
out/
4+
dist/
5+
build/
6+
.yarn/
7+
!.yarn/releases/
8+
*.tsbuildinfo
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import nextVitals from "eslint-config-next/core-web-vitals";
3+
import nextTs from "eslint-config-next/typescript";
4+
5+
const eslintConfig = defineConfig([
6+
...nextVitals,
7+
...nextTs,
8+
globalIgnores([
9+
".next/**",
10+
"node_modules/**",
11+
"out/**",
12+
"dist/**",
13+
"build/**",
14+
"next-env.d.ts",
15+
]),
16+
]);
17+
18+
export default eslintConfig;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/lightninglabs/tap-sdk/demos/remote-signing-coordinator/dashboard
2+
3+
go 1.25.7
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
import "./.next/types/routes.d.ts";
4+
5+
// NOTE: This file should not be edited
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { dirname } from "node:path";
2+
import { fileURLToPath } from "node:url";
3+
4+
import type { NextConfig } from "next";
5+
6+
const apiUrl = process.env.COORDINATOR_API_URL ?? "http://127.0.0.1:8091";
7+
const root = dirname(fileURLToPath(import.meta.url));
8+
9+
const nextConfig: NextConfig = {
10+
allowedDevOrigins: ["127.0.0.1", "localhost"],
11+
turbopack: {
12+
root,
13+
},
14+
async rewrites() {
15+
return [
16+
{
17+
source: "/api/:path*",
18+
destination: `${apiUrl}/api/:path*`,
19+
},
20+
];
21+
},
22+
};
23+
24+
export default nextConfig;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@lightninglabs/tap-remote-signing-dashboard",
3+
"version": "0.1.0",
4+
"private": true,
5+
"packageManager": "yarn@4.13.0",
6+
"scripts": {
7+
"dev": "concurrently -n server,dashboard -c cyan,magenta \"yarn server\" \"yarn dashboard\"",
8+
"dashboard": "cd .. && ./scripts/ensure-env.sh && cd dashboard && dotenv -e ../.env -- next dev -p 3000",
9+
"server": "cd .. && ./scripts/ensure-env.sh && go run ./server",
10+
"server:build": "cd .. && go build -o ./server/remote-signing-coordinator ./server",
11+
"regtest": "cd ../../.. && make itest-up && cd demos/remote-signing-coordinator && ./scripts/export-tapd-creds.sh",
12+
"regtest:down": "cd ../../.. && make itest-down",
13+
"build": "next build",
14+
"start": "cd .. && ./scripts/ensure-env.sh && cd dashboard && dotenv -e ../.env -- next start -p 3000",
15+
"lint": "eslint",
16+
"typecheck": "tsc --noEmit",
17+
"test": "yarn typecheck && yarn lint && yarn build && yarn server:build",
18+
"clean": "rm -rf node_modules .next out dist build ../server/remote-signing-coordinator"
19+
},
20+
"dependencies": {
21+
"concurrently": "9.2.1",
22+
"dotenv-cli": "11.0.0",
23+
"lucide-react": "1.14.0",
24+
"next": "16.2.6",
25+
"react": "19.2.6",
26+
"react-dom": "19.2.6"
27+
},
28+
"devDependencies": {
29+
"@tailwindcss/postcss": "4.3.0",
30+
"@types/node": "25.7.0",
31+
"@types/react": "19.2.14",
32+
"@types/react-dom": "19.2.3",
33+
"eslint": "9.39.4",
34+
"eslint-config-next": "16.2.6",
35+
"tailwindcss": "4.3.0",
36+
"typescript": "6.0.3"
37+
}
38+
}

0 commit comments

Comments
 (0)