Skip to content

Commit 819c0f9

Browse files
committed
update README
1 parent 0161101 commit 819c0f9

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

README.md

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ This project was originally implemented in
3737

3838
## Running the app
3939

40-
```
40+
### Locally
41+
```sh
4142
# install dependencies
4243
npm install
4344

@@ -51,6 +52,19 @@ npm run build
5152
npm run start
5253
```
5354

55+
### In docker
56+
```sh
57+
docker run -d ghcr.io/rgb-tools/rgb-proxy-server
58+
```
59+
60+
For data persistence, mount a host path to `/home/node/.rgb-proxy-server`
61+
inside the container. The directory needs to be owned by user and group `1000`.
62+
63+
### Data
64+
Data is stored in `$HOME/.rgb-proxy-server` by default.
65+
66+
The default data path can be overridden via the `APP_DATA` environment variable.
67+
5468
## Example usage
5569

5670
The payee generates an RGB invoice and sends it to the payer (not covered
@@ -59,58 +73,65 @@ here). Let's assume the invoice contains the blinded UTXO `blindTest`.
5973
The payer prepares the transfer, then sends the consignment file and the
6074
related txid to the proxy server, using the blinded UTXO from the invoice as
6175
identifier:
62-
```
76+
```sh
6377
# let's create a fake consignment file and send it
64-
$ echo "consignment binary data" > consignment.rgb
65-
$ curl -X POST -H 'Content-Type: multipart/form-data' \
78+
echo "consignment binary data" > consignment.rgb
79+
curl -X POST -H 'Content-Type: multipart/form-data' \
6680
-F 'jsonrpc=2.0' -F 'id="1"' -F 'method=consignment.post' \
6781
-F 'params[recipient_id]=blindTest' -F 'params[txid]=527f2b2ebb81c873f128848d7226ecdb7cb4a4025222c54bfec7c358d51b9207' -F '[email protected]' \
6882
localhost:3000/json-rpc
6983

70-
{"jsonrpc":"2.0","id":"1","result":true}
84+
# example output
85+
# {"jsonrpc":"2.0","id":"1","result":true}
7186
```
7287

7388
The payee requests the consignment for the blinded UTXO:
74-
```
75-
$ curl -X POST -H 'Content-Type: application/json' \
89+
```sh
90+
curl -X POST -H 'Content-Type: application/json' \
7691
-d '{"jsonrpc": "2.0", "id": "2", "method": "consignment.get", "params": {"recipient_id": "blindTest"} }' \
7792
localhost:3000/json-rpc
7893

79-
{"jsonrpc":"2.0","id":"2","result": {"consignment": "Y29uc2lnbm1lbnQgYmluYXJ5IGRhdGEK", "txid": "527f2b2ebb81c873f128848d7226ecdb7cb4a4025222c54bfec7c358d51b9207"}}
94+
# example output
95+
# {"jsonrpc":"2.0","id":"2","result": {"consignment": "Y29uc2lnbm1lbnQgYmluYXJ5IGRhdGEK", "txid": "527f2b2ebb81c873f128848d7226ecdb7cb4a4025222c54bfec7c358d51b9207"}}
8096

8197
```
8298
The file is returned as a base64-encoded string:
83-
```
84-
$ echo 'Y29uc2lnbm1lbnQgYmluYXJ5IGRhdGEK' | base64 -d
85-
consignment binary data
99+
```sh
100+
echo 'Y29uc2lnbm1lbnQgYmluYXJ5IGRhdGEK' | base64 -d
101+
102+
# example output
103+
# consignment binary data
86104
```
87105

88106
If the consignment is valid, the payee ACKs it:
89-
```
90-
$ curl -X POST -H 'Content-Type: application/json' \
107+
```sh
108+
curl -X POST -H 'Content-Type: application/json' \
91109
-d '{"jsonrpc": "2.0", "id": "3", "method": "ack.post", "params": {"recipient_id": "blindTest", "ack": true} }' \
92110
localhost:3000/json-rpc
93111

94-
{"jsonrpc":"2.0","id":"3","result":true}
112+
# example output
113+
# {"jsonrpc":"2.0","id":"3","result":true}
95114
```
96115

97116
If the consignment is invalid, the payee NACKs it:
98-
```
99-
$ curl -X POST -H 'Content-Type: application/json' \
117+
```sh
118+
curl -X POST -H 'Content-Type: application/json' \
100119
-d '{"jsonrpc": "2.0", "id": "4", "method": "ack.post", "params": {"recipient_id": "blindTest", "ack": false} }' \
101120
localhost:3000/json-rpc
102121

103-
{"jsonrpc":"2.0","id":"4","result":true}
122+
# example output
123+
# {"jsonrpc":"2.0","id":"4","result":true}
104124
```
105125

106126
The payer requests the `ack` value (`null` if payee has not called `ack.post`
107127
yet):
108-
```
109-
$ curl -X POST -H 'Content-Type: application/json' \
128+
```sh
129+
curl -X POST -H 'Content-Type: application/json' \
110130
-d '{"jsonrpc": "2.0", "id": "5", "method": "ack.get", "params": {"recipient_id": "blindTest"} }' \
111131
localhost:3000/json-rpc
112132

113-
{"jsonrpc":"2.0","id":"5","result":true}
133+
# example output
134+
# {"jsonrpc":"2.0","id":"5","result":true}
114135
```
115136

116137
In case of approval the transaction can be broadcast, otherwise the two parties
@@ -122,15 +143,17 @@ approval cannot be changed once submitted.
122143

123144
## Testing
124145

125-
### Jest with supertest
146+
```sh
147+
# install dependencies
148+
npm run install
126149

127-
```
150+
# run test suite
128151
npm run test
129152
```
130153

131154
## Linting
132155

133-
```
156+
```sh
134157
# run linter
135158
npm run lint
136159

0 commit comments

Comments
 (0)