Giter Club home page Giter Club logo

grin-explorer's People

Contributors

0xb100d avatar 0xmichalis avatar dependabot[bot] avatar garyyu avatar hendi avatar ignopeverell avatar l33d4n avatar quentinlesceller avatar xiaojay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grin-explorer's Issues

ERROR: Failed building wheel for psycopg2

Hello,

When I tried to execute command 'pip install -r requirements.txt' I got error:
Do you have any ideas?
Can psycopg2-binary be replaced for psycopg2?

`grinviet@bangnode1:$ cd grin-explorer
grinviet@bangnode1:
/grin-explorer$ python3 -m venv venv
grinviet@bangnode1:/grin-explorer$ source venv/bin/activate
(venv) grinviet@bangnode1:
/grin-explorer$ pip install -r requirements.txt
Requirement already satisfied: Django==2.2.24 in ./venv/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (2.2.24)
Collecting psycopg2==2.8.6
Using cached psycopg2-2.8.6.tar.gz (383 kB)
Requirement already satisfied: requests==2.20.0 in ./venv/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (2.20.0)
Requirement already satisfied: django_chartit==0.2.9 in ./venv/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (0.2.9)
Requirement already satisfied: sqlparse>=0.2.2 in ./venv/lib/python3.8/site-packages (from Django==2.2.24->-r requirements.txt (line 1)) (0.4.1)
Requirement already satisfied: pytz in ./venv/lib/python3.8/site-packages (from Django==2.2.24->-r requirements.txt (line 1)) (2021.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (2021.5.30)
Requirement already satisfied: idna<2.8,>=2.5 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (2.7)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in ./venv/lib/python3.8/site-packages (from requests==2.20.0->-r requirements.txt (line 3)) (1.24.3)
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/grinviet/grin-explorer/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"'; file='"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-4j97i64s
cwd: /tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/
Complete output (40 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/init.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120007 -DHAVE_LO64=1 -I/home/grinviet/grin-explorer/venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:28:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
36 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.

It appears you are missing some prerequisite to build the package from source.

You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.

For further information please check the 'doc/src/install.rst' file (also at
https://www.psycopg.org/docs/install.html).

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ERROR: Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
command: /home/grinviet/grin-explorer/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"'; file='"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-i_iae1wj/install-record.txt --single-version-externally-managed --compile --install-headers /home/grinviet/grin-explorer/venv/include/site/python3.8/psycopg2
cwd: /tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/
Complete output (40 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/init.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120007 -DHAVE_LO64=1 -I/home/grinviet/grin-explorer/venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:28:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
36 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.

It appears you are missing some prerequisite to build the package from source.

You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.

For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /home/grinviet/grin-explorer/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"'; file='"'"'/tmp/pip-install-1k1oyfoq/psycopg2_df9110f2abf94ef9a904f31bf5f57f45/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-i_iae1wj/install-record.txt --single-version-externally-managed --compile --install-headers /home/grinviet/grin-explorer/venv/include/site/python3.8/psycopg2 Check the logs for full command output.
`

Expose list of known good peers

I removed .grin and after a couple of hours running latest testnet1 code, I'm seeing " 1 / 4 / 320" peers, can't get any more good ones and ping/pong lines show 0 @ 0 vs us 135 645 922 @ 15032 and a single node stuck at 35 432 595 @ 0

Meanwhile, gitter chat talks about seeing >8 healthy peers and grinexplorer is at 138 194 082 @ 20429 so my node is clearly behind, just can't find the healthy nodes. Maybe because I'm only talking to nodes already banned by the more long-running healthy ones. Either way, exposing the grin explorer list of known good nodes in a best-effort way could be very helpful.

Maybe format it like grin server -s $IP:$PORT start.

Note: It seems multiple server start commands won't work without stopping your grin server in between, so the instruction should be: stop grin, then grin server ... and it's not very automation-friendly yet. Maybe mimblewimble/grin#218 will mean adding a feature that accepts an ip:port that gets queued up to be asked for peers, and that could be used for reviving a stuck node like mine currently is (at height 15xxx for hours and hours).

Add search for block hash

Should also work for the partial hashes from the debug output:

Dec 09 13:12:29.954 DEBG Requesting block f260933e from peer 37.59.48.28:13414

More Node Information on /health

It would be nice to see more information of the node in the health section. Information like: Header and Network height, inbound and outbound connections and the status of the node, maybe.

Expose IP:port of the peer that announced a new block

The idea being, if you can ask the node that is first to know about a block, you should peer with either that node, or one of it's closest peers.

If you also can get to know the ip:port of a node that is much slower at getting that block, then you could on purpose place your newly spun up, but reliably hosted node, as a go-between and connect to both of these, making the gossip network scale better as a result.

Expose list of peers with too old code versions

Maybe grinexplorer could have an output with the most up to date list of seemingly unwanted peers.

This could be formatted like a dynamic "getting started with grin" kind of living documentation, that gets autogenerated from the last known grin network situation.

By formatting it as one peer per row, curl -X POST http://localhost:13413/v1/peers/$IP:$PORT/ban, anyone having trouble syncing up or who want to avoid a lot of gossiping with outdated peers could copy&paste the list to their local node. This is meant as a help in messy situations when a breaking update has been made and lots of nodes are not yet updated.

Note that grin's ban API endpoint is currently "forever" but will become time limited, but until that is done, it might also be a good idea to keep a note about cleaning out the ban list manually by removing .grin/peers as soon as you've got your node synced up.

Do not warn about very old fork

Currently grin-explorer warn about forks sometimes older than 1000. I would say warning about less than 60 blocks seems okay but not more than that.

way to see/visualize all chains that include a certain block

Given a block (hash) it would be useful to be able to view all chains (all heads of chains?) that include this block.
We see a lot of forks in testnet1 - and it would be great if we could know what forked off ahead of a given block.
So a node operator could see what is ahead of them during syncing or if they appear to be on the wrong fork.

Explorer does not have data of old heights

Hello,
I just built a new explorer https://scan.grin.money and the remaining issue is that the chart only show 3 recent days data and it only has the heights data last 3 days. I already enabled my node to archive mode. I wonder how can my node have data from genesis blocks like https://grinexplorer.net/?
Is it possible to have your exported data in postgresql or your full blockchain directory data_chain?

Thank you.

Integer out of range

Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/home/quentinlesceller/grin-explorer/grinexplorer/blockchain/management/commands/import_from_tip.py", line 38, in handle
    (status, block_hash, prev_hash) = self.fetch_and_store_block(hash, parent)
  File "/home/quentinlesceller/grin-explorer/grinexplorer/blockchain/management/commands/import_from_tip.py", line 79, in fetch_and_store_block
    **block_data["header"],
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/query.py", line 413, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/base.py", line 718, in save
    force_update=force_update, update_fields=update_fields)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/base.py", line 748, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/base.py", line 831, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/base.py", line 869, in _do_insert
    using=using, raw=raw)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/query.py", line 1136, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql
    cursor.execute(sql, params)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/quentinlesceller/miniconda3/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.DataError: integer out of range

view all block with total_difficulty greater than x

As a node operator it would be really useful to view blocks (chain heads?) that are known about that have higher total_difficulty than me.
Particularly in testnet1 with the wide variety of forks in play right now.

Allow searching by commit

If I'm trying to find exactly when a particularly transaction happened, or if it was ever broadcast at all, it would be great to be able to search by commit and then have it bring up the relevant block. Otherwise I would have to guess

OUTPUTS

I SENT 7,569 GRIN TO MY GATE ACCOUNT ON 01.05.2023.
BUT OUTPUTS WERE NOT CREATED BECAUSE I DID NOT WRITE THE GATE MEMO CODE.
GRIN DID NOT COME BACK TO MY WALLET AND IT DID NOT COME TO MY GATE ACCOUNT. GATE WANTS OUTPUTS FROM ME, CAN YOU HELP ME?

ACCOUNT TO SEND : grin1r0h47e3gh254yt2sr5xvqlgtxyhu4eccl7442v6rrxp8et9maucs0nx2md
SLATE : 4cf53a63-6583-4b31-a573-7a9daf4fdb03
Kernels : 0866507dd1e9f5beb672e8182c7ff24899cbe1e9f9281594887cc4d9316bc08b20
OUTPUTS : NO DATA CREATED
SENT ACCOUNT : grin1n26np6apy07576qx6yz4qayuwxcpjvl87a2mjv3jpk6mnyz8y4vq65ahjm

file:///C:/Users/Casper/Desktop/transactions.json

After restarting the process, I get this

After restarting the process, I get this

$ python3 ./grinexplorer/manage.py import_from_tip http://127.0.0.1:13413
height=10919, tip=01eb56a93f0c82bc9938ff7788960ac38613e266d4a171cbe43cd372f6012e5b

Stored block 01eb56a93f0c82bc9938ff7788960ac38613e266d4a171cbe43cd372f6012e5b @ 10919
Stored block 013aa818df9edca4f235c751a02edaf601784520476dc6b39b717078f2a6cd4e @ 10918
  Marked block 013aa8 as previous of block 01eb56
Stored block 003ca230fec9f7c83226c178c8cb27901b54a3375858f9cf8c00f093e7eafe01 @ 10917
  Marked block 003ca2 as previous of block 013aa8
Stored block 02369cb2055ad587884462ed66098ba400bb89191ba7c3c63b5f5a57b9ece87e @ 10916
  Marked block 02369c as previous of block 003ca2
Stored block 011711091da6ea588ed4b757cee63fdd3cd4ced535da30a957c2ea3d07f52f14 @ 10915
  Marked block 011711 as previous of block 02369c
Stored block 01d6ce01291bdab0a02951bd9ed044842b855da9de10f01096a9707778376657 @ 10914
  Marked block 01d6ce as previous of block 011711
Block 02dee96cbcf6edeec5653b12fda07702db26b09a2742a2ae6b1e86dc9aea3806 already exists @ 10913
Stored block 02dee9 as previous of block 01d6ce
== exiting early

Originally posted by @Kargakis in #33 (comment)

Mining Pool distribution

Feature request:

Monitoring of STRATUM server in order to add to each block which pool did mine this block.
This would allow you at the same time to provide some statistics about mining distribution of GRIN network.

Very expensive index page query

I've noticed a heavy load on our database simply to display the list of blocks.
The query is the following:

SELECT "blockchain_block"."hash", "blockchain_block"."version", "blockchain_block"."height", "blockchain_block"."previous_id", "blockchain_block"."prev_root", "blockchain_block"."timestamp", "blockchain_block"."output_root", "blockchain_block"."range_proof_root", "blockchain_block"."kernel_root", "blockchain_block"."nonce", "blockchain_block"."edge_bits", "blockchain_block"."cuckoo_solution", "blockchain_block"."total_difficulty", "blockchain_block"."secondary_scaling", "blockchain_block"."total_kernel_offset", T2."hash", T2."version", T2."height", T2."previous_id", T2."prev_root", T2."timestamp", T2."output_root", T2."range_proof_root", T2."kernel_root", T2."nonce", T2."edge_bits", T2."cuckoo_solution", T2."total_difficulty", T2."secondary_scaling", T2."total_kernel_offset" FROM "blockchain_block" LEFT OUTER JOIN "blockchain_block" T2 ON ("blockchain_block"."previous_id" = T2."hash") ORDER BY "blockchain_block"."timestamp" DESC  LIMIT 20;

This query is extremely expensive and very slow even on a powerful db (like 10s to compute). I am wondering whether we are missing an index somewhere.

Here is the table description:

explorer=> \d+ blockchain_block
                                             Table "public.blockchain_block"
       Column        |           Type           | Collation | Nullable | Default | Storage  | Stats target | Description
---------------------+--------------------------+-----------+----------+---------+----------+--------------+-------------
 hash                | character varying(64)    |           | not null |         | extended |              |
 version             | integer                  |           | not null |         | plain    |              |
 height              | integer                  |           | not null |         | plain    |              |
 timestamp           | timestamp with time zone |           | not null |         | plain    |              |
 output_root         | character varying(64)    |           | not null |         | extended |              |
 range_proof_root    | character varying(64)    |           | not null |         | extended |              |
 kernel_root         | character varying(64)    |           | not null |         | extended |              |
 nonce               | text                     |           | not null |         | extended |              |
 total_difficulty    | bigint                   |           | not null |         | plain    |              |
 previous_id         | character varying(64)    |           |          |         | extended |              |
 total_kernel_offset | character varying(64)    |           | not null |         | extended |              |
 edge_bits           | integer                  |           | not null |         | plain    |              |
 cuckoo_solution     | bigint[]                 |           | not null |         | extended |              |
 prev_root           | character varying(64)    |           | not null |         | extended |              |
 secondary_scaling   | integer                  |           | not null |         | plain    |              |
Indexes:
    "blockchain_block_pkey" PRIMARY KEY, btree (hash)
    "blockchain_block_hash_7b6393e6_like" btree (hash varchar_pattern_ops)
    "blockchain_block_height_bf2470f4" btree (height)
    "blockchain_block_previous_id_ead75ff5" btree (previous_id)
    "blockchain_block_previous_id_ead75ff5_like" btree (previous_id varchar_pattern_ops)
Foreign-key constraints:
    "blockchain_block_previous_id_ead75ff5_fk_blockchain_block_hash" FOREIGN KEY (previous_id) REFERENCES blockchain_block(hash) DEFERRABLE INITIALLY DEFERRED
Referenced by:
    TABLE "blockchain_block" CONSTRAINT "blockchain_block_previous_id_ead75ff5_fk_blockchain_block_hash" FOREIGN KEY (previous_id) REFERENCES blockchain_block(hash) DEFERRABLE INITIALLY DEFERRED
    TABLE "blockchain_input" CONSTRAINT "blockchain_input_block_id_0d78b8c6_fk_blockchain_block_hash" FOREIGN KEY (block_id) REFERENCES blockchain_block(hash) DEFERRABLE INITIALLY DEFERRED
    TABLE "blockchain_kernel" CONSTRAINT "blockchain_kernel_block_id_8c53f550_fk_blockchain_block_hash" FOREIGN KEY (block_id) REFERENCES blockchain_block(hash) DEFERRABLE INITIALLY DEFERRED
    TABLE "blockchain_output" CONSTRAINT "blockchain_output_block_id_2a940961_fk_blockchain_block_hash" FOREIGN KEY (block_id) REFERENCES blockchain_block(hash) DEFERRABLE INITIALLY DEFERRED

@hendi any idea?

Explain the explorer's data source

Add a text box explaining data sources, something like

"Data in this explorer is collected from multiple grin servers in 4 geo locations. This makes it possible to detect forks, and many alternative blocks for same height can be seen in the explorers list of Recent blocks. This explorer aims to be the most accurate and up to date view of the grin blockchains. "

Improve Block by Height list

Show which fork a block belongs to and display its total cumulative difficulty, highlight the "best" chain, etc.

show blocks/min/chain

on gitter it was discussed if we have > 1 block/min on average.

Idea: when presenting a "block" or a "chain", show count(blocks) / minute_diff(tip.lookback(5*diff_adjust_window), tip)

Chain height vs Latest block

Chain height is based on best known chain (tot.diff.) while Latest block is whatever was most recently seen.

Separate this, so one block of info is about the best chain, and another block of info is about alternative chains that may have newer blocks.

Best would be to show several alternative forks, that can be "named" and sorted by falling tot.diff similar to how debug outputs show (or will show) that info
tot_diff @ height (hash)

Unable to import data before 05-Feb-2019 into Postgresql

Hello Hendi,

It's me again, finally I could get most data of blockchain, just one small issue remaining, I can't get data before 05-Feb-2019. Not sure if it's due to hard-fork during that period or python or postgresql limitation.
I also discovered that Grinmint got same issue like me, you could see the examples here:
https://scan.grin.money/block/000000bbf9aacf955891b3e5703d06d1649921ca6216dd15b22b31595c4fe0ac
Block 29,143
https://grinmint.com/block/000002a3eed065f456ce9f31377389ee85f605cec9d3c4824f972ddbe618efa9
Block 29,141

When we click on the inputs, it shown 404 not found error.
Thanks for your help.

Traceback before importing finishes

Stored block 00e3a7aee38f533af6dc1efb877657c7732c72d9d11194d09d74be18b7315060 @ 7968
  Marked block 00e3a7 as previous of block 00d2e3
Stored block 02acf66db0199bcf5f528475cb6d1687680a6b0f7193183d1ed17e399d5ba48f @ 7967
  Marked block 02acf6 as previous of block 00e3a7
Stored block 00672e00ef1d11970ebbb13fcbdacb333b0b3ff064a16357f7f17a352d74b409 @ 7966
  Marked block 00672e as previous of block 02acf6
Stored block 0070d72cdb2a699ed180672572ef82bf122d08b44ae22e30ed087bacac037fe9 @ 7965
  Marked block 0070d7 as previous of block 00672e
Stored block 00ec07f76524a1c1705668221964989ed49552a120bf878b507d760d7160fc76 @ 7964
  Marked block 00ec07 as previous of block 0070d7
Stored block 0239f4657058df78f70e023b2a46414f31bd346251615938e32f093073337589 @ 7963
  Marked block 0239f4 as previous of block 00ec07
Stored block 01b66fa15c67a1df43264eb27882933cf2cd9243e6a9a67b60a7ea284fb8220d @ 7962
  Marked block 01b66f as previous of block 0239f4
Traceback (most recent call last):
  File "./grinexplorer/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/mkargaki/projects/grin-explorer/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/mkargaki/projects/grin-explorer/venv/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/mkargaki/projects/grin-explorer/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/mkargaki/projects/grin-explorer/venv/lib64/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/home/mkargaki/projects/grin-explorer/grinexplorer/blockchain/management/commands/import_from_tip.py", line 47, in handle
    (status, block_hash, prev_hash) = self.fetch_and_store_block(hash, parent)
  File "/home/mkargaki/projects/grin-explorer/grinexplorer/blockchain/management/commands/import_from_tip.py", line 61, in fetch_and_store_block
    block_data = requests.get(self.API_BASE + "blocks/" + hash).json()
  File "/home/mkargaki/projects/grin-explorer/venv/lib64/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@hendi

postgresql-setup: command not found

After having done
$ sudo apt install postgresql postgresql-contrib
$ sudo postgresql-setup --initdb
sudo: postgresql-setup: command not found

Where is the postgresql-setup command described in the installation instructions? It does not exist anywhere on the server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.