Service signaler using Network
This acts as a marketplace between services and anonymous consumers.
You can easily deploy it as a Dockerized web service to cloud-hosting providers such as render.com.
Prices are ~$5 for the cheapest hosting. Do not use free tiers as they may have high downtimes.
Just fork this repository on your GitHub account and select it on your cloud hosting platform.
Then setup environment variables (see list below)
You just need
sudo apt-get install make
)sudo apt-get install git
)Then clone the repository (or fork-then-clone)
git clone https://github.com/hazae41/network-signaler && cd ./network-signaler
Setup environment variables (see list below) by creating a .env.local
file
cp ./.env.example ./.env.local && nano ./.env.local
You can then:
make build
make start
make logs
make open
make stop
make clean
git reset --hard && git checkout $(git tag | sort -V | tail -1)
You can enable HTTPS by either using Cloudflare as a HTTPS-to-HTTP reverse proxy, by configuring Nginx as a HTTPS-to-HTTP reverse proxy on your node, or by setting CERT
and KEY
.
PORT
(default to 8080)Don't set if cloud-hosting
The exposed port
e.g. 8080
CERT
and KEY
(optional)Don't set if cloud-hosting
The paths to your TLS certificate and private key
e.g. ./tls/fullchain.pem
and ./tls/privkey.pem
PRIVATE_KEY_ZERO_HEX
(required)Your Ethereum private key as a 0x-prefixed base16 string.
This account must have some xDAI (gas on Gnosis chain).
e.g. 0x35609a4c7e0334d76e15d107c52ee4e9beab1199556cef78fd8624351c0e2c8c
You can register your node so it can be used by applications and services
Your node should
You should also setup a custom domain name to point to your proxy if you can, to prevent the registry from being full of dead addresses
You can test the connection to your proxy by running the following code in the DevTools console of a non-CSP-protected page (e.g. the new tab page on Chrome)
await fetch("https://HOSTNAME[:PORT]")
new WebSocket("wss://HOSTNAME[:PORT]")
Replace HOSTNAME by the domain name (or IP address) of your proxy (e.g.
myproxy.mywebsite.com
)And PORT is only required if your proxy is on another port than 443 (the HTTPS port)
For example, if your proxy is on a cloud hosting, the port should be 443, so you need to do
await fetch("https://signal.mywebsite.com")
new WebSocket("wss://signal.mywebsite.com")
If you self-host your proxy on port 12345, you need to do
await fetch("https://signal.mywebsite.com:12345")
new WebSocket("wss://signal.mywebsite.com:12345")
If you see no error, then you can register your proxy by calling register
with HOSTNAME[:PORT]
https://gnosisscan.io/address/0xf1ec32C5DddbCb5652509a26E515aCCBFA4Da128#writeContract
Connect to the proxy via HTTP with the following URL query parametes
session
-> A unique private random unguessable string for your session (e.g. crypto.randomUUID()
)e.g. http://localhost:8000/?session=22deac58-7e01-4ddb-b9c4-07c73a32d1b5
Connect to the proxy via WebSocket with the following URL query parameters
session
-> A unique private random unguessable string for your session (e.g. crypto.randomUUID()
)e.g. ws://localhost:8000/?session=22deac58-7e01-4ddb-b9c4-07c73a32d1b5
The proxy accepts the following JSON-RPC methods
All unknown methods will be forwarded to the target
{
jsonrpc: "2.0",
id: 123,
method: "net_get"
}
Returns the Network parameters as { chainIdString, contractZeroHex, receiverZeroHex, nonceZeroHex, minimumZeroHex }
{
jsonrpc: "2.0",
id: 123,
method: "net_tip",
params: [string]
}
Params contains a Network secret as a 0x-prefixed base16 string of length 64
e.g.
{
jsonrpc: "2.0",
id: 123,
method: "net_tip",
params: ["0xe353e28d6b6a21a8188ef68643e4b93d41bca5baa853965a6a0c9ab7427138b0"]
}
It will return the value added to your balance as a decimal bigint string
{
jsonrpc: "2.0",
id: 123,
result: "123456789123456789"
}
Price: TODO
TODO
Price: TODO
TODO