CypherNet: Difference between revisions

From Traxel Wiki
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:CypherTech]]
[[Category:CypherTech]]
= See Also =
* [[:Category:Lightning]]
* [[:Category:Nostr]]
= Easy Relay =
= Easy Relay =
I want to go to a web page and click "create relay." It will ask for my credit card, or my login if I already have an account. It will create a relay for me for a given price / configuration / setup option.
I want to go to a web page and click "create relay." It will ask for my credit card, or my login if I already have an account. It will create a relay for me for a given price / configuration / setup option.
Line 31: Line 35:


== Nostr Relay Setup ==
== Nostr Relay Setup ==
* [[NostrRelay]]
* [[CypherNetFirstInstallAttempt]]
** Found that NostrRelay is a component for LNbits
** Found that LNbits looks fairly solid.
** Attempting an LNbits install.
** Some of the below remains the same, archive of the full first attempt at the link above.
* [[CypherNetSecondInstallAttempt]]
** Found that LNbits is much larger in scope than what I need.
** Found that LNbits is a complex system to install.
** Decided to try the MVP approach.
* [[Strfry]]
** https://github.com/hoytech/strfry
* IP: 52.11.172.130
* IP: 52.11.172.130
* Deb 11, $5 instance
* Deb 11, $5 instance
Line 40: Line 54:
sudo apt install -y emacs-nox
sudo apt install -y emacs-nox
</pre>
</pre>
=== Greasy Kid Stuff ===
<pre>
mkdir -p /home/admin/.local/bin
chmod go-rwx /home/admin/.local
mkdir -p /home/admin/.local/lib
</pre>
=== Python ===
=== Python ===
<pre>
<pre>
Line 56: Line 77:


==== Warnings ====
==== Warnings ====
Attempted to address the following by creating .local/bin and .local/lib during "Greasy Kid Stuff" above.
<pre>
<pre>
Installing collected packages: websockets, uvloop, typing-extensions, sniffio, python-dotenv, httptools, h11, exceptiongroup, click, uvicorn, anyio, watchfiles
Installing collected packages: websockets, uvloop, typing-extensions, sniffio, python-dotenv, httptools, h11, exceptiongroup, click, uvicorn, anyio, watchfiles
Line 65: Line 87:
   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
   Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
</pre>
</pre>
=== Test Uvicorn ===
<pre>
mkdir -p projects/test-uvicorn
cd projects/test-uvicorn
emacs -nw main.py
</pre>
<pre>
async def app(scope, receive, send):
    assert scope['type'] == 'http'
    await send({
        'type': 'http.response.start',
        'status': 200,
        'headers': [
            [b'content-type', b'text/plain'],
        ],
    })
    await send({
        'type': 'http.response.body',
        'body': b'Hello, world!',
    })
    pass # end main
</pre>
<pre>
uvicorn main:app
</pre>
On client box
<pre>
ssh -i path/to/key.pem -L 8989:127.0.0.1:8000 admin@52.11.172.130 -N
</pre>
http://localhost:8989/

Latest revision as of 04:20, 6 October 2023

See Also

Easy Relay

I want to go to a web page and click "create relay." It will ask for my credit card, or my login if I already have an account. It will create a relay for me for a given price / configuration / setup option.

I can then join that relay to a friend's relay, which doesn't have to be running in the same system. It just has to accept the protocol handshake.

Now our relays can act in federation, providing reciprocal backup.

We can each also have our own blacklist, if we don't want to carry something they have.

I can go to another page on the site and set up a client that will read from other relays and publish to my relay, to create my own custom stream. That way I can point all my clients (phone, tablet, desktop) at my single stream instead of having to subscribe them to all my favorite relays individually.

When I federate with someone else's relay, it pops up the 3rd party content it relays (filtered against what I already have), so I can consider adding from it.

That same functionality could happen without federating, just by going to the page that lets me point my client at another relay.

Since my relay is carrying all that stuff, it has access to it all. That makes it easy for me to run data science on it all.

I can and should be training my own little information agent, all the time, to find things that I will enjoy. It can monitor my relay network for suggested new content, check it, and recommend it if it suits.

I can publish my personal findings, or even my agents' findings, so other people's agents could use that info as a signal for whether to surface something to me.

What Does MVP 0 Look Like?

  • Functions as a relay.
    • Allows Publish
    • Allows Subscribe
    • Forwards Messages
    • No History (for v0)
  • Pushbutton Setup (given an approved key)
  • Provides Endpoint Info

Nostr Relay Setup

  • CypherNetFirstInstallAttempt
    • Found that NostrRelay is a component for LNbits
    • Found that LNbits looks fairly solid.
    • Attempting an LNbits install.
    • Some of the below remains the same, archive of the full first attempt at the link above.
  • CypherNetSecondInstallAttempt
    • Found that LNbits is much larger in scope than what I need.
    • Found that LNbits is a complex system to install.
    • Decided to try the MVP approach.
  • Strfry
  • IP: 52.11.172.130
  • Deb 11, $5 instance

Server Baseline

ssh admin@52.11.172.130
sudo apt update && sudo apt dist-upgrade -y
sudo apt install -y emacs-nox

Greasy Kid Stuff

mkdir -p /home/admin/.local/bin
chmod go-rwx /home/admin/.local
mkdir -p /home/admin/.local/lib

Python

sudo apt install -y python3 python3-pip python-is-python3
sudo pip install --upgrade pip
python --version
pip --version

Install Uvicorn

pip install 'uvicorn[standard]'

Warnings

Attempted to address the following by creating .local/bin and .local/lib during "Greasy Kid Stuff" above.

Installing collected packages: websockets, uvloop, typing-extensions, sniffio, python-dotenv, httptools, h11, exceptiongroup, click, uvicorn, anyio, watchfiles
  WARNING: The script dotenv is installed in '/home/admin/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script uvicorn is installed in '/home/admin/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script watchfiles is installed in '/home/admin/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Test Uvicorn

mkdir -p projects/test-uvicorn
cd projects/test-uvicorn
emacs -nw main.py
async def app(scope, receive, send):
    assert scope['type'] == 'http'

    await send({
        'type': 'http.response.start',
        'status': 200,
        'headers': [
            [b'content-type', b'text/plain'],
        ],
    })
    await send({
        'type': 'http.response.body',
        'body': b'Hello, world!',
    })

    pass # end main
uvicorn main:app

On client box

ssh -i path/to/key.pem -L 8989:127.0.0.1:8000 admin@52.11.172.130 -N

http://localhost:8989/