Tezlink: List RPC necessary for tzkt/umami support of a transfer
Results
What tzkt calls:
GET /chains/main/blocks/<i>
GET /chains/main/blocks/<i>/context/contracts/<address>
GET /chains/main/blocks/<i>/context/issuance/expected_issuance
GET /chains/main/blocks/<i>/context/raw/json/cycle/<i>
GET /chains/main/blocks/<i>/context/constants
GET /chains/main/blocks/head/header
What Umami calls:
GET /chains/main/blocks/head
GET /chains/main/blocks/head~2/header
GET /chains/main/blocks/head/context/constants
GET /chains/main/blocks/head/context/contracts/<address>
GET /chains/main/blocks/head/context/contracts/<address>/manager_key
GET /chains/main/blocks/head/protocols
GET /chains/main/chain_id
POST /chains/main/blocks/head/helpers/preapply/operations
POST /chains/main/blocks/head/helpers/scripts/simulate_operation
POST /injection/operation
Experiment
To obtain those lists of RPC, we ran a l1 network in sandbox locally, and plugged on it, through a nginx reverse proxy, a local tzkt instance and a local umami web instance. We use the nginx reverse proxy to log separately calls made from umami, tzkt sync (the indexer) and tzkt api.
It's built on the experiment %Tezlink: end-to-end demonstration of Tezos Layer 1 minus the Teia part to concentrate first on a simple transfer, done from a bootstrap account.
TODO: a simple script to automate most of it.
L1 sandbox
We follow Octez documentation to start a network with two nodes, activate PsQuebec and bake blocks.
In a few terminals:
term 1:
$TEZOS/src/bin_node/octez-sandboxed-node.sh 1 --connections 1
term 2:
$TEZOS/src/bin_node/octez-sandboxed-node.sh 9
term 3:
eval `$TEZOS/src/bin_client/octez-init-sandboxed-client.sh 1`
octez-activate-021-PsQuebec
octez-client bake for --minimal-timestamp
while true; do octez-client bake for --minimal-timestamp; sleep 1; done
We use two nodes, and point everybody except the baker to the second one, just in case we need to look at their logs.
nginx config
We create three virtual servers, one for each application pointing to a l1 node (umami, tzkt indexer and tzkt api), with a log file for each. The umami server also deals with cors and other header stuff. TBH not sure which part is necessary, but this works (without it umami can't access the node).
Install nginx. In /etc/nginx/sites-enabled create a reverse file and put the following in it.
# port dedicated to umami
server {
listen 1044;
location / {
# Hide upstream CORS headers to prevent duplication
proxy_hide_header Access-Control-Allow-Origin;
# Add CORS headers to all responses
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
add_header 'Access-Control-Max-Age' 1728000 always;
# Handle OPTIONS method
if ($request_method = OPTIONS) {
return 204;
}
proxy_pass http://localhost:18739;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'keep-alive';
}
access_log /var/log/nginx/reverse_1044.log;
}
# port dedicated to tzkt-sync (the indexer)
server {
listen 1045;
location / {
proxy_pass http://localhost:18739;
}
access_log /var/log/nginx/reverse_1045.log;
}
# port dedicated to tzkt-api (not used atm because we deactivate `RpcHelpers` in the api conf)
server {
listen 1046;
location / {
proxy_pass http://localhost:18739;
}
access_log /var/log/nginx/reverse_1046.log;
}
And to restart:
sudo systemctl restart nginx.service
tzkt
Did the same changes as %Tezlink: end-to-end demonstration of Tezos Layer 1 but with
in tzkt/Tzkt.Sync/appsetting.json
"TezosNode": {
"Endpoint": "http://localhost:1044/",
"Timeout": 60
},
and in tzkt/Tzkt.Api/appsetting.json
"RpcHelpers": {
"Enabled": false,
...
},
To install:
cd .../tzkt/Tzkt.Sync/
dotnet publish -o ~/tzkt-sync
cd ~/tzkt/Tzkt.Api/
dotnet publish -o ~/tzkt-api
To start:
cd ~/tzkt-sync
dotnet Tzkt.Sync.dll
cd ~/tzkt-api
dotnet Tzkt.Api.dll
You should see the indexer do its thing
...
info: Tzkt.Sync.Services.Observer[0]
Applied 11 of 11
...
umami
Again, did the same changes as %Tezlink: end-to-end demonstration of Tezos Layer 1 but with
+export const SANDBOX: Network = {
+ name: "sandbox",
+ rpcUrl: "http://localhost:1044",
+ tzktApiUrl: "http://localhost:5000",
+ tzktExplorerUrl: "https://ghostnet.tzkt.io",
+ buyTezUrl: "",
+};
+
TODO: we should actually capture the calls made by umami to the tzkt api.
To start:
cd .../umami-v2/apps/web
pnpm dev
cleanup data
TODO: the data should really be logged cleaned by nginx, by changing the log_format but for the record the following should do most of it
cat /var/log/nginx/reverse_1044.log | grep "\".*HTTP" -o | grep "[A-Z].* " -o| sort | uniq