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
Fill in some info for the _Username_, _Title_, and _Content_ fields, then click on the **Submit** button. You will be redirected back to the screen displaying the list of posts.
25
25
26
-

26
+
.png>)
27
27
28
28
Add a couple more posts, just to have some data to play with.
29
29
30
-

30
+
.png>)
31
31
32
32
Click on the **Upvote** button on a post to see the votes counter increment and the posts reorder based on which has the highest votes.
33
33
34
-

34
+
.png>)
35
35
36
36
The app makes use of WebSockets to update the UI in real-time when posts are created and upvoted on the backend. To see this in action, open a second browser window side-by-side with the first window. Create a new post on the left to see it automatically appear on the right. Upvote a post on the right to see it increment and reorder on the left automatically.
37
37
38
-

38
+
.png>)
39
39
40
40
## Architecture
41
41
42
42
This application is split into two parts, the backend API server and the frontend browser-based UI.
description: Aperture is an implementation of L402s as a reverse HTTP proxy.
3
+
---
4
+
5
+
# Aperture
6
+
7
+
Aperture is a reverse proxy that acts as a payment and authentication gateway for Lightning Network powered APIs. It can handle gRPC requests over HTTP/2 as well as REST over HTTP/1 and 2.
8
+
9
+
Aperture receives incoming connections, verifies the validity of the [L402](../../the-lightning-network/l402/) and either forwards the request to the appropriate end point, or obtains a [Macaroon](../../the-lightning-network/l402/macaroons.md) and sends it together with a Lightning invoice and the HTTP status code 402 Payment Required.
10
+
11
+
Aperture is currently used in production in Lightning [Loop](../loop/) and [Pool](../pool/).
Copy file name to clipboardExpand all lines: lightning-network-tools/aperture/get-aperture.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,19 @@
2
2
description: Aperture is an implementation of L402s as a reverse HTTP proxy.
3
3
---
4
4
5
-
# Aperture
5
+
# ⚒ Get Aperture
6
6
7
7
Aperture is a reverse proxy that acts as a payment and authentication gateway for Lightning Network powered APIs. It can handle gRPC requests over HTTP/2 as well as REST over HTTP/1 and 2.
8
8
9
-
Aperture receives incoming connections, verifies the validity of the L402 and either forwards the request to the appropriate end point, or obtains a Macaroon and sends it together with a Lightning invoice and the HTTP status code 402 Payment Required.
9
+
Aperture receives incoming connections, verifies the validity of the [L402](../../the-lightning-network/l402/) and either forwards the request to the appropriate end point, or obtains a [Macaroon](../../the-lightning-network/l402/macaroons.md) and sends it together with a Lightning invoice and the HTTP status code 402 Payment Required.
10
10
11
-
Aperture is currently used in production in Lightning [Loop](../../lightning-network-tools/loop/) and [Pool](../../lightning-network-tools/pool/).
11
+
Aperture is currently used in production in Lightning [Loop](../loop/) and [Pool](../pool/).
Copy file name to clipboardExpand all lines: lightning-network-tools/aperture/mailbox.md
+17-24Lines changed: 17 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,18 +12,9 @@ To traverse firewalls and Network Address Translation (NAT), LNC makes use of a
12
12
13
13
LNC is most useful when both the client and the Lightning node are behind a firewall or NAT, but it can also be useful when only the Lightning node is unreachable. In this case, aperture may be installed on the same machine as the client application. 
14
14
15
-
## Install go <ahref="#docs-internal-guid-3a0b9987-7fff-a39a-eec7-f046b22bd334"id="docs-internal-guid-3a0b9987-7fff-a39a-eec7-f046b22bd334"></a>
16
-
17
-
To compile aperture we will need golang. You may follow [the official documentation](https://go.dev/doc/install) or look at the relevant chapter in the [LND installation guides](../lnd/run-lnd.md#docs-internal-guid-8ffda72d-7fff-a07e-3bb8-93cdf01b5103).
@@ -41,18 +32,20 @@ Next, we are going to switch to the superuser and create our configuration file.
41
32
42
33
Use this template and don’t forget to swap the domain name with your own. This domain name should also point to the server on which you are setting up aperture!
43
34
44
-
`listenaddr: "lnc.yourlightning.app:443"`\
45
-
`debuglevel: "trace"`\
46
-
`autocert: true`\
47
-
`servername: lnc.yourlightning.app`\
48
-
`authenticator:`\
49
-
 `disable: true`\
50
-
`hashmail:`\
51
-
 `enabled: true`\
52
-
 `messagerate: 1ms`\
53
-
 `messageburstallowance: 99999999`\
54
-
`prometheus:`\
55
-
 `enabled: false`
35
+
```
36
+
listenaddr: "lnc.yourlightning.app:443"
37
+
debuglevel: "trace"
38
+
autocert: true
39
+
servername: lnc.yourlightning.app
40
+
authenticator:
41
+
disable: true
42
+
hashmail:
43
+
enabled: true
44
+
messagerate: 1ms
45
+
messageburstallowance: 99999999
46
+
prometheus:
47
+
enabled: false
48
+
```
56
49
57
50
## Run aperture <ahref="#docs-internal-guid-680bd854-7fff-6acd-1c94-e2b1fb86f9ed"id="docs-internal-guid-680bd854-7fff-6acd-1c94-e2b1fb86f9ed"></a>
58
51
@@ -67,7 +60,7 @@ The logs may show that aperture is now listening for connections.
67
60
68
61
## Connect to Terminal <ahref="#docs-internal-guid-6d497483-7fff-ccdd-3290-061a74b72572"id="docs-internal-guid-6d497483-7fff-ccdd-3290-061a74b72572"></a>
69
62
70
-
We can now connect our LND node to Lightning Terminal using our own mailbox. You will need litd running alongside LND. Learn how to [install litd here](get-lit.md).
63
+
We can now connect our LND node to Lightning Terminal using our own mailbox. You will need litd running alongside LND. Learn how to [install litd here](../lightning-terminal/get-lit.md).
71
64
72
65
`litcli sessions add --label="My own mailbox" --type admin --mailboxserveraddr lnc.yourlightningapp:443`
description: Use Aperture to dynamically price resources using L402s.
3
+
---
4
+
5
+
# Pricing
6
+
7
+
Aperture can be easily configured to price resources, such as files or API access. There are two pricing configurations: Fixed and dynamic pricing.
8
+
9
+
## User flow <ahref="#docs-internal-guid-d027d658-7fff-096b-9e27-d92e4dae3fc4"id="docs-internal-guid-d027d658-7fff-096b-9e27-d92e4dae3fc4"></a>
10
+
11
+
In both fixed and dynamic pricing, the Aperture server acts as a proxy between the user and the content server. The user requests the resource and, without the requisite L402, is served the HTTP error response “402 Payment Required,” together with a Macaroon and a Lightning Network invoice.
12
+
13
+
By paying the Lightning Network invoice, the user obtains the preimage, which together with the Macaroon forms the valid L402, which the user can present to Aperture in order to obtain the desired resource.
14
+
15
+
[Read more: How the L402 is constructed and passed as part of the header](../../the-lightning-network/l402/protocol-specification.md#http-specification)
In fixed pricing, a resource is offered for a fixed price, expressed in satoshis. Multiple resources can be configured, each with their own price.
20
+
21
+
```
22
+
- name: "service2"
23
+
hostregexp: "service2.com:8083"
24
+
pathregexp: '^/.*$'
25
+
address: "123.456.789:8082"
26
+
protocol: https
27
+
constraints:
28
+
"valid_until": "2020-01-01"
29
+
price: 1
30
+
```
31
+
32
+
For each service, a valid L402 will allow its holder to access unlimited resources on this service. To price for each resource individually, we will have to make use of dynamic pricing.
33
+
34
+
## Dynamic pricing
35
+
36
+
For dynamic pricing, you will need to configure Aperture to connect to a separate service over gRPC. This for example allows for resources to be priced in fiat currency, sell a large repository of items, each with their own pricing, or adjust prices based on demand.
Copy file name to clipboardExpand all lines: lightning-network-tools/taproot-assets/first-steps.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,7 +262,7 @@ There are three outputs. Two outputs of 1000 satoshis each and the change output
262
262
263
263
Once the transaction is confirmed on the Bitcoin Blockchain the sender will attempt to make the proofs available to the recipient via an [end-to-end encrypted mailbox](../lightning-terminal/lightning-node-connect.md), similar to Lightning Node Connect (LNC).
264
264
265
-
By default, this mailbox is set to mailbox.terminal.lightning.today:443, but you can [run your own mailbox through aperture](../../the-lightning-network/l402/aperture.md) and configure tapd to use it by specifying the `--hashmailcourier.addr=` flag at startup.
265
+
By default, this mailbox is set to mailbox.terminal.lightning.today:443, but you can [run your own mailbox through aperture](../aperture/get-aperture.md) and configure tapd to use it by specifying the `--hashmailcourier.addr=` flag at startup.
266
266
267
267
Once the transaction is confirmed on the Bitcoin Blockchain the sender will attempt to make the proofs available to the recipient via a [LNC-style end-to-end encrypted mailbox](../lightning-terminal/lightning-node-connect.md).
Copy file name to clipboardExpand all lines: the-lightning-network/l402/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,6 @@ The Aperture proxy is a reverse proxy that will forward a request with a valid L
38
38
39
39
Aperture allows for pricing for API endpoints on the fly, including automatic tier upgrades, per-request pricing or surge pricing. In another light, this can be viewed as a global HTTP 402 reverse proxy at the load balancing level for web services and APIs.
0 commit comments