Trying to build an explorer node


#1

I’m trying to set up a server as an explorer, so I can look at balances and transactions for addresses.I’ve set it up, I think correctly however I get no results for an address query.

I’ve so far got the cardano-sl code up and running with these commands:

curl https://nixos.org/nix/install | sh
sudo mkdir -p /etc/nix
sudo vi /etc/nix/nix.conf 
        binary-caches            = https://cache.nixos.org https://hydra.iohk.io
        binary-cache-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
git clone https://github.com/input-output-hk/cardano-sl.git
cd cardano-sl
Git checkout master
nix-build -A connectScripts.mainnetWallet -o connect-to-mainnet
./connect-to-mainnet

and I can run this command:

curl -k https://localhost:8090/api/settings/sync/progress

which returns:

{"Right":{"_spLocalCD":{"getChainDifficulty":{"getBlockCount":1198292}},"_spNetworkCD":{"getChainDifficulty":{"getBlockCount":1198292}},"_spPeers":0}}

However an address command (I found this address online, it’s not mine):

curl -k https://localhost:8090/api/addresses/summary/DdzFFzCqrhsx7XvWTXx2t7SoRvh1Q2h86FbccEt73GGenXXKBBJb8sbbGAApkTSJConQCeYt1rmyYM2NBL7Giv8BgBiFCbxUfipMYFsL

Just returns nothing. Surely it should return a summary of transactions?


#2

look at https://cardanodocs.com/technical/wallet/api/v1/

Please note that wallet web API uses TLS for secure communication. Requests to the API need to send a client CA certificate that was used when launching the node and identifies the client as being permitted to invoke the server API.


#3

Ah, I’d used -k because I got this error

curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.

and a quick google search had people saying to use -k as the solution


#4

Ah solved by using the cert in state-wallet-mainnet/tls/server.cert


#5

Note: I was able to successfully build and run explorer by this script with some fixes:

1

nix-build -A connectScripts.mainnetWallet -o connect-to-mainnet

Is replaced with

nix-build -A connectScripts.mainnet.explorer -o connect-explorer-to-mainnet

And then launched with:

. connect-explorer-to-mainnet

2

This line is removed

git checkout master

Because I only was able to build it from the default branch develop.
But it is possible that now it also works from master.

Result:

curl https://nixos.org/nix/install | sh
sudo mkdir -p /etc/nix
sudo vi /etc/nix/nix.conf 
        binary-caches            = https://cache.nixos.org https://hydra.iohk.io
        binary-cache-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
git clone https://github.com/input-output-hk/cardano-sl.git
cd cardano-sl
nix-build -A connectScripts.mainnet.explorer -o connect-explorer-to-mainnet
. connect-explorer-to-mainnet