File size: 5,241 Bytes
4a30181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# rgb-proxy-server — Developer Reference

> **Source:** https://github.com/RGB-Tools/rgb-proxy-server
> **Docker:** `ghcr.io/rgb-tools/rgb-proxy-server`
> **Protocol spec:** https://github.com/RGB-Tools/rgb-http-json-rpc
> **Part of:** github.com/RGB-Tools — official higher-level projects for RGB Protocol on Bitcoin v0.11.1

The RGB proxy server relays consignment files between RGB wallets. It implements the RGB HTTP JSON-RPC protocol and is the **primary transport method for RGB asset transfers in production**.

---

## What it does

In RGB Protocol, asset transfers require exchanging off-chain data (consignment files) between the payer and the payee. The proxy server acts as an intermediary:

1. Payer creates transfer and **posts the consignment** to the proxy (using the payee's blinded UTXO as identifier)
2. Payee **fetches the consignment** by blinded UTXO
3. Payee validates the consignment locally (client-side)
4. Payee **posts ACK** (valid) or **NACK** (invalid)
5. Payer checks ACK/NACK — if ACK, broadcasts the Bitcoin transaction with the commitment

The proxy server does **not validate asset state** and does **not need to be trusted**. Anyone can self-host an instance. Users concerned about censorship can switch providers.

---

## Run

### Locally (Node.js)

```sh
# Install dependencies
npm install

# Development mode (port 3000, auto-reload)
npm run dev

# Production
npm run build
npm run start
```

### Docker

```sh
# Basic run
docker run -d ghcr.io/rgb-tools/rgb-proxy-server

# With persistent data (recommended for production)
docker run -d \
  -v /host/path:/home/node/.rgb-proxy-server \
  ghcr.io/rgb-tools/rgb-proxy-server
# Note: /host/path must be owned by user:group 1000
```

### Data storage

Default: `$HOME/.rgb-proxy-server`  
Override: set `APP_DATA` environment variable

---

## API (JSON-RPC over HTTP)

All requests go to: `POST http://<host>:<port>/json-rpc`  
Content-Type: `application/json` (for JSON body) or `multipart/form-data` (for file upload)

---

### `consignment.post` — Payer posts consignment

```sh
curl -X POST -H 'Content-Type: multipart/form-data' \
  -F 'jsonrpc=2.0' \
  -F 'id="1"' \
  -F 'method=consignment.post' \
  -F 'params[recipient_id]=<blinded_utxo>' \
  -F 'params[txid]=<txid>' \
  -F 'file=@consignment.rgb' \
  http://localhost:3000/json-rpc
```

Response:
```json
{"jsonrpc":"2.0","id":"1","result":true}
```

---

### `consignment.get` — Payee fetches consignment

```sh
curl -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":"2","method":"consignment.get","params":{"recipient_id":"<blinded_utxo>"}}' \
  http://localhost:3000/json-rpc
```

Response:
```json
{
  "jsonrpc": "2.0",
  "id": "2",
  "result": {
    "consignment": "<base64-encoded-binary>",
    "txid": "<txid>"
  }
}
```

Decode the consignment:
```sh
echo '<base64-string>' | base64 -d > consignment.rgb
```

---

### `ack.post` — Payee posts ACK or NACK

ACK (consignment is valid):
```sh
curl -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":"3","method":"ack.post","params":{"recipient_id":"<blinded_utxo>","ack":true}}' \
  http://localhost:3000/json-rpc
```

NACK (consignment is invalid):
```sh
curl -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":"4","method":"ack.post","params":{"recipient_id":"<blinded_utxo>","ack":false}}' \
  http://localhost:3000/json-rpc
```

Response:
```json
{"jsonrpc":"2.0","id":"3","result":true}
```

---

### `ack.get` — Payer checks ACK status

```sh
curl -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":"5","method":"ack.get","params":{"recipient_id":"<blinded_utxo>"}}' \
  http://localhost:3000/json-rpc
```

Response:
- `true` — payee sent ACK (payer can broadcast transaction)
- `false` — payee sent NACK (transfer failed, start over)
- `null` — payee has not posted yet (payer should retry later)

---

## Public proxy endpoints

For testing (testnet), the Iris Wallet team runs a public proxy:

- Testnet3: `rpcs://proxy.iriswallet.com/0.2/json-rpc`
- Testnet4: `rpcs://proxy.iriswallet.com/0.2/json-rpc` (same endpoint)

For production (mainnet), **self-host** or use an agreed provider.

---

## Integration with rgb-lib

When calling `go_online` in rgb-lib, pass the proxy endpoint:

```rust
let online = wallet.go_online(
    false,
    "ssl://electrum.iriswallet.com:50013".to_string(),  // indexer
)?;
// proxy endpoint is set in WalletData or via transport endpoint in invoice
```

In rgb-lib invoices, the transport endpoint encodes the proxy URL:

```
rgb:Tk3d0h5w-.../~/BF/bcrt:utxob:...
```

The proxy URL used for a specific transfer is included in the invoice string via the transport endpoint parameter.

---

## Integration with rgb-lightning-node

When unlocking an RLN node, provide the proxy endpoint:

```json
{
  "proxy_endpoint": "rpc://127.0.0.1:3000/json-rpc"
}
```

For testnet:
```json
{
  "proxy_endpoint": "rpcs://proxy.iriswallet.com/0.2/json-rpc"
}
```

---

## Canonical sources

- https://github.com/RGB-Tools/rgb-proxy-server — repository
- https://github.com/RGB-Tools/rgb-http-json-rpc — protocol specification
- https://docs.rgb.info — RGB Protocol technical documentation