Rosetta: How to pull the transaction list from the various ledger canisters?

Hi all, I am trying to create a system to fetch all transactions of ICP and other IRC tokens. My implementation will not be hosted on IC so I will have to use a Rosetta node from what I understand. I will need it for statistical and research purposes.

So far I have installed Docker on a remote server (ubuntu) and the Rosetta node following DFINITY instructions. The mainnet synchronization seems to be completed successfully.

I am now having a bit of difficulty configuring Nginx so that I can make the requests for the various endpoints from the browser. Does anyone have any suggestions?

Also, from what I understand the rosetta node is useful for downloading only ICP token transactions and not IRCs am I right?

If in your opinion I am going down a difficult road and there are other ways to get the transaction list (updated in real time of course) please tell me…I would appreciate it.

Thanks to everyone who can help me.

The ICP Rosetta software that is publicly available can sync with the ICP ledger (and other ledgers that are forks of the ICP ledger, like the OGY ledger). It doesn’t work with ICRC ledgers like ckBTC, ckETH or SNS ledgers. However, we are actively working on an ICRC Rosetta client which should be able to sync with ICRC ledgers.

Of course, you don’t have to use Rosetta but IMO this is the simplest way to download the chains for tokens hosted on ICP, even if it is a bit of an overkill (e.g. this software also supports off-line signing and transaction submission, staking etc which you may not need to IIUC).

1 Like

Thank you very much for your reply. From what I understand you are telling me that Rosetta is the easiest method to fetch transactions… and that soon IRC tokens will also be available. This is great!

However, I still have not been able to finalize the configuration of my server, as I mentioned before I installed and started the node on the main net. With the command:

sudo docker run \
    --interactive \
    --tty \
    --publish 8080:8080 \
    --detach \
    --name rosetta-node \
    dfinity/rosetta-api \
    --mainnet \
    --not-whitelisted

The node works correctly and updates!

Then I installed Nginx to allow api calls via url and receive json, and configured it as follows:

sudo nano /etc/nginx/sites-available/mydomain.com

server {
listen 80;
server_name mydomain.com;

location / {
    proxy_pass http://localhost:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

}

I connected the file
sudo ln -s /etc/nginx/sites-available/mydomain.com /etc/nginx/sites-enabled/
checked the syntax and restarted, however from browser I still get bad gateway.

I repeated the procedure several times, checked anything DNS, Firewall etc… I even created ua index.html page to verify the connection and it worked fine. However, I can’t seem to contact the node.

Am I missing any steps? Thank you for your help!

Save cross posting the same info – I’ve put a couple of links here 221Bravo - A fully on-chain explorer for ICP tokens - #5 by NS01 :slightly_smiling_face:

1 Like

Bump, Has anyone experienced a similar problem. Thank you.

I’m not familiar with setting up nginx; perhaps @mariop can help?

1 Like

Update: After several attempts made even with Apache2 it seems that I was able to correctly connect the docker container with my domain. In fact now from browser I no longer get errors like Bad Gateway or Server is Down, instead I see a completely blank page.

This made me think that the configuration was correct. (with Apache) is that so?

However, I tried building the url with the endpoints provided in the official rosetta documentation, but I still get no results. For example, I tried a php call:

<?php

$url = 'http://mydomain.com/account/balance';

$data = array(
    'network_identifier' => array(
        'blockchain' => 'Internet Computer',
        'network' => '00000000000000020101'
    ),
    'account_identifier' => array(
        'address' => '220c3a33f90601896e26f76fa619fe288742df1fa75426edfaf759d39f2455a5'
    ),
    'metadata' => array()
);

$options = array(
    'http' => array(
        'header' => "Content-type: application/json\r\n",
        'method' => 'POST',
        'content' => json_encode($data)
    )
);

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);

if ($response === FALSE) {
    echo "Error";
} else {
    echo $response;
}

?>

Could you please show me what I am missing to make calls to the node to fetch analytical data? Thank you.

I was able to communicate with the node at the end–thanks anyway!

When will it be possible to fetch data for other ledger canisters as well? Like for SNS tokens or for ckBTC/ETHs.

How will this work, will it be necessary to have more than one Rosetta node, or can everything be done by the same one we use now to take the information on ICP?