wiringbits / block-explorer Goto Github PK
View Code? Open in Web Editor NEWThe official Stakenet block explorer
Home Page: https://xsnexplorer.io/
The official Stakenet block explorer
Home Page: https://xsnexplorer.io/
There are balances not matching the data from the transaction inputs and outputs.
The balances table should keep the information from transaction inputs and outputs aggregated.
There are balances not matching the data from the transaction inputs and outputs, the table is being corrupted for some reason,
Unknown, occurred in production.
The home page is not very mobile friendly.
The details are readable while loading the explorer on small screens, example:
One point would be to render one decimal in the difficulty field.
Please note that all the tabs are affected.
See https://chainz.cryptoid.info/pivx/
The details are far from readable on small screens:
Go to http://xsnexplorer.io/ on a mobile device.
While the same time format is displayed in the application, we keep hardcoding the format.
There is a pipe that allow us to render a time in the preferred application time format, something like {{timestamp | customReadableTime }}
should render a readable timestamp.
We use the following way across all the application to render times: {{blockDetails.block.medianTime * 1000 | date:'MMMM d, y, h:mm:ss a'}}
.
In case we choose to use a different format, it will be a pain to keep them all consistent.
Increase the backend test coverage.
The test coverage is higher.
The test coverage is not as good as it can be.
One line summary of the issue here.
As concisely as possible, describe the expected behavior.
As concisely as possible, describe the observed behavior.
Please list all relevant steps to reproduce the observed behavior.
Based on the segwit requirements, we'll need to update the schema to complete #34 and #35, while we could keep adding migration scripts, it is simpler to just rebuild the database.
Gladly, rebuilding the database is as simple as seeding it from the xsnd
, compacting the scripts will simplify understanding the models.
Lets rebuild the migration scripts and add support for utxos.
Also, it would be useful to add foreign key constraints, as the seeding process will be linear (see #37), foreign keys will play an important role to keep consistency.
The latest blocks view doesn't provide as much information as we could
The latest blocks view is rendered by querying the blocks API and sorting by the time in descending order, it paginates the results and allows the user to navigate to older blocks.
When the user is at the 1st page, we keep polling the server for new blocks, when the user is in another page, we don't poll the server for new blocks to avoid inconsistencies while navigating through the pages.
It would be useful to render the value transferred in each block.
The latest blocks API returns the 10 latest blocks only, they are retrieved directly from the xsnd
, hence, there is no pagination.
Update the block API to retrieve a block from the database and fallback to the xsnd.
There are two endpoints for loading a block:
GET /blocks/:query
-> Loads the block data from the database.GET /blocks/:query/legacy
-> Loads the block data from the xsnd.The web-ui tries to load a block from the database, when it isn't present, it tries to load it from the xsnd, a message is displayed if it doesn't exists.
When the 1st method is used, the confirmations field should be computed on the client.
The GET /blocks/:query
loads a block from the block from the xsnd
while we might have it on the database.
The previous_blockhash
column on the blocks
table has invalid data.
The previous_blockhash
column on the blocks
table should point to the previous block unless it is the first block.
At this time, the production database has several corrupted blocks.
The following query return the blocks having an invalid previous_blockhash
:
SELECT height, blockhash, previous_blockhash
FROM blocks b
WHERE 0 = (SELECT COUNT(*) FROM blocks WHERE blockhash = b.previous_blockhash) AND
height > (SELECT MIN(height) FROM blocks);
There are 61 corrupted blocks, all of them seem to be pointing to orphan blocks.
Unknown, it's occurring in prod.
The latest blocks view could be improved.
When there is a new block discovered, we add a small color effect on it to make it simpler to be aware of, example:
When a new block is discovered, we just update the block list with no effects at all.
Go to https://xsnexplorer.io/ and wait for a minute or two to see a new block.
While displaying a transaction, there could be several inputs linked to a single address.
When there are several inputs linked to the same address, the explorer collapses them into a single one, the (2)
being the number of collapsed inputs, this number should not be displayed on single addresses:
From | |
---|---|
address (2) | 30 |
address2 | 50 |
A nice to have would be a way to click on the collapsed row and expand all the values.
Several inputs having the same address are listed in a row per input which is not very user friendly:
From | |
---|---|
address | 10 |
address | 20 |
address2 | 50 |
Go to https://xsnexplorer.io/transactions/92e941c087761afb28abd5e5f202a86e0c3e2fd2cb91748b4c3a5c269694336e
Create a shared component that keeps updating the statistics.
The statistics are being stored in a component that can share the data with other components, it is being updated frequently (each minute should be enough).
A nice to have is to display notifications when there are important changes, like discovering a new block.
Ideally, the statistics view would display its data from this shared component, and it might be worth making it sticky.
The statistics are loaded only on the main view, they aren't updated.
When #23 was developed, we just forwarded the input/output to the xsnd
which requires the addressindex
to work. Sadly, this index doesn't exist anymore on our segwit integration.
We need to update the database schema to store utxo related information and update the endpoint to get the data from the database, please note that the database seeder needs to be updated to keep this information.
After segwit was introduced, the bech32 addresses started to appear, we need to support this format.
The bech32 addresses are just rejected because the format is not supported.
balances
table, an error occurs.It is tricky to deploy the projects, having scripts will avoid initial setup and deployment problems.
There should be 1 script per project to deploy it, probably it is worth having another script to deploy all the projects.
There are files with deployment steps.
There is no simple way to detect breaking API changes from the RPC server.
Before updating the RPC server, run a suite of integration tests that calls the actual RPC server to ensure there are no breaking changes.
There are no tests calling the real RPC server.
While displaying inputs / outputs of a transaction, the total values (sent, received) are not displayed.
The transaction inputs / outputs display the total accumulated value:
From | 80 |
---|---|
address | 10 |
address | 20 |
address2 | 50 |
The total accumulated value from transaction inputs / outputs is not displayed, this makes is not user friendly:
From | |
---|---|
address | 10 |
address | 20 |
address2 | 50 |
Go to https://xsnexplorer.io/transactions/92e941c087761afb28abd5e5f202a86e0c3e2fd2cb91748b4c3a5c269694336e
The next_blockhash
column on the blocks
table has invalid data.
The next_blockhash
column on the blocks
table should point to the next block unless it is the last block.
At this time, the production database has several corrupted blocks.
The following query return the blocks having an invalid next_blockhash
:
SELECT height, blockhash, next_blockhash
FROM blocks b
WHERE 0 = (SELECT COUNT(*) FROM blocks WHERE blockhash = b.next_blockhash) AND
height < (SELECT MAX(height) FROM blocks);
There are 65 corrupted blocks, 3 of them are pointing the next_blockhash
to an orphan block while the rest have null
on the next_blockhash
, there should be at most 1 block having null
on the next_blockhash
(the last one).
Unknown, it's occurring in prod.
Some ideas:
next_blockhash
field from the block
previous to the orphan block, this could explain why there are blocks having the wrong next_blockhash
.next_blockhash
field to the block previous to the new block, this could explain why there are blocks having no next_blockhash
.The database should keep a consistent linear chain where there are no repeated blocks by height and every block exist on the rpc server.
On rare rechain events, the database could get corrupted.
These steps cause the explorer to keep retrying the processing of the block without success, if there was more than 1 block involved in the rechain, we could have blocks until N
in the database, on this rare rechain event, it might process block N - 2
with a hash that is not in the database and the explorer will add it as a missing block, hence, having two blocks with N - 2
as height.
The explorer can process a missing block and then, fill the database backwardly until there is an existing block, let's say, the database contains blocks from 1
to N
and from N + 10
until the latest one, while processing the block N - 9
, it will fill all holes until block N
, the problem is that if block N
is present but the hash doesn't matches the previous blockhash from the block N + 1
, the explorer will insert block N
again.
Some ideas:
Segwit is being integrated to xsnd
, once it is done, the explorer won't be able to process new blocks due to format changes.
The explorer is able to parse segwit blocks and transactions.
There is no segwit support.
The logo is getting stretched, we need to keep it rounded.
The logo is rounded.
Go to https://xsnexplorer.io/
Update the logback.xml to log exceptions root cause first
When an exception is thrown and it has nested causes, the root cause should be the first displayed exception.
When an exception is thrown and it has nested causes, the root cause is not the first displayed exception.
Shutting the xsnd or postgres off and leaving the project running show start displaying exceptions.
The P2WPKH
address format is introduced with segwit, an example is bc1qzhayf65p2j4h3pfw22aujgr5w42xfqzx5uvddt
, all addresses have the same length and they aren't currently supported by the explorer, we need to perform the following changes:
P2WPKH
addresses, this will allow the explorer to seed the segwit blocks / transactions.server
project, this will allow clients to query the API with P2WPKH
addresses.web-ui
, this will allow users to type the P2WPKH
addresses in the finder component.Improvements to the richest addresses view
The view could display a kind of bar on the percentage area, also, rounding the percentages using 2 decimals is enough, the PIVX explorer has this effect:
It might be useful to add a column with the last time the address was involved in a transaction, this could be done here or in #2
The view doesn't display a bar on the percentage of coins, and the percentages have a lot of decimals:
Load the richest addresses tab from https://xsnexplorer.io/
Hide 0 balances from Richest Addresses.
@durkmurder Alex had a great question about this:
"what about addresses that had coins but they are spent?"
Resolve github vulnerability warning on the web-ui project
There is no vulnerability warning on the GitHub project page.
GitHub is displaying a vulnerability warning that seems to be related to the angular build tools.
Some tx gives unexpected errors. Raw data of it loads though.
Shouldn't give any error since it's a valid tx.
Gives unexpected error from the XSN network and TX not found.
Open: http://xsnexplorer.io/transactions/a27b5e0bf7ed19b4d0bd038029a474fef0e4ccb1543544ff7f4263862d3faab7
Raw data loads though.
Running the backend locally is not that simple
The following steps should be enough to run the backend locally:
SeederModule
with another module that doesn't depend on SQS.Running the backend project locally is not that simple, we need the following (at least) which is not that simple (or annoying) for new contributors:
Please list all relevant steps to reproduce the observed behavior.
There are some unnecessary calls on the XSNService.
There shouldn't be unnecessary calls.
After the segwit integration, the addressindex
was removed, leading to some useless calls on the XSNService
, remove them:
def getAddressBalance(address: Address): FutureApplicationResult[rpc.AddressBalance]
def getTransactions(address: Address): FutureApplicationResult[List[TransactionId]]
Integrate the sbt-errors-summary plugin
The sbt-errors-summary plugin is integrated into the server
project.
The sbt-errors-summary is not integrated into the project.
Create the explorerCurrency
pipe that takes a number and renders it our currency symbol
It should be possible to render amounts with this: {{item.value | explorerCurrency}}
Ideally, the currency symbol will be taken from a configuration file.
We use the following approach to render the explorer amounts: {{item.value}} {{'label.coinName' | translate}}
This has several drawbacks like requiring to repeat the translation key on every language.
Currently, the database seeding process is quite flexible, we can fill any block and came back later to fill the holes.
As we are moving away from calls to the xsnd
to retrieve the data and using the database instead, it would be better to guarantee consistency.
Update the seeding process to work linearly only, lets say, block N
can't be added unless block N - 1
is present.
For an unknown reason, the genesis block has a transaction id that can't be retrieved from the xsnd (see X9Developers/XSN#32).
Add a conditional to never load it to be able to see the genesis block into the database.
This allow us to add foreign keys to the previous_blockhash
(see #35).
The test should keep the correct previous_blockhash on rare events
has failed on travis, rerunning the test make it pass.
The test should be stable, hence, never fail.
The test is not stable, travis shows these logs:
[info] - should keep the correct previous_blockhash on rare events *** FAILED ***
[info] Good(NewBlockAppended(Block(000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8,Some(000003fb382f6892ae96594b81aa916a8923c70701de4e7054aac556c7271ef7),Some(00000766115b26ecbc09cd3a3db6870fdaf2f049d65a910eb2f2b48b566ca7bd),67aa0bd8b9297ca6ee25a1e5c2e3a8dbbcc1e20eab76b6d1bdf9d69f8a5356b8,List(67aa0bd8b9297ca6ee25a1e5c2e3a8dbbcc1e20eab76b6d1bdf9d69f8a5356b8),33960,179,2,536870912,1520276299,1520276270,1161702,1e0ffff0,0000000000000000000000000000000000000000000000000000000000300030,0.000244140625,None))) did not equal Good(MissingBlockProcessed(Block(000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8,Some(000003fb382f6892ae96594b81aa916a8923c70701de4e7054aac556c7271ef7),Some(00000766115b26ecbc09cd3a3db6870fdaf2f049d65a910eb2f2b48b566ca7bd),67aa0bd8b9297ca6ee25a1e5c2e3a8dbbcc1e20eab76b6d1bdf9d69f8a5356b8,List(67aa0bd8b9297ca6ee25a1e5c2e3a8dbbcc1e20eab76b6d1bdf9d69f8a5356b8),33960,179,2,536870912,1520276299,1520276270,1161702,1e0ffff0,0000000000000000000000000000000000000000000000000000000000300030,0.000244140625,None))) (BlockEventsProcessorSpec.scala:323)
Hard to reproduce, keep running the test several times until it fails.
As the database seeding will be linear with the schema having strong consistency, we can get rid of the SQS seeder.
This will reduce the deployment complexity.
The explorer doesn't have a way to display a raw block
On the block view, there should be a way to display the raw block.
There is no way to display a raw block.
The address view could be improved.
The address view displays a summary of its balance and then, a paginated list with a summary for each transaction, the list is sorted from newest to oldest, it displays 10 items by default, example:
The address view displays the list of all the transactions which is slow and doesn't help too much because there are no details for the transactions:
Go to https://xsnexplorer.io/addresses/Xx6bteTJSHkzF9v5vfedtWjZygXzhQNRqk
From every block, get the reward amount, the utxo amount and the wait time (time that has passed since that utxo received the last reward).
Calculate and show averages.
In order to integrate hardware wallets, we need a way broadcast a transaction to the network.
Calling POST /api/transactions
with hex
in the JSON request body, will broadcast the hex-encoded transaction to the network.
There is no way to broadcast a transaction to the network.
Please contact Andriy (designer) for links.
As part of today's launch, We should match our rebranded logo.
We are displaying the old logo.
Some user have complained that running the tests is not straightforward on Windows.
The README.md from the server project specifies how to run the tests on Windows.
It is not clear how to run the tests on Windows.
The explorer doesn't have a way to display a raw transaction
On the transaction view, there should be a way to display the raw transaction.
There is no way to display a raw transaction.
In order to integrate hardware wallets, we need a way to get unspent outputs for an address.
Calling GET /api/addresses/:address/utxos
returns all unspent outputs for an address, example from xsnd
:
[
{
"address": "XeNEPsgeWqNbrEGEN5vqv4wYcC3qQrqNyp",
"txid": "ea837f2011974b6a1a2fa077dc33684932c514a4ec6febc10e1a19ebe1336539",
"outputIndex": 0,
"script": "76a914285b6f1ccacea0059ff5393cb4eb2f0569e2b3e988ac",
"satoshis": 1500000000000,
"height": 22451
}
]
There is no way to get that information.
The block view could be improved.
The block view displays a summary, and a paginated list with a summary for each transaction, the list is sorted from newest to oldest, it displays 10 items by default, example:
The block view displays the list of all the transactions which doesn't help too much because there are no details for the transactions:
Go to https://xsnexplorer.io/blocks/95833f1e6a3475a0bf2478865e23a4e731d2f5ccf82883ee9a3d9a9668ee4e24
Create a new endpoint for retrieving a exchange rate in other currencies, like BTC and USD.
We can retrieve the current exchange rate for other currencies.
There is no way to do this.
Ensure that the supplies are computed correctly.
The supplies should not be that different than before with the segwit integration.
At first glance, the supplies seem quite different which is likely to be wrong.
Sync the database and verify the supplies.
Due to one unexpected corner case, the chain in the database was broken
The database chain should be correct, in case it gets broken, it should be temporal and the explorer should recover the correct state.
We rely on the xsnd
to publish a message to SQS each time a new block is discovered, in order to detect rechain events, we expect xsnd
to not swallow any event and publish all of them in the right order.
What happened in prod is that block X
and Y
were appended, then, a rechain occurred and block Y'
was appended while event X
wasn't published as expected, this resulted in two chains where X
is stored instead of X'
:
X
-> Y
X'
-> Y'
Here are the logs displaying this behavior:
2018-06-18 22:26:57,240 [INFO] from com.xsn.explorer.tasks.SQSSeederTask in scala-execution-context-global-60588 - Block processed successfully = 9a35964e2cd2e9bc112654053cb52faf042520285b7ab24c82d59ce814e093de
2018-06-18 22:26:59,105 [INFO] from com.xsn.explorer.processors.BlockEventsProcessor in scala-execution-context-global-60588 - existing latest block = 9a35964e2cd2e9bc112654053cb52faf042520285b7ab24c82d59ce814e093de -> new latest block = 1ccf7a7177c55605deb4089b44e18bc2bd3bc5fa1b358d6727d8450f5c8b0dc0
2018-06-18 22:27:00,103 [INFO] from com.xsn.explorer.tasks.SQSSeederTask in scala-execution-context-global-60588 - Block processed successfully = 1ccf7a7177c55605deb4089b44e18bc2bd3bc5fa1b358d6727d8450f5c8b0dc0
2018-06-18 22:27:46,286 [INFO] from com.xsn.explorer.processors.BlockEventsProcessor in scala-execution-context-global-60601 - Adding possible missing block = e6183988a5c883a199966a5729c737e2133fbab6c59d36a72b3e987cc1f9cb63
2018-06-18 22:27:48,228 [INFO] from com.xsn.explorer.tasks.SQSSeederTask in scala-execution-context-global-60604 - Block processed successfully = e6183988a5c883a199966a5729c737e2133fbab6c59d36a72b3e987cc1f9cb63
This scenario results in a BlockEventsProcessor.ReplacedByBlockHeight
which we can use to trigger the backwards synchronization tasks which will fix the chain.
A
.B
.B'
.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.