You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains source code implementing SPV Channels Client in golang for the [SPV Channels Server](https://github.com/bitcoin-sv/spvchannels-reference)
Go SPV Channels is a [golang](https://golang.org/) implementation of the [SPV Channels Server](https://github.com/bitcoin-sv/spvchannels-reference).
19
+
20
+
The library implement all rest api endpoints served in [SPV Channels Server](https://github.com/bitcoin-sv/spvchannels-reference) and the websocket client to listen new message notifications in real time.
21
+
22
+
## Table of Contents
23
+
24
+
-[Installation](#installation)
25
+
-[Run tests](#run-tests)
26
+
-[Setup Local SPV Channels server](#setup-local-spv-channels-server)
27
+
-[License](#license)
28
+
29
+
## Installation
30
+
```
31
+
go get github.com/libsv/go-spvchannels
32
+
```
33
+
34
+
## Run tests
35
+
36
+
Run unit test
37
+
```
38
+
go clean -testcache && go test -v ./...
39
+
```
40
+
41
+
To run integration tests, make sure you have `docker-compose up -d` on your local machine, then run
42
+
```
43
+
go clean -testcache && go test -race -v -tags=integration ./...
44
+
```
45
+
46
+
## Setup Local SPV Channels server
47
+
48
+
#### Creating SSL key for secure connection
7
49
Following the tutorial in the [SPV Channels Server](https://github.com/bitcoin-sv/spvchannels-reference), we first create the certificate using `openssl`:
terminal $> openssl pkcs12 -export -out devkey.pfx -inkey localhost.key -in localhost.crt # use devkey as password
11
53
```
12
54
13
-
That will create the `devkey.pfx` with password `devkey`. We then write a `docker-compose.yml` file following the tutorial. To run the [SPV Channels Server](https://github.com/bitcoin-sv/spvchannels-reference) :
55
+
That will create the `devkey.pfx` with password `devkey`. We then write a `docker-compose.yml` file following the tutorial.
56
+
57
+
#### Launch local [SPV Channels Server](https://github.com/bitcoin-sv/spvchannels-reference) :
14
58
```
15
59
docker-compose up -d
16
60
```
17
61
62
+
#### Create an account
18
63
We then need to create a SPV Channels account on the server
19
64
```
20
65
docker exec spvchannels ./SPVChannels.API.Rest -createaccount spvchannels_dev dev dev
21
66
```
22
67
23
-
## Usage with swagger
68
+
####Usage with swagger
24
69
25
70
The [SPV Channels Server](https://github.com/bitcoin-sv/spvchannels-reference) run by `docker-compose.yml` listen on `localhost:5010`. We can start playing with the endpoints using swagger, i.e in browser, open `https://localhost:5010/swagger/index.html`
26
71
27
72
From this page, there are a link `/swagger/v1/swagger.json` to export swagger file
28
73
29
-
## Usage with Postman
74
+
####Usage with Postman
30
75
31
76
Interacting with browser might have some difficulty related to adding certificate to the system. It might be easier to use Postman to interact as Postman has a easy possibility to disable SSL certificate check to ease development propose.
32
77
@@ -49,14 +94,6 @@ These environment variable are used as _template_ to populate values in the `pos
49
94
| MSG_SEQUENCE | .. to define .. |
50
95
| NOTIFY_TOKEN | .. to define .. |
51
96
52
-
## Run tests
97
+
## License
53
98
54
-
Run unit test
55
-
```
56
-
go clean -testcache && go test -v ./...
57
-
```
58
-
59
-
To run integration tests, make sure you have `docker-compose up -d` on your local machine, then run
60
-
```
61
-
go clean -testcache && go test -race -v -tags=integration ./...
0 commit comments