Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gandlafbtc/proxnut

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.
https://github.com/gandlafbtc/proxnut

bitcoin cashu lightning privacy proxy

Last synced: about 3 hours ago
JSON representation

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.

Awesome Lists containing this project

README

        

# 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](docs/PROXNUT_avatar.png)

`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](https://github.com/gandlafbtc/proxnut/wiki/).

## πŸ”„ 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](./docs/setup.png)

## βš™ 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](https://github.com/gandlafbtc/proxnut/wiki/).

## πŸš€ 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`
1. `proxnut` on port `3003`
1. `backend` on port `4444`

or you can use the manual setup:

1. install bun:
```curl -fsSL https://bun.sh/install | bash```
1. run the proxy: ```bun run start```
1. 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:

```html



PROXNUT dummy









follow link


make an async request

// 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!')});
}

```

## 🀝 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](https://proxnut.com), send us a message on [Telegram](https://t.me/+RqnidzaUl-tkMDRl) or open an [issue](https://github.com/gandlafbtc/proxnut/issues/new) on our GitHub Repository.

---