Giter VIP home page Giter VIP logo

gandlafbtc / proxnut Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 6.0 818 KB

ProxNut is a Cashu proxy designed to protect or monetize web resources. Seamlessly integrate with a Cashu ecash wallet, allowing users to access protected resources using tokens.

Home Page: https://proxnut.com

License: MIT License

TypeScript 4.79% JavaScript 72.83% CSS 13.45% HTML 0.97% Svelte 7.76% Dockerfile 0.21%
bitcoin cashu lightning privacy proxy

proxnut's Introduction

Proxnut: a cashu proxy that asks for nuts to get right of passage

⚠️This is a work in progress. Please do not use in production. Only test with small amounts.⚠️

logo

Protect or monetize web resources with a Cashu ecash proxy.


ProxNut: Cashu Proxy for Web Requests

ProxNut is a Cashu proxy designed to protect or monetize web resources. Seamlessly integrate with a Cashu ecash wallet, allowing users to access protected resources using tokens.

🌟 Features

  • Ecash Wallet Integration: Seamlessly top up and spend tokens.
  • Resource Protection: Protect and monetize your web resources with ease.
  • Privacy by default: No accounts and no tracking. Leveraging ecash privacy.
  • Open-Source: Join our community and contribute to the project.

🛠 Installation

While the project is still in progress, you can test it using the code in the bun folder. For a comprehensive installation guide, including using Docker Compose and manual setup, refer to our technical documentation.

🔄 How It Works

ProxNut forwards requests only if they have a valid Cashu token attached to the X-Cashu header. Configuration options include mapping hosts, routes, setting fees, and specifying allowed mints.

setup

⚙ Configuration

This proxy forwards requests only if they have a valid cashu token attached to the X-Cashu header. Configuration on mapping routes and how expensive routes are, can be made in the dashboard. You can also configure the allowed mints there.

  • Route Mapping: Define how requests are routed and the associated fees.
  • Mints: Add mints you run. Note: Currently, you can only use mints you run yourself due to the absence of a swap-out function for the proxy.

For detailed configuration instructions, check the technical documentation.

🚀 Usage

Run the entire stack with Docker Compose or manually. The provided demo backend offers both unprotected and protected resources for testing.

How to run

The whole stack can be run with docker compose:

  1. docker-compose up --build

this will run the applications on the following ports:

  1. frontend on port 8080
  2. proxnut on port 3003
  3. backend on port 4444

or you can use the manual setup:

  1. install bun: curl -fsSL https://bun.sh/install | bash
  2. run the proxy: bun run start
  3. if you haven't configured a backend yourself in the chapters above, there is a simple test server in the deno folder that is pre-configured. to run it, install deno: curl -fsSL https://deno.land/x/install/install.sh | sh - and then run the demo backend: deno run --allow-net --watch deno/server.ts

On the demo backend, there is a unprotected resources, that routes freely (/) and there is a protected resource (/test) that asks for 1 satoshi per request.

Adding protected resources

Access the dashboard at: http://localhost:5515 . Here you can add a route that the proxy should forward. Make sure to include the local network host in the route you wish to route to!

from: /some/route ---> to: http://localhost:4444/1 | fee: 1

Adding mints

Finally, you can add the mints that you allow.

To add a mint, head to the dashboard at http://localhost:5515 and add a mint.

Integrate into frontend

here is an example on how to integrate proxnut into your frontend with the proxnut-wallet web component:

<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>PROXNUT dummy</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <!-- 1. Import all necessary components -->
    <script type="module" src="https://cdn.jsdelivr.net/npm/@proxnut/[email protected]/dist/lib/@proxnut/wallet-comp.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@proxnut/[email protected]/cashuRequest.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@proxnut/[email protected]/cashuGoto.js"></script>

</head>
<body>
    <div style="position: absolute; right: 10px;">
        <proxnut-wallet minturl="https://8333.space:3338"></proxnut-wallet>
    </div>
    <!-- 2. Add call the functions from your html interactive -->
    <button onclick="goto()" style="color: black; cursor: pointer;">
        follow link
    </button>
    <button onclick="request()" style="color: black; cursor: pointer;">
        make an async request
    </button>
<script>
// 3. Add required logic

 const successUnlock = async (response, e) => {
    const contents = await response.text();
    const data = await response.json();
    alert(data)
 }

const goto = () =>{
    // cashuGoto will redirect to a new page, with cashu tokens attached as a query param
    cashuGoto(1, 'localhost:3003/protected',()=>{alert('no nuts!')})
    
}
const request = () => {
    // cashuRequest will send an async request with the cashu token in the X-cashu header. 
    cashuRequest(1, 'localhost:3003/api/protected', successUnlock, ()=>{alert('no nuts!')});
}
</script>
</body>
</html>

🤝 Contributing

We welcome contributions! If you'd like to contribute to ProxNut, please fork the repository and submit a pull request. For major changes, please open an issue first to discuss the proposed change.

📜 License

ProxNut is licensed under the MIT License. See the LICENSE file for more details.


For support, inquiries, or feedback, visit ProxNut.com, send us a message on Telegram or open an issue on our GitHub Repository.


proxnut's People

Contributors

gandlafbtc avatar superatic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

proxnut's Issues

docker-compose fails

Trying to follow the https://github.com/gandlafbtc/proxnut/wiki/04.-Detailed-Installation-Guide#42-docker-compose-installation Instructions, and get the below error:

docker-compose up --build                                                                                                                                          ✔  9s  
[+] Running 7/7
 ✔ redis 6 layers [⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                                                                                                            18.0s 
   ✔ a803e7c4b030 Pull complete                                                                                                                                                                               9.4s 
   ✔ 8009fe658ed7 Pull complete                                                                                                                                                                               0.7s 
   ✔ 3033e3de8673 Pull complete                                                                                                                                                                               0.9s 
   ✔ 442450dd5ab0 Pull complete                                                                                                                                                                               6.5s 
   ✔ c47c32a5a8bc Pull complete                                                                                                                                                                               1.8s 
   ✔ 8007816b16c2 Pull complete                                                                                                                                                                               3.0s 
[+] Building 27.3s (31/47)                                                                                                                                                                          docker:default
 => [webserver internal] load build definition from Dockerfile                                                                                                                                                0.2s
 => => transferring dockerfile: 187B                                                                                                                                                                          0.0s
 => [webserver internal] load .dockerignore                                                                                                                                                                   0.3s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [proxnut internal] load .dockerignore                                                                                                                                                                     0.5s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [proxnut internal] load build definition from Dockerfile                                                                                                                                                  0.4s
 => => transferring dockerfile: 185B                                                                                                                                                                          0.0s
 => [dashboard internal] load build definition from Dockerfile                                                                                                                                                0.6s
 => => transferring dockerfile: 142B                                                                                                                                                                          0.0s
 => [dashboard internal] load .dockerignore                                                                                                                                                                   0.6s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [frontend internal] load .dockerignore                                                                                                                                                                    0.6s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [frontend internal] load build definition from Dockerfile                                                                                                                                                 0.6s
 => => transferring dockerfile: 355B                                                                                                                                                                          0.0s
 => [demo internal] load .dockerignore                                                                                                                                                                        0.7s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [demo internal] load build definition from Dockerfile                                                                                                                                                     0.6s
 => => transferring dockerfile: 123B                                                                                                                                                                          0.0s
 => [backend internal] load build definition from Dockerfile                                                                                                                                                  0.7s
 => => transferring dockerfile: 187B                                                                                                                                                                          0.0s
 => [backend internal] load .dockerignore                                                                                                                                                                     0.7s
 => => transferring context: 2B                                                                                                                                                                               0.0s
 => [backend internal] load metadata for docker.io/denoland/deno:latest                                                                                                                                       2.1s
 => [proxnut internal] load metadata for docker.io/oven/bun:latest                                                                                                                                            2.2s
 => [frontend internal] load metadata for docker.io/library/node:alpine                                                                                                                                       2.1s
 => [frontend internal] load metadata for docker.io/library/httpd:2.4                                                                                                                                         2.9s
 => [backend 1/4] FROM docker.io/denoland/deno:latest@sha256:3cd3240e1696f27547068e9c246fddf23ab3f94539b47aeb5c953bc3e506857b                                                                                24.0s
 => => resolve docker.io/denoland/deno:latest@sha256:3cd3240e1696f27547068e9c246fddf23ab3f94539b47aeb5c953bc3e506857b                                                                                         0.0s
 => => sha256:3cd3240e1696f27547068e9c246fddf23ab3f94539b47aeb5c953bc3e506857b 1.57kB / 1.57kB                                                                                                                0.0s
 => => sha256:d0653a261a6d41c55773bb5f7ccf141c38f6e8b8d1624b37f7842a62f47b896f 2.87kB / 2.87kB                                                                                                                0.0s
 => => sha256:f0c43f3a4aa2d46f12cb3dd06f49a667c524918c27013e165f9235db8e2a3931 1.18kB / 1.18kB                                                                                                                0.4s
 => => sha256:ccdfa3e5f8438d45dcb06fab45bddb044c04a341ced159449f21e284cc71d03c 44.33MB / 44.33MB                                                                                                             20.1s
 => => sha256:00d3338ddf144c8002eef2e9ac6cdbec53884d822322e39d5dad1e95d0c234f9 29.12MB / 29.12MB                                                                                                             15.3s
 => => sha256:3f9ab1302f460fc5096f304bf60021cf41ad5953ad4c6cce1254ba33dada1977 9.46kB / 9.46kB                                                                                                                0.9s
 => => sha256:7154dff31051e0fd8ee7b19f603dd1e9fc3e9842337b0d518332a1ba076a4f2a 429B / 429B                                                                                                                    1.3s
 => => sha256:9a81f9e698b198291199cf6a93357454449e2b6c49aa8af1be2d13b3f699d980 425B / 425B                                                                                                                    1.6s
 => => extracting sha256:00d3338ddf144c8002eef2e9ac6cdbec53884d822322e39d5dad1e95d0c234f9                                                                                                                     2.9s
 => => extracting sha256:f0c43f3a4aa2d46f12cb3dd06f49a667c524918c27013e165f9235db8e2a3931                                                                                                                     0.0s
 => => extracting sha256:ccdfa3e5f8438d45dcb06fab45bddb044c04a341ced159449f21e284cc71d03c                                                                                                                     2.9s
 => => extracting sha256:3f9ab1302f460fc5096f304bf60021cf41ad5953ad4c6cce1254ba33dada1977                                                                                                                     0.0s
 => => extracting sha256:7154dff31051e0fd8ee7b19f603dd1e9fc3e9842337b0d518332a1ba076a4f2a                                                                                                                     0.0s
 => => extracting sha256:9a81f9e698b198291199cf6a93357454449e2b6c49aa8af1be2d13b3f699d980                                                                                                                     0.0s
 => [backend internal] load build context                                                                                                                                                                     0.2s
 => => transferring context: 35.73kB                                                                                                                                                                          0.0s
 => [webserver internal] load build context                                                                                                                                                                   0.1s
 => => transferring context: 34.58kB                                                                                                                                                                          0.0s
 => CANCELED [proxnut 1/5] FROM docker.io/oven/bun:latest@sha256:3d646ab41f639ec5a26b2a286ca1f8b7ce3a630429d04557f94fc9e1f7c29bc5                                                                            24.5s
 => => resolve docker.io/oven/bun:latest@sha256:3d646ab41f639ec5a26b2a286ca1f8b7ce3a630429d04557f94fc9e1f7c29bc5                                                                                              0.1s
 => => sha256:3d646ab41f639ec5a26b2a286ca1f8b7ce3a630429d04557f94fc9e1f7c29bc5 685B / 685B                                                                                                                    0.0s
 => => sha256:f770a1ef10350303075205198bc2ea46117b19079ab889fff0c3182f1253eaf9 1.29kB / 1.29kB                                                                                                                0.0s
 => => sha256:25577e61598ecbd09088c704d6e00b07d2d79b2f77ed63849d5294ed106b659d 2.67kB / 2.67kB                                                                                                                0.0s
 => => sha256:ddf874abf16cc990e0fd75a154a34ca0a03ee310ad895a18fb62ae15bf4171fb 30.41MB / 55.06MB                                                                                                             24.3s
 => => sha256:f81ed5a2fe90bba06bb1fa22a6a90287eaa77b83a84d44c3fc2f4c6c2f970780 295B / 295B                                                                                                                   15.7s
 => => sha256:a99dea448f88b311ca92b782f52b1e8e3cfa2e3ce6545be3a59b999a366ce127 34.60MB / 36.33MB                                                                                                             24.3s
 => => sha256:ae2c08246da3947a2365ea783371f2220fa80e68fd23826871c9b527d007b9ad 4.15kB / 4.15kB                                                                                                               20.3s
 => => sha256:65a7c9813752056cdc74da65ed85efe28d9a05b947281473d9b19a3f427421d8 140B / 140B                                                                                                                   20.7s
 => [proxnut internal] load build context                                                                                                                                                                     0.1s
 => => transferring context: 15.12kB                                                                                                                                                                          0.0s
 => [dashboard internal] load build context                                                                                                                                                                   0.2s
 => => transferring context: 285.88kB                                                                                                                                                                         0.0s
 => CANCELED [frontend 1/5] FROM docker.io/library/node:alpine@sha256:a329b146bcc99a36caa73056e60714d0911ca5c229ade3eb27e9283dc78c9eb6                                                                       24.5s
 => => resolve docker.io/library/node:alpine@sha256:a329b146bcc99a36caa73056e60714d0911ca5c229ade3eb27e9283dc78c9eb6                                                                                          0.1s
 => => sha256:a329b146bcc99a36caa73056e60714d0911ca5c229ade3eb27e9283dc78c9eb6 1.43kB / 1.43kB                                                                                                                0.0s
 => => sha256:ad38de8de343e0fed46efcb5b8df47f4996da2a3fb359eef3f53243b1670b50e 1.16kB / 1.16kB                                                                                                                0.0s
 => => sha256:43a70fe68b37cf278ad0f05119f3c3ef7f7e598de13aadd0e3298474793da8ea 6.77kB / 6.77kB                                                                                                                0.0s
 => => sha256:7264a8db6415046d36d16ba98b79778e18accee6ffa71850405994cffa9be7de 3.40MB / 3.40MB                                                                                                               23.1s
 => => extracting sha256:7264a8db6415046d36d16ba98b79778e18accee6ffa71850405994cffa9be7de                                                                                                                     0.3s
 => => sha256:4f5fe51f59037e9e27e758c8577b0c971906800b5fdcc60fe9b0ba893d8e6e8c 2.10MB / 49.75MB                                                                                                              24.2s
 => [demo internal] load build context                                                                                                                                                                        0.3s
 => => transferring context: 509.53kB                                                                                                                                                                         0.0s
 => [frontend internal] load build context                                                                                                                                                                    0.1s
 => => transferring context: 158.46kB                                                                                                                                                                         0.0s
 => CANCELED [frontend release 1/4] FROM docker.io/library/httpd:2.4@sha256:5123fb6e039b83a4319b668b4fe1ee04c4fbd7c4c8d1d6ef843e8a943a9aed3f                                                                 23.7s
 => => resolve docker.io/library/httpd:2.4@sha256:5123fb6e039b83a4319b668b4fe1ee04c4fbd7c4c8d1d6ef843e8a943a9aed3f                                                                                            0.1s
 => => sha256:5123fb6e039b83a4319b668b4fe1ee04c4fbd7c4c8d1d6ef843e8a943a9aed3f 1.86kB / 1.86kB                                                                                                                0.0s
 => => sha256:4ffdefc17aef73b626a6e60078083420ba0c0f0a91e688eac130d9c078253bfb 1.37kB / 1.37kB                                                                                                                0.0s
 => => sha256:359570977af25b6ec87f2e0ee1e103e3826bade6175784cf98b04337278b1006 9.38kB / 9.38kB                                                                                                                0.0s
 => [backend 2/4] WORKDIR /app                                                                                                                                                                                0.2s
 => [backend 3/4] ADD . /app                                                                                                                                                                                  0.2s
 => [webserver 3/4] ADD . /app                                                                                                                                                                                0.2s
 => ERROR [webserver 4/4] RUN deno cache server.ts                                                                                                                                                            0.2s
 => ERROR [backend 4/4] RUN deno cache server.ts                                                                                                                                                              0.3s
------
 > [webserver 4/4] RUN deno cache server.ts:
------
------
 > [backend 4/4] RUN deno cache server.ts:
------
failed to solve: process "/bin/sh -c deno cache server.ts" did not complete successfully: failed to create endpoint rd0ftf0q58htm85ge6bf6opzf on network bridge: failed to add the host (veth3c07f2f) <=> sandbox (veth3323df0) pair interfaces: operation not supported

Broken Stacker News referral link on proxnut.com

Hey, I have noticed that you have this link to Stacker News on proxnut.com:

https://stacker.news/r/mo/search?q=PROXNUT&what=posts

Thanks for the link! We like to see our site mentioned in the wild.

However, this link does redirect to the frontpage and not to all posts which mention proxnut. I am actually not sure if that link used to work since there were no updates to our referral middleware since inception afaict (/cc @huumn).

The correct link would be this:

- https://stacker.news/r/mo/search?q=PROXNUT&what=posts
+ https://stacker.news/search/r/mo?q=PROXNUT&what=posts

I wanted to create a PR o fix this but I haven't found the link in your code.

I think this repository only contains the code for the wallet, not for proxnut.com?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.