Coder Social home page Coder Social logo

nebulasio / explorer Goto Github PK

View Code? Open in Web Editor NEW
107.0 36.0 87.0 9.85 MB

Block Explorer of Nebulas

Home Page: https://explorer-flame.vercel.app

License: GNU Lesser General Public License v3.0

PHP 34.75% HTML 1.39% CSS 3.65% JavaScript 44.70% Shell 0.01% Java 8.09% Vue 7.29% Dockerfile 0.01% TSQL 0.11%
nebulas blockchain explorer

explorer's Introduction

Nebulas Blockchain Explorer

A Java web app for users to explore and analyze the nebulas blockchain.

Its frontend is a single page application using vuejs and its backend uses Spring.

Please visit https://explorer.nebulas.io/ to view all data in Nebulas.

Design Overview

Nebulas Explorer Design Overview

Explorer Frontend

It's a web app using vuejs serves as the presentation layer for the nebulas blockchain explorer.

More details at https://github.com/nebulasio/explorer/blob/develop/explorer-front/readme.md.

Explorer Backend

  1. Data access REST APIs

Exposes the REST APIs for frontend to get blockchain data.

  1. Data Loader

Loads the blockchain data from Nebulas Node and transform and store the data in a way the frontend can consume.

MySQL

Data Storage for the loaded and transformed data.

Nebulas Node

The explorer make RPCs to Nebulas nodes remote endpoints to load the blockchain data.

How to Contribute

Decide what to do

As a beginner, you may want to pick an issue from issues with help wanted or good first issue tag and make a pull request for your changes.

After being more familiar with the explorer and the code, you can submit improvement ideas and work on those ideas.

Git workflow

Step 1: Clone git repo to your local

You can clone https://github.com/nebulasio/explorer.git and commit to it if you are a key contributor.

git clone https://github.com/nebulasio/explorer.git

Or you can fork git clone https://github.com/nebulasio/explorer.git and clone your forked repo.

Step 2: Make some changes

  1. Create a new branch for your change, use prefix "hotfix/" for bug fix, "feature/" for feature.
  2. Make the change and commit with good commit message

Step 3: Get the change merged

  1. Push your local changes to remote repo
  2. Create the pull request if you are using forked repo
  3. Address review feedback and get the change merged

Environment Setup

Run the explorer frontend locally

Step 1: Install Node.js

  1. Install lastest node.js so you can execute 'npm' command by either downloading zip or installer from https://nodejs.org/en/download/ or via package manager

Step 2: Build and Run

# install dependency
cd explorer/explorer-front
npm i

# run webpack dev build on localhost
npm run dev

# open http://localhost:8080/ in browser
# config port number in explorer-front/config/index.js!dev.port

# run webpack production build, results will output to 'dist' folder
npm run build

Run explorer backend locally

Step 1: Install JDK 8, MySQL and Redis

Step 2: Build, Run and Stop

cd explorer/explorer-backend
source build-expl.sh
source start-expl.sh
source stop-expl.sh

License

The Nebulas explorer uses LGPL license

explorer's People

Contributors

15010159959 avatar 1c7 avatar brandonbevans avatar fbzhong avatar fzxa avatar includeleec avatar jaymansfield avatar joelwangusa avatar kemicza avatar luoam avatar nebulashub avatar qywang2012 avatar raphaelfeng avatar smalloranges avatar wanghn avatar xiwangzishi avatar yanxisir avatar yupnano avatar yuxizhe avatar yuzhouwww 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  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  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

explorer's Issues

Directly linking to tx routes user to 404 page

Hey guys - looking to start contributing to this project. Yes, I believe....

Anyway, the block explorer will 404 if you try to visit a transaction ID directly, in a new tab.

Repro steps: right click this url and click 'open in new tab'

https://explorer.nebulas.io/#/tx/04f37719b8f00b70a0b20b4127770d113b8780772739b2617c031c21fd2198ff

that is the txID of the genesis transaction that has the manifesto. Seems like theres some routing issues going on. Side note - do you guys need help making a more "nebulas" 404 page? this one is very 90's

Thanks for the hard work

Typos and color misconfiguration

There are a few typos scattered around the explorer, and NAS isn't always capitalized as I believe it should be.
Additionally, the green / red colors when the NAS price is up/down for the day is switched.

Multi-dimensional charts show nebulas information

At explorer version 1.0.0 (tag: explorer-tag-1.0.0), we only show the basic information of block、transaction and address。It is just a one-dimensional description of the nebula chain data information, we should fit the data from different dimensions, so we need a lot of different charts to show the nebula chain data

Gaslimit

How I can increase my nasnano wallet gaslimit 2000000?? ff462ac6cd3eaa85c6f80101fd97bebf3dbcece4e386a7348bf029662ac99645

同步区块的时候timestamp异常

14:46:00.221 INFO  [subscribe] - neb state: {"chainId":1,"protocolVersion":"/neb/1.0.0","tail":"fee9aa34652867c205621c923c87ff3320dc00746ee98c4f64edff2e8d1a04b4","version":"1.0.1"}
14:46:00.449 INFO  [subscribe] - top block: {"chainId":1,"coinbase":"n1dZZnqKGEkb1LHYsZRei1CH6DunTio1j1q","eventsRoot":"55ff21fb45f78608728ad157f2bb61f6d4c2ffce711f12246222dac8bd10ec92","hash":"fee9aa34652867c205621c923c87ff3320dc00746ee98c4f64edff2e8d1a04b4","height":411105,"miner":"n1Pv2z4fB8BfpvY2k9NYL6vJbqTp78pQNZj","nonce":0,"parentHash":"880d87e1c0b0bc1005ee85785b2320575590970de3509cf60dfa1aad1e6157a8","stateRoot":"e10015d8b747d6e677d8d22354bcdf35bbe3578cfc4a3445f47bec1b5562ae35","timestamp":1528555545,"transactions":[{"chainId":0,"contractAddress":"","from":"","gasLimit":"","gasPrice":"","gasUsed":"","hash":"e2b629ba57bcd012aba63953cf115bed4b78045405160719eb105348fb7a1c9c","nonce":0,"status":0,"timestamp":0,"to":"","type":"","value":""},{"chainId":0,"contractAddress":"","from":"","gasLimit":"","gasPrice":"","gasUsed":"","hash":"d6367017e3cf412584887c358add2321d0789fe462a8495603e066258b1d70ea","nonce":0,"status":0,"timestamp":0,"to":"","type":"","value":""},{"chainId":0,"contractAddress":"","from":"","gasLimit":"","gasPrice":"","gasUsed":"","hash":"6394dfa26459dcdc217f03cd081667d7cb9ba9638a441039955521e37488c271","nonce":0,"status":0,"timestamp":0,"to":"","type":"","value":""}],"txsRoot":"050b53b984b4f90f4baf98f7009395e835281d4cdf98a0a7a17b2381546ded04"}
14:46:00.920 INFO  [subscribe] - save tx=27df67525154fc1c30f91e691b0ce6ab56b9c8bbd951ea636350b9c29151c7cc
14:46:00.924 ERROR [subscribe] - 
### Error updating database.  Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
### The error may involve io.nebulas.explorer.mapper.NebTransactionMapper.addNebTransaction-Inline
### The error occurred while setting parameters
### SQL: replace INTO `neb_transaction` (`hash`, `block_hash`, `block_height`, `tx_seq`, `from`, `to`, `status`, `value`,`nonce`, `timestamp`, `type`, `data`, `gas_price`, `gas_limit`, `gas_used`, `created_at`)         VALUES         (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
; SQL []; Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
org.springframework.dao.DataIntegrityViolationException: 
### Error updating database.  Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
### The error may involve io.nebulas.explorer.mapper.NebTransactionMapper.addNebTransaction-Inline
### The error occurred while setting parameters
### SQL: replace INTO `neb_transaction` (`hash`, `block_hash`, `block_height`, `tx_seq`, `from`, `to`, `status`, `value`,`nonce`, `timestamp`, `type`, `data`, `gas_price`, `gas_limit`, `gas_used`, `created_at`)         VALUES         (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
; SQL []; Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
	at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:102)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:82)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:82)
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
	at com.sun.proxy.$Proxy77.insert(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:57)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
	at com.sun.proxy.$Proxy81.addNebTransaction(Unknown Source)
	at io.nebulas.explorer.service.blockchain.NebTransactionService.addNebTransaction(NebTransactionService.java:43)
	at io.nebulas.explorer.jobs.DataConsensusJob.syncBlock(DataConsensusJob.java:165)
	at io.nebulas.explorer.jobs.DataConsensusJob.check(DataConsensusJob.java:107)
	at sun.reflect.GeneratedMethodAccessor142.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
	at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '50399-12-04 14:56:48' for column 'timestamp' at row 1
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3971)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2487)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
	at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
	... 21 common frames omitted

wrong address

Sent purchased NAS tokens from Binance to nebulas address instead of into my nebulas wallet. How can I claim them?

Subscribed events may be lost

Subscribed events can not be trusted, sometimes it may be lost event, so we should have a pull method to get the latest block.

No scroll bar to find in the explorer

This is my first time to enter the NAS explorer, but unfortunately I cannot find the scroll bar to continue to view the rest of the information in the bottom of the web page, I'm not sure whether it is the bug in some condition, hope developer could fix this issue

Can't find NAS account using Explorer

I created a new NAS wallet using the web wallet download. I can't find my address using the explorer.

I see two issues:

  1. There is no search function to allow me to enter my address and search.
  2. My only option is to click on an existing address and change the URL to use my public address instead. This isn't good usability. However, I get a page not found error.

I would expect that I could visit: https://explorer.nebulas.io/#/address/myaddress
But... This does not work. This gives me a 404 error. Do I need to make a deposit to the address before it will show as valid? This is not the behavior that I would expect.

it is slow to synchronize block

we use a single thread to process grpc subscribe event, so sometimes it is slow to synchronize block which has too many transactions.

Add a expiry time for `pending tx`

The lifecycle of a tx is:
created -> pending -> packed in block or reject from LRU cache

So it's not easy to identify whether a pending tx is pending or not. So, I'd suggest we add expiry time in Explorer to auto cleanup expired pending tx.

The value of expiry could be 48h for production, 1h for development.

time ago calc bug

timeConversion(Date.now() - tx.timestamp) 计算时间这里是直接取本地时间对比的,但是不同电脑时间可能不一样就会导致计算结果异常。

貌似应该用接口返回数据中的currentTimestamp字段去对比时间差
timeConversion(currentTimestamp - tx.timestamp)

原代码位置: tx.vue txs.vue

{{ timeConversion(Date.now() - tx.timestamp) }} ago ({{ new Date(tx.timestamp).toString() }} | {{ tx.timestamp }})

bufg

Smart Contract Address Loading Issue: the new feature view smart contract on contract address page fixed.

Hi,

In development circle, I found that the example page https://explorer.nebulas.io/#/address/n1gDfiiQLEBu95xDWHGxNi4qToyXjD2vE4D's View Smart Contract router-link is low speed than other and it need to load more than 2 seconds until the whole page loaded.

To demonstrate the problem, let's see the code:

135  <span v-if="contractHash">
136       <router-link class="btn btn-link" v-bind:to='fragApi + "/tx/"+contractHash'>View Smart Contract</router-link>
137  |</span>

305 urlChange() {
306               this.contractHash = ""

311 api.getTransactionByContract({ address: o.address.hash }, this.$route.params.api, (transaction) => {
312      var transaction = JSON.parse(transaction)
313      this.contractHash = transaction.result.hash
314  })

322  data() {
323      return {
324          contractHash: "",

I addressed this problem by adding contract data:
contract: null,
And pack tx result to contract data:
this.contract = transaction.result
The if condition:

<span v-if="obj.address.type">
      <router-link class="btn btn-link" v-bind:to='fragApi + "/tx/"+ contract.hash'>View Smart Contract</router-link>
|</span>

Lastly, removing the unnecessary contractHash, I've passed successfully on the above page.
This is the mainnet issue, please be aware.

The balance of account update strategy

Now, the balance is cached in database, it can be update only when some one view the page of address detail, this strategy is highly delayed, we need a more timely update strategy.

CI(Continuous integration) task

When someone submitted the code was merged into the master branch, should be able to go automatically deployed to the server,so we need write a automatic deployment task deploy code

Search by tx hash does not work

Try searching any tx hash in the search box and no transaction is returned.
The search http request return 500.
But in RpcController's search method, it is querying the transaction too, so it should be able to support search by tx hash.

Build-Error

Why i need install such deps:
"jssha": "^2.3.1",
"keccak": "^1.4.0",
"protobufjs": "^6.8.4",
"scryptsy": "^2.0.0",
"secp256k1": "^3.5.0",
"serve-favicon": "~2.4.5",
"xmlhttprequest": "^1.8.0",
"bignumber": "^1.1.0"
when i run the nasWallet on master.

Weird timestamps in Testnet

Hello Guys,

im playing around on my first dApp in Testnet. I deployed the smart contract and was able to send in some data. But 2 of the transactions have wierd timestamps.

If you look at the smart contract addresse here: https://explorer.nebulas.io/#/testnet/address/n1wuEjThnWh6PDnP4o3dhsCXpT6hF3P9vVS

you can see that the TXs

https://explorer.nebulas.io/#/testnet/tx/81e646c0af35921f3722ae5466e367500db11ff789ef161e2545dd90fd7a7412
https://explorer.nebulas.io/#/testnet/tx/e00033a3ca41be75f74e3f51e1d1b0045392d5ac4d7895466e8c4e6a115cb780

are somehow off with their time stamp.

The first transaction on the SC was made manualle via the local webwallet to test. All the other transactions were made via the inferface.

un irreversible block can be reversible

when block is not irrenversible, it may be reversible and transactions resend to transaction pool. so when a block reaches an irreversible state, all of blocks which height less than irrenversible block and they are not irrenversible, should get data again through rpc interface.

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.