This is the backend API server for https://coinos.io/ It's built on NodeJS and Express and uses Sequelize to communicate with a MariaDB database server. There are a couple GraphQL endpoints I was experimenting with but most of the communication is done with REST endpoints and persistent per-user websocket connections using socket.io. The server expects you to be running a full bitcoind node and two separate lnd instances, referred to in the code as lna and lnb. The reason for running two nodes is so that they can invoice and pay each other in the case that one CoinOS user wants to pay another CoinOS user since lnd nodes cannot pay themselves (or at least that was the case when I started, that may have changed). lnb takes care of generating invoices and receiving payments and lna takes deposits and sends payments. As soon as lna sends a payment, it generates an invoice for lnb to pay it back right away so that they don't become unbalanced. We use ZMQ to communicate with bitcoind in addition to the JSON RPC so make sure your bitcoind is compiled with ZMQ enabled. This should be done automatically if you have the prerequisite libzmq dependency installed at compile time. There are also integrations with Facebook's API for single sign-in and contacts, Stripe for taking credit card payments, Mailgun for email notifications, Twilio for SMS notifications, and Authy for two-factor authentication. Pricing info is fetched from Kraken at the time of writing and only in CAD but that's soon to change. ## Configuration You can configure the connection info and API keys for all the external services in config/index.js Check out the [sample config](https://github.com/asoltys/coinos-server/blob/master/config/index.sample.js) ## Database For a while I was writing Sequelize migrations to keep the database schema in sync with the codebase but right now there are a handful of columns that aren't captured in any migration. There's a [sample schema](https://github.com/asoltys/coinos-server/blob/master/schema.sql) that you can use though. ## Installation git clone https://github.com/asoltys/coinos-server yarn yarn start ' type='search' size='10' name='q' value=''/>
path: root/tools/ark/ln-test.js
blob: c76d914dbe01c938dc1078c8fdbb7e483dc11f7b (plain) (blame)
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