Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cmd/puppeth: integrate blockscout #18261

Merged
merged 8 commits into from
Jul 8, 2019

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Dec 9, 2018

This PR integrate an open-source blockchain explorer blockscout into the puppeth.

Now puppeth can provide explorer service for PoA based chain and PoW based chain

@rjl493456442 rjl493456442 force-pushed the integrate-blockscout branch 6 times, most recently from fdd0b10 to adeb320 Compare December 13, 2018 06:36
@rjl493456442 rjl493456442 changed the title [WIP] cmd/puppeth: integrate blockscout cmd/puppeth: integrate blockscout Dec 13, 2018
@5chdn
Copy link
Contributor

5chdn commented Feb 7, 2019

That's pretty cool

@rocammo
Copy link

rocammo commented Feb 27, 2019

It works pretty well and it has a very good interface. Good job!

@hadv
Copy link
Contributor

hadv commented Feb 28, 2019

@rjl493456442 I want to build my own docker but facing this error. Do you have any idea? Thank you!

* Getting absinthe_phoenix (git@github.com:ayrat555/absinthe_phoenix.git)
fatal: cannot run ssh: No such file or directory
fatal: unable to fork
** (Mix) Command "git --git-dir=.git fetch --force --quiet --progress" failed

@rjl493456442
Copy link
Member Author

@hadv It is an upstream issue. I've already opened an issue here blockscout/blockscout#1478

@hadv
Copy link
Contributor

hadv commented Mar 1, 2019

It works pretty well and it has a very good interface. Good job!

yeah, great! Except I cannot run the data node with --ws options. the data node only can sync the data if I disable the web-socket. Otherwise, the data node can only sync some blocks then drop all peers. Any idea, @rjl493456442 ? Thanks!

@rocammo
Copy link

rocammo commented Mar 1, 2019

It works pretty well and it has a very good interface. Good job!

yeah, great! Except I cannot run the data node with --ws options. the data node only can sync the data if I disable the web-socket. Otherwise, the data node can only sync some blocks then drop all peers. Any idea, @rjl493456442 ? Thanks!

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

@hadv
Copy link
Contributor

hadv commented Mar 1, 2019

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

I'm running a private PoA network with some divert then I need to build my own blockscout docker image and I have to remove compile's --warnings-as-errors flag to build the blockscout project also by the way.

@rocammo
Copy link

rocammo commented Mar 1, 2019

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

I'm running a private PoA network with some divert then I need to build my own blockscout docker image and I have to remove compile's --warnings-as-errors flag to build the blockscout project also by the way.

I didn't have any compilation problems when I added it just two days ago and I also compiled it from source, so it's strange that you're having it. Could you please provide the explorer container log by docker logs <containerId> or the compilation errors that you're having?

@hadv
Copy link
Contributor

hadv commented Mar 1, 2019

I didn't have any compilation problems when I added it just two days ago and I also compiled it from source, so it's strange that you're having it. Could you please provide the explorer container log by docker logs <containerId> or the compilation errors that you're having?

I cannot build the docker image with warning as error option

https://github.com/puppeth/blockscout/blob/9af22a89de29c094acc2349cd5b368a5564fe2ee/apps/block_scout_web/mix.exs#L142

@hadv
Copy link
Contributor

hadv commented Mar 1, 2019

@rocammo can you try to run with contract metadata and validator? I enable them but the explorer shutdown out of the blue 😢

if System.get_env("METADATA_CONTRACT") && System.get_env("VALIDATORS_CONTRACT") do
  config :explorer, Explorer.Validator.MetadataRetriever,
    metadata_contract_address: System.get_env("METADATA_CONTRACT"),
    validators_contract_address: System.get_env("VALIDATORS_CONTRACT")

  config :explorer, Explorer.Validator.MetadataProcessor, enabled: true
else
  config :explorer, Explorer.Validator.MetadataProcessor, enabled: false
end

@rjl493456442
Copy link
Member Author

rjl493456442 commented Mar 1, 2019

Btw there is a known issue in the current PR found by @mirooy and @Kimjingoo that now the geth node version in blockscout image is different with the wallet image or some other components. So that there could have a consensus error now if you try to deploy a smart contract.

Have to wait the upstream to fix the build issue and then rebuild the puppeth/blockscout.

@hadv
Copy link
Contributor

hadv commented Mar 2, 2019

Btw there is a known issue in the current PR found by @mirooy and @Kimjingoo that now the geth node version in blockscout image is different with the wallet image or some other components. So that there could have a consensus error now if you try to deploy a smart contract.

Have to wait the upstream to fix the build issue and then rebuild the puppeth/blockscout.

is this the error?


** (FunctionClauseError) no function clause matching in Logger.level_to_number/1
    (logger) lib/logger.ex:536: Logger.level_to_number(:prod)
    (logger) lib/logger.ex:533: Logger.compare_levels/2
    (logger_file_backend) lib/logger_file_backend.ex:33: LoggerFileBackend.handle_event/2
    (stdlib) gen_event.erl:577: :gen_event.server_update/4
    (stdlib) gen_event.erl:559: :gen_event.server_notify/4
    (stdlib) gen_event.erl:300: :gen_event.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:debug, #PID<0.499.0>, {Logger, ["QUERY", 32, "OK", "", [32, "db", 61, '1.5', 109, 115], [], [], 10, "commit", 32, "[]"], {{2019, 3, 2}, {3, 11, 47, 758}}, [pid: #PID<0.1086.0>, ansi_color: :magenta, line: 50, function: "log/3", module: Ecto.LogEntry, file: "lib/ecto/log_entry.ex", application: :ecto, transaction_id: 1991, import_id: 1959, block_number: 135, fetcher: :block_realtime]}}
State: %{format: [:time, " ", :metadata, "[", :level, "] ", :message, "\n"], inode: nil, io_device: nil, level: :prod, metadata: [], metadata_filter: [fetcher: :failed_created_addresses], name: :failed_contract_creations, path: "/opt/app/logs/prod/indexer/failed_contract_creations.log", rotate: nil}
2019-03-02T03:11:47.786 application=indexer [info] refetch from consensus was found on block (60). A reorg initiated.
2019-03-02T03:11:47.800 [error] GenServer #PID<0.1186.0> terminating
** (stop) {:EXIT, {:function_clause, [{Logger, :level_to_number, [:prod], [file: 'lib/logger.ex', line: 536]}, {Logger, :compare_levels, 2, [file: 'lib/logger.ex', line: 533]}, {LoggerFileBackend, :handle_event, 2, [file: 'lib/logger_file_backend.ex', line: 33]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 577]}, {:gen_event, :server_notify, 4, [file: 'gen_event.erl', line: 559]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 300]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}
Last message: {:gen_event_EXIT, {LoggerFileBackend, :failed_contract_creations}, {:EXIT, {:function_clause, [{Logger, :level_to_number, [:prod], [file: 'lib/logger.ex', line: 536]}, {Logger, :compare_levels, 2, [file: 'lib/logger.ex', line: 533]}, {LoggerFileBackend, :handle_event, 2, [file: 'lib/logger_file_backend.ex', line: 33]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 577]}, {:gen_event, :server_notify, 4, [file: 'gen_event.erl', line: 559]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 300]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}
State: {Logger, {LoggerFileBackend, :failed_contract_creations}}

@hadv
Copy link
Contributor

hadv commented Mar 2, 2019

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

I'm running a private PoA network with some divert then I need to build my own blockscout docker image and I have to remove compile's --warnings-as-errors flag to build the blockscout project also by the way.

I didn't have any compilation problems when I added it just two days ago and I also compiled it from source, so it's strange that you're having it. Could you please provide the explorer container log by docker logs <containerId> or the compilation errors that you're having?

This is exactly the problem I have and they provide a work around for it

blockscout/blockscout#1391

@hadv
Copy link
Contributor

hadv commented Mar 2, 2019

It works pretty well and it has a very good interface. Good job!

yeah, great! Except I cannot run the data node with --ws options. the data node only can sync the data if I disable the web-socket. Otherwise, the data node can only sync some blocks then drop all peers. Any idea, @rjl493456442 ? Thanks!

the docker container shutdown suddenly if connect to local rpc/ws endpoint. If I connect to other endpoint it's okay. Seems problem due to running every things on the same docker container

echo '(cd ../etherchain-light && npm start &)' >> explorer.sh && \
echo 'exec /parity/parity --chain=/chain.json --port={{.NodePort}} --tracing=on --fat-db=on --pruning=archive' >> explorer.sh
echo 'geth --cache 512 init /genesis.json' > explorer.sh && \
echo $'exec geth --networkid {{.NetworkID}} --syncmode "full" --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" &' >> explorer.sh && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should enable debug rpc api to reading smart contract & internal transaction

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I added it in my local and haven't pushed it. Thanks for catching!

echo '(cd ../etherchain-light && npm start &)' >> explorer.sh && \
echo 'exec /parity/parity --chain=/chain.json --port={{.NodePort}} --tracing=on --fat-db=on --pruning=archive' >> explorer.sh
echo 'geth --cache 512 init /genesis.json' > explorer.sh && \
echo $'exec geth --networkid {{.NetworkID}} --syncmode "full" --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" &' >> explorer.sh && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to allow user to specify which geth node they want to connect to other than always using localhost

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My original idea is: this embedded geth node is only available for blockscout. Probably if a user wants to connect to a geth node, then they can deploy a new node somehow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a good idea. by the way, when I running embedded geth node the docker container suddenly shutdown. I might be wrong somewhere but still dont know the reason but when connect to outside node, it worked properly without any problem.

infos.dbdir = w.readString()
} else {
fmt.Printf("Where should postgres data be stored on the remote machine? (default = %s)\n", infos.dbdir)
infos.dbdir = w.readDefaultString(infos.datadir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo seems

Suggested change
infos.dbdir = w.readDefaultString(infos.datadir)
infos.dbdir = w.readDefaultString(infos.dbdir)

@rjl493456442 rjl493456442 force-pushed the integrate-blockscout branch from adeb320 to 575bdeb Compare March 5, 2019 07:50
@rjl493456442
Copy link
Member Author

Fix the blockscout docker image and now it can work in the clique mode. Yeah

image

@rjl493456442 rjl493456442 added this to the 1.9.0 milestone Apr 4, 2019
@rjl493456442 rjl493456442 force-pushed the integrate-blockscout branch from 575bdeb to cf226af Compare April 11, 2019 03:17
@rjl493456442
Copy link
Member Author

Now the upstream project is much stabler. Appreciate for the support from @ayrat555 and I think this PR is review ready :))

@karalabe karalabe force-pushed the integrate-blockscout branch from 34fd1c8 to 54e3937 Compare July 8, 2019 16:14
@karalabe karalabe merged commit 16e3136 into ethereum:master Jul 8, 2019
@kant777
Copy link

kant777 commented Nov 11, 2023

How to run blockscout after this integration?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants