Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1aaf8f9
first pass of advanced config + editing UI etc for pruned snapshots
alexpeterson91 Mar 7, 2024
ebaafc5
Add architectures, categories+keywords + updated links and reverted b…
alexpeterson91 May 2, 2024
86d46fc
update config for latest settings and to set config values on startup…
alexpeterson91 May 2, 2024
d0e5e5b
add functions file - uPoktToPokt and vice versa
alexpeterson91 May 3, 2024
8fdc458
update stake command, add jailed status and badge, update pokt status…
alexpeterson91 May 3, 2024
3c6b32b
add seeds 5+6, create setupwizard and add configurable settings on in…
alexpeterson91 May 3, 2024
cad8caa
Update Dockerfile to use latest version of update-browserslist-db
alexpeterson91 May 3, 2024
d4a1ad3
Create new aria download script, add cleanup funcctions, add signific…
alexpeterson91 May 3, 2024
5196abe
Update dappnode_package.json
alexpeterson91 May 3, 2024
5817307
debug config options, use string not boolean for valid compose file
alexpeterson91 May 3, 2024
102f59d
remove shorten address function thats no longer called to remove erro…
alexpeterson91 May 3, 2024
f94f832
Update README.md spelling mistake (#94) (#96)
alexpeterson91 May 3, 2024
7fad66f
Merge branch 'master' into Voss/completeConfigSetup+AriaErrorHandling
alexpeterson91 May 3, 2024
9610972
update max_claim_age_for_proof_retry param to 96 as Ian from cryptono…
alexpeterson91 May 8, 2024
8ecf34a
update UI link in manifest
alexpeterson91 Jun 18, 2024
1b04d34
update setup wizard wording, change defaults, add pattern checking fo…
alexpeterson91 Jun 18, 2024
54c869a
add unjail node functionality, add unstaking time, and public key to …
alexpeterson91 Jun 18, 2024
db74ded
-rename Functions.ts to utils.ts, and fix related imports
alexpeterson91 Jun 18, 2024
a9369c2
add conditional rendered unstaking time badge, fix imports, revert un…
alexpeterson91 Jun 18, 2024
290f704
add link to downloading snapsnot UI page to check logs
alexpeterson91 Jun 18, 2024
87e82a6
update optimism default endpoints
alexpeterson91 Jun 18, 2024
5ca439f
open rpc origins
alexpeterson91 Jun 18, 2024
1b5f48d
- add unjail function and Button,
alexpeterson91 Jun 18, 2024
3d5587e
fix indent
alexpeterson91 Jun 18, 2024
9534afc
-fix config setup via UI and config tab
alexpeterson91 Jun 18, 2024
bfde91c
-bump UI base node alpine image to 18.20.2-alpine
alexpeterson91 Jun 18, 2024
1f3c2fa
fix typos
alexpeterson91 Jun 18, 2024
0b6089c
fix type error with date/timestamps
alexpeterson91 Jun 18, 2024
04b8030
bump node to proper LTS version
alexpeterson91 Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions dappnode_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@
"shortDescription": "Web3 Infrastructure The Right Way.",
"description": "Instead of deploying to a single service provider, paying absurd fees for random outages and leaked data, tap into Pocket's trustless API protocol and route your requests to 1000's of independent full nodes. Available for all major blockchain networks.",
"type": "service",
"architectures": ["linux/amd64"],
"mainService": "pocket",
"author": "DAppNode Association <admin@dappnode.io> (https://github.com/dappnode)",
"contributors": ["eduadiez <edu@dappnode.io> (https://github.com/eduadiez)",
"Voss <voss@visnovalabs.io> (https://github.com/alexpeterson91)",
"contributors": ["Voss <voss@visnovalabs.io> (https://github.com/alexpeterson91)",
"eduadiez <edu@dappnode.io> (https://github.com/eduadiez)",
"mgarciate <mgarciate@shardlabs.io> (https://github.com/mgarciate)"],
"categories": ["Blockchain"],
"categories": ["Blockchain", "Economic incentive"],
"keywords": ["blockchain", "ethereum", "web3", "infrastructure", "pocket", "pokt", "rpc", "dappnode"],
"license": "GPL-3.0",
"links": {
"ui": "http://pocket.pocket.dappnode/",
"homepage": "https://www.pokt.network",
"Wallet": "https://wallet.pokt.network/",
"Explorer": "https://explorer.pokt.network/"
"ui": "http://pocket.dappnode",
"homepage": "https://pokt.network",
"Wallet": "https://wallet.pokt.network",
"Explorer": "https://poktscan.com",
"Docs": "https://docs.pokt.network",
"api": "http://pocket.dappnode:8081",
"forum": "https://forum.pokt.network",
"discord": "https://discord.gg/pokt"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,16 +54,6 @@
"name": "keyfile",
"path": "/home/app/.pocket/config/keyfile.json",
"service": "pocket"
},
{
"name": "addrbook",
"path": "/home/app/.pocket/config/addrbook.json",
"service": "pocket"
},
{
"name": "chains_mainnet_template",
"path": "/home/app/chains_mainnet_template.json",
"service": "pocket"
}
]
}
15 changes: 11 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
version: "3.5"
services:
pocket:
image: "pocket.pocket.dnp.dappnode.eth:0.1.0"
image: pocket.pocket.dnp.dappnode.eth:0.1.0
build:
context: pocket
args:
UPSTREAM_VERSION: RC-0.11.1
restart: unless-stopped
volumes:
- "pocket-mainnet:/home/app/.pocket/"
- pocket-mainnet:/home/app/.pocket/
ports:
- "26656:26656/udp"
- "26656:26656/tcp"
- 26656:26656/tcp
environment:
KEYFILE_PASSPHRASE: null
NETWORK: mainnet
Expand All @@ -20,6 +19,14 @@ services:
ARIA2_SNAPSHOT: "Yes"
PRUNED_SNAPSHOT: "Yes"
COMPRESSED_SNAPSHOT: "Yes"
BACKFIRE_PREVENTION: "false"
PERSISTENT_PEERS: ""
MAX_PEERS_INBOUND: 28
MAX_PEERS_OUTBOUND: 7
SEEDS: >-
7c0d7ec36db6594c1ffaa99724e1f8300bbd52d0@seed1.mainnet.pokt.network:26662,cdcf936d70726dd724e0e6a8353d8e5ba5abdd20@seed2.mainnet.pokt.network:26663,74b4322a91c4a7f3e774648d0730c1e610494691@seed3.mainnet.pokt.network:26662,b3235089ff302c9615ba661e13e601d9d6265b15@seed4.mainnet.pokt.network:26663,ab5776d1c9a50d47e30e90a0600e787d9fb74643@seed5.mainnet.pokt.network:26664,a6dec84acfe1bae887cd6c4f2eeb864fae29c9f7@seed6.mainnet.pokt.network:26664
SESSION_ROLLOVER: "0"
ADVANCED_CONFIG: "No"
EXTRA_OPTS: ""
ulimits:
nofile:
Expand Down
23 changes: 19 additions & 4 deletions pocket/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
# build environment
# Build UI Environment
ARG UPSTREAM_VERSION
FROM node:16.17.0-alpine as build-ui

FROM node:18.20.3-alpine as build-ui

WORKDIR /app

COPY ui /app/ui
# COPY ui/package.json ./
# COPY ui/yarn.lock ./

WORKDIR /app/ui

RUN yarn && yarn build
RUN npx update-browserslist-db@latest

#Starting with version BETA-0.10.2 of the v0 Pokt Core, the Docker package registry has been replaced by the Github Container Registry at ghcr.io/pokt-network/pocket-v0:BETA-0.10.2
#Starting with version BETA-0.10.2 of the v0 Pokt Core, the DockerHub package registry has been replaced by the Github Container Registry at ghcr.io/pokt-network/pocket-v0:latest.
FROM ghcr.io/pokt-network/pocket-v0:${UPSTREAM_VERSION}

WORKDIR /home/app/

USER root

# RUN apk add -u gettext curl jq nginx supervisor lz4 aria2
RUN apk update
RUN apk add -u gettext curl jq nodejs npm supervisor lz4 aria2

ADD entrypoint.sh /usr/local/bin/entrypoint.sh

ADD chains/chains_mainnet.json /home/app/.pocket/config/chains.json
ADD genesis_mainnet.json /home/app/.pocket/config/genesis.json
ADD config_template.json /home/app/.pocket/config/config_template.json
Expand All @@ -31,11 +36,21 @@ ADD supervisord.conf /etc/supervisord/supervisord.conf
ADD app.js /home/app/app.js
ADD chains/chains_mainnet_template.json /home/app/chains_mainnet_template.json
ADD chains/chains_testnet_template.json /home/app/chains_testnet_template.json
ADD config_template.json /home/app/config_template.json

RUN npm install express shelljs
RUN npx update-browserslist-db@latest

COPY --from=build-ui /app/ui/build /home/app/build
COPY dummyui /home/app/dummyui

# UI Internal
EXPOSE 80
# RPC Proxy via HTTPS External
EXPOSE 8081
# P2P External
EXPOSE 26656
# Tendermint RPC Internal
EXPOSE 26657

ENTRYPOINT ["entrypoint.sh"]
93 changes: 70 additions & 23 deletions pocket/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ app.get('/version', (req, res) => {
res.send(version)
})

function upoktToPokt(upokt) {
return upokt / 1000000;
}

function poktToUpokt(pokt) {
return pokt * 1000000;
}

app.get('/api/account', (req, res) => {
// res.send(
Expand Down Expand Up @@ -51,6 +44,9 @@ app.get('/api/account', (req, res) => {
network: network,
initialized: account != null ? true : false,
node: node,
jailed: node?.jailed ?? false,
publicKey: node?.public_key ?? "Unknown",
unstakingTime: node?.unstaking_time ?? "0001-01-01T00:00:00Z",
};
res.send(response);
});
Expand Down Expand Up @@ -84,6 +80,32 @@ function checkEthereumState(url) {
}
}

// curl -X GET http://lighthouse-holesky.dappnode:3500/eth/v1/node/syncing -H "accept: application/json" | jq

// % Total % Received % Xferd Average Speed Time Time Time Current
// Dload Upload Total Spent Left Speed
// 100 112 100 112 0 0 245 0 --:--:-- --:--:-- --:--:-- 245
// {
// "data": {
// "is_syncing": false,
// "is_optimistic": false,
// "el_offline": false,
// "head_slot": "1475263",
// "sync_distance": "1"
// }
// }
function checkBeaconState(url) {
try {
const syncing = JSON.parse(shell.exec(`curl -X GET -H "accept: application/json" ${url}/eth/v1/node/syncing`).stdout.trim());
if (syncing.data.is_syncing === false && syncing.data.is_optimistic === false && syncing.data.el_offline === false) {
return 2;
}
return 1;
} catch (error) {
return 0;
}
}

function checkNearState(url) {
try {
const syncing = JSON.parse(shell.exec(`curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"status","params":[],"id":1}' ${url}`).stdout.trim());
Expand All @@ -108,17 +130,24 @@ function checkAvalancheState(url) {
}
}

// TODO: Test Pokt State Functionality
// TODO: Test Pokt State Functionality + Remove other params commented out when successful with current params
function checkPoktState(url) {
try {
url = `https://pocket-pocket.${domain}`
const localHeight = JSON.parse(shell.exec(`curl -X POST -H {Content-Type:\ application/json} --json {} ${url}/v1/query/height`).stdout.trim());
const currentHeight = JSON.parse(shell.exec(`curl https://mainnet.rpc.grove.city/v1/e6abbfca/v1/query/height`).stdout.trim());
// const nodeHeight = JSON.parse(shell.exec(`pocket query height --datadir=/home/app/.pocket/ | tail -n +2`).stdout.trim());
if (currentHeight.result.height - localHeight.result.height === 0) {
//url = `tcp://localhost:26657`; MUST USE HTTP for cURL to work doesn't support tcp://localhost:26657
var newUrl = url.replace(/:8081$/, ':26657');
//const syncing = JSON.parse(shell.exec(`curl ${newUrl}/status`).stdout.trim());
const syncing = JSON.parse(shell.exec(`curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"status","params":[],"id":-1}' "${newUrl}"`).stdout.trim());
//const syncing = JSON.parse(shell.exec(`curl http://localhost:26657/status`).stdout.trim());
var prunedSnapshot = shell.exec(`echo $PRUNED_SNAPSHOT`).stdout.trim();
//const localHeight = JSON.parse(shell.exec(`curl -X POST -H {Content-Type:\ application/json} --json {} ${url}/v1/query/height`).stdout.trim());
//const currentHeight = JSON.parse(shell.exec(`curl https://mainnet.rpc.grove.city/v1/xxxxxxxx/v1/query/height`).stdout.trim());
//const nodeHeight = JSON.parse(shell.exec(`pocket query height --datadir=/home/app/.pocket/ | tail -n +2`).stdout.trim());
if (syncing.result.sync_info.catching_up === false && prunedSnapshot == 'Yes') {
return 3;
} else if (syncing.result.sync_info.catching_up === false && prunedSnapshot == 'No') {
return 2;
}
return 1;
} else if (syncing.result.sync_info.catching_up === true) {
} return 1;
} catch (error) {
return 0;
}
Expand All @@ -132,9 +161,10 @@ function checkStateChain(type, url) {
return checkNearState(url);
case "avalanche":
return checkAvalancheState(url);
case "beacon":
return checkBeaconState(url);
case "pokt":
return 2;
// return checkPoktState();
return checkPoktState(url);
default:
return 0;
}
Expand All @@ -159,7 +189,6 @@ app.get('/api/availableChains', (req, res) => {
state: checkStateChain(chains[chain.id].type, chain.url),
}
});

res.send(response);
})

Expand All @@ -183,14 +212,23 @@ app.post('/api/replaceChains', (req, res) => {
if (chainsFiltered && chainsFiltered.length > 0) {
let response = JSON.stringify(chainsFiltered, null, 2);
shell.exec(`echo '${response}' > /home/app/.pocket/config/chains.json`);
shell.exec(`pkill pocket`);
// shell.exec(`pkill pocket`); This should no longer be needed since the addition of the config option for hot chains reload to be set to `true` this command no longer kills the Pocket process improving performance on initial test nodes so far, with no errors without kiling the process everytime it needs to reload the chains.json file.
res.send(response);
} else {
throw new Error("Empty json");
}
})

app.post('/api/stake', (req, res) => {
app.post('/api/unjailNode', (req, res) => {
// pocket nodes unjail <operatorAddr> <fromAddr> <networkID> <fee> <isBefore8.0> [flags]
const account = shell.exec(`pocket accounts list --datadir=/home/app/.pocket/ | cut -d' ' -f2- `).stdout.trim();
const network = shell.exec(`echo $NETWORK`).stdout.trim();
const passphrase = shell.exec(`echo $KEYFILE_PASSPHRASE`).stdout.trim();
const response = shell.exec(`pocket nodes unjail ${account} ${account} ${network} 10000 false --datadir=/home/app/.pocket/ --pwd ${passphrase} | tail -n +3`).stdout.trim();
res.send(response);
})

app.post('/api/stakeCustodial', (req, res) => {
// console.log(req.body.amount);
// console.log(req.body.chains);
// res.send({});
Expand All @@ -200,10 +238,18 @@ app.post('/api/stake', (req, res) => {
const address = shell.exec(`pocket accounts list --datadir=/home/app/.pocket/ | cut -d' ' -f2- `).stdout.trim();
const domain = shell.exec(`echo $_DAPPNODE_GLOBAL_DOMAIN`).stdout.trim();
// https://discord.com/channels/553741558869131266/564836328202567725/967105908347895819
const response = shell.exec(`pocket nodes stake custodial ${address} ${req.body.amount} ${req.body.chains} https://pocket-pocket.${domain}:443 ${network} 10000 false --datadir=/home/app/.pocket/ --pwd "${passphrase}" | tail -n +3`).stdout.trim();
const response = shell.exec(`pocket nodes stake custodial ${address} ${req.body.amount} ${req.body.chains} https://pocket-pocket.${domain}:443 ${network} 10000 false --datadir=/home/app/.pocket/ --pwd ${passphrase} | tail -n +3`).stdout.trim();
res.send(response);
})

// app.post('/api/stakeNonCustodial', (req, res) => {
// // pocket nodes stake non-custodial <operatorPublicKey> <outputAddress> <amount> <RelayChainIDs> <serviceURI> <networkID> <fee> <isBefore8.0> [flags]
// const network = shell.exec(`echo $NETWORK`).stdout.trim();
// const passphrase = shell.exec(`echo $KEYFILE_PASSPHRASE`).stdout.trim();
// const domain = shell.exec(`echo $_DAPPNODE_GLOBAL_DOMAIN`).stdout.trim();
// const operatorPublicKey = shell.exec().stdout.trim();
// })

var server = app.listen(CUSTOM_UI_HTTP_PORT, function () {
var host = server.address().address;
var port = server.address().port;
Expand Down Expand Up @@ -244,5 +290,6 @@ const mainnetChains = {
"03DF": {"name": "EVM AVAX DFK Subnet", "type": "avalanche"},
"A003": {"name": "Avalanche Archival", "type": "avalanche"},
"A053": {"name": "Optimism Archival", "type": "ethereum"},
}

"B021": {"name": "Ethereum Beacon", "type": "beacon"},
"B081": {"name": "Holesky Beacon", "type": "beacon"},
};
12 changes: 10 additions & 2 deletions pocket/chains/chains_mainnet_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
{
"id": "0053",
"url": "http://optimism.optimism.public.dappnode:8545"
"url": "http://op-node.op-node.dappnode:9545"
},
{
"id": "0063",
Expand Down Expand Up @@ -61,6 +61,14 @@
},
{
"id": "A053",
"url": "http://optimism.optimism.public.dappnode:8545"
"url": "http://op-node.op-node.dappnode:9545"
},
{
"id": "B021",
"url": "http://beacon-chain.lodestar.dappnode:3500"
},
{
"id": "B081",
"url": "http://beacon-chain.teku-holesky.dappnode:3500"
}
]
Loading