Luke Imhoff
ee90f2d692
|
6 years ago | |
---|---|---|
.circleci | 6 years ago | |
apps | 6 years ago | |
bin | 6 years ago | |
config | 7 years ago | |
.credo.exs | 6 years ago | |
.dialyzer-ignore | 7 years ago | |
.formatter.exs | 7 years ago | |
.gitignore | 6 years ago | |
.pairs | 7 years ago | |
.tool-versions | 6 years ago | |
CODE_OF_CONDUCT.md | 7 years ago | |
CONTRIBUTING.md | 6 years ago | |
ISSUE_TEMPLATE.md | 7 years ago | |
LICENSE | 7 years ago | |
PULL_REQUEST_TEMPLATE.md | 6 years ago | |
README.md | 6 years ago | |
appspec.yml | 7 years ago | |
coveralls.json | 6 years ago | |
explorer_example.gif | 6 years ago | |
mix.exs | 6 years ago | |
mix.lock | 6 years ago |
README.md
BlockScout
BlockScout provides a comprehensive, easy-to-use interface for users to view, confirm, and inspect transactions on all EVM (Ethereum Virtual Machine) blockchains. This includes the Ethereum main and test networks as well as Ethereum forks and sidechains.
Following is an overview of the project and instructions for getting started.
About BlockScout
BlockScout is an Elixir application that allows users to search transactions, view accounts and balances, and verify smart contracts on the entire Ethereum network including all forks and sidechains.
Currently available block explorers (i.e. Etherscan and Etherchain) are closed systems which are not independently verifiable. As Ethereum sidechains continue to proliferate in both private and public settings, transparent tools are needed to analyze and validate transactions.
The first release will include a block explorer for the POA core and Sokol test networks. Additional networks will be added in upcoming versions.
Features
Development is ongoing. Please see the project timeline for projected milestones.
-
Open source development: The code is community driven and available for anyone to use, explore and improve.
-
Real time transaction tracking: Transactions are updated in real time - no page refresh required. Infinite scrolling is also enabled.
-
Smart contract interaction: Users can read and verify Solidity smart contracts and access pre-existing contracts to fast-track development. Support for Vyper, LLL, and Web Assembly contracts is in progress.
-
Token support: Version 1 supports ERC20 and ERC721 tokens. Future releases will support additional token types including ERC223 and ERC1155.
-
User customization: Users can easily deploy on a network and customize the Bootstrap interface.
-
Ethereum sidechain networks: Version 1 supports the POA main network and Sokol test network. Future iterations will support Ethereum mainnet, Ethereum testnets, forks like Ethereum Classic, sidechains, and private EVM networks.
Getting Started
We use Terraform to build the correct infrastructure to run BlockScout. See https://github.com/poanetwork/blockscout-terraform for details.
Requirements
The development stack page contains more information about these frameworks.
- Erlang/OTP 21.0.4
- Elixir 1.7.1
- Postgres 10.3
- Node.js 10.5.0
- Automake
- For Mac OSX users:
brew install automake
- For Mac OSX users:
- Libtool
- For Mac OSX users:
brew install libtool
- For Mac OSX users:
- GitHub for code storage
Build and Run
-
Clone the repository.
git clone https://github.com/poanetwork/blockscout
-
Go to the explorer subdirectory.
cd blockscout
-
Set up default configurations.
cp apps/explorer/config/dev.secret.exs.example apps/explorer/config/dev.secret.exs
cp apps/block_scout_web/config/dev.secret.exs.example apps/block_scout_web/config/dev.secret.exs
Optional: Set up default configuration for testing.
cp apps/explorer/config/test.secret.exs.example apps/explorer/config/test.secret.exs
Example usage: Changing the default Postgres port from localhost:15432 if Boxen is installed. -
Install dependencies.
mix do deps.get, local.rebar --force, deps.compile, compile
-
Create and migrate database.
mix ecto.create && mix ecto.migrate
Note: If you have run previously, drop the previous database
mix do ecto.drop, ecto.create, ecto.migrate
-
Install Node.js dependencies.
cd apps/block_scout_web/assets && npm install; cd -
cd apps/explorer && npm install; cd -
-
Start Phoenix Server.
mix phx.server
Now you can visit localhost:4000
from your browser.
Additional runtime options:
-
Run Phoenix Server with IEx (Interactive Elixer)
iex -S mix phx.server
-
Run Phoenix Server with real time indexer
DEBUG_INDEXER=1 iex -S mix phx.server
BlockScout Visual Interface
Umbrella Project Organization
This repository is an umbrella project. Each directory under apps/
is a separate Mix project and OTP application, but the projects can use each other as a dependency in their mix.exs
.
Each OTP application has a restricted domain.
Directory | OTP Application | Namespace | Purpose |
---|---|---|---|
apps/ethereum_jsonrpc |
:ethereum_jsonrpc |
EthereumJSONRPC |
Ethereum JSONRPC client. It is allowed to know Explorer 's param format, but it cannot directly depend on :explorer |
apps/explorer |
:explorer |
Explorer |
Storage for the indexed chain. Can read and write to the backing storage. MUST be able to boot in a read-only mode when run independently from :indexer , so cannot depend on :indexer as that would start :indexer indexing. |
apps/block_scout_web |
:block_scout_web |
BlockScoutWeb |
Phoenix interface to :explorer . The minimum interface to allow web access should go in :block_scout_web . Any business rules or interface not tied directly to Phoenix or Plug should go in :explorer . MUST be able to boot in a read-only mode when run independently from :indexer , so cannot depend on :indexer as that would start :indexer indexing. |
apps/indexer |
:indexer |
Indexer |
Uses :ethereum_jsonrpc to index chain and batch import data into :explorer . Any process, Task , or GenServer that automatically reads from the chain and writes to :explorer should be in :indexer . This restricts automatic writes to :indexer and read-only mode can be achieved by not running :indexer . |
CircleCI Updates
To monitor build status, configure your local CCMenu with the following url: https://circleci.com/gh/poanetwork/blockscout.cc.xml?circle-token=f8823a3d0090407c11f87028c73015a331dbf604
Testing
Requirements
- PhantomJS (for wallaby)
Running the tests
-
Build the assets.
cd apps/block_scout_web/assets && npm run build; cd -
-
Format the Elixir code.
mix format
-
Run the test suite with coverage for whole umbrella project.
mix coveralls.html --umbrella
-
Lint the Elixir code.
mix credo --strict
-
Run the dialyzer.
mix dialyzer --halt-exit-status
-
Check the Elixir code for vulnerabilities.
cd apps/explorer && mix sobelow --config; cd -
cd apps/block_scout_web && mix sobelow --config; cd -
-
Lint the JavaScript code.
cd apps/block_scout_web/assets && npm run eslint; cd -
-
Test the JavaScript code.
cd apps/block_scout_web/assets && npm run test; cd -
Variant and Chain
By default, mox
will be used to mock the EthereumJSONRPC.Transport
and EthereumJSONRPC.HTTP
behaviours. They mocked behaviours returns differ based on the EthereumJSONRPC.Variant
.
EthereumJSONRPC.Variant |
EthereumJSONRPC.Transport |
EthereumJSONRPC.HTTP |
url |
Command | Usage(s) |
---|---|---|---|---|---|
EthereumJSONRPC.Parity |
EthereumJSONRPC.Mox |
EthereumJSONRPC.HTTP.Mox |
N/A | mix test |
Local, circleci/config.yml test_parity_mox job |
EthereumJSONRPC.Parity |
EthereumJSONRPC.HTTP |
EthereumJSONRPC.HTTP.HTTPoison |
https://trace-sokol.poa.network |
ETHEREUM_JSONRPC_VARIANT=EthereumJSONRPC.Parity ETHEREUM_JSONRPC_TRANSPORT=EthereumJSONRPC.HTTP ETHEREUM_JSONRPC_HTTP=EthereumJSONRPC.HTTP.HTTPoison ETHEREUM_JSONRPC_HTTP_URL=https://sokol-trace.poa.network mix test --exclude no_parity |
.circleci/config.yml test_parity_http job |
EthereumJSONRPC.Geth |
EthereumJSONRPC.Mox |
EthereumJSONRPC.HTTP.Mox |
N/A | ETHEREUM_JSONRPC_VARIANT=EthereumJSONRPC.Geth mix test --exclude no_geth |
.circleci/config.yml test_geth_http job |
EthereumJSONRPC.Geth |
EthereumJSONRPC.HTTP |
EthereumJSONRPC.HTTP.HTTPoison |
https://mainnet.infura.io/8lTvJTKmHPCHazkneJsY |
ETHEREUM_JSONRPC_VARIANT=EthereumJSONRPC.Geth ETHEREUM_JSONRPC_TRANSPORT=EthereumJSONRPC.HTTP ETHEREUM_JSONRPC_HTTP=EthereumJSONRPC.HTTP.HTTPoison ETHEREUM_JSONRPC_HTTP_URL=https://mainnet.infura.io/8lTvJTKmHPCHazkneJsY mix test --exclude no_geth |
.circleci/config.yml test_geth_http job |
API Documentation
To view Modules and API Reference documentation:
- Generate documentation.
mix docs
- View the generated docs.
open doc/index.html
Internationalization
The app is currently internationalized. It is only localized to U.S. English. To translate new strings.
- To setup translation file.
cd apps/block_scout_web; mix gettext.extract --merge; cd -
- To edit the new strings, go to
apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
.
Acknowledgements
We would like to thank the EthPrize foundation for their funding support.
Contributing
See CONTRIBUTING.md for contribution and pull request protocol. We expect contributors to follow our code of conduct when submitting code or comments.
License
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.