hyperledger / besu

An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
https://www.hyperledger.org/projects/besu
Apache License 2.0
1.48k stars 804 forks source link

Run Besu with changes, using Docker and Kubernetes #5775

Open Abolfazlak opened 1 year ago

Abolfazlak commented 1 year ago

How can I create an Image of besu core with my own changes, then run this network? I have already added the relevant changes to the code and now I am having trouble with creating docker image and running it.

Abolfazlak commented 1 year ago

I clone Hyperledger Besu code from repo. then I changed hashing algorithm of pow from keccak to acson. then I need to run this code and create some nodes but I'm in trouble with run and create docker image of this code to run network. how can I create an image and then using of it?

non-fungible-nelson commented 1 year ago

Hi there - we have a graldetask that should work for this - can you try:

./gradlew distDocker in your Besu directory. This needs to be done at the top level /besu

Let me know if this answers your question. There might be more info that is useful here: https://wiki.hyperledger.org/display/BESU/Building+from+source

garyschulte commented 1 year ago

To add to @non-fungible-nelson 's answer, distDocker is the correct task, but it is going to build images as hyperledger/besu:[variant]-[version] which you will not be able to publish to dockerhub.

An easy way to build images that are for a different docker repo you can publish to (for kubernetes usage, for example) you can pass a couple extra gradle parameters:

So, for example to build images for abolfazlak/my-super-besu you can use:

./gradlew -PdockerOrgName=abolfazlak -PdockerArtifactName=my-super-besu distDocker

Like that you can target a docker repository you can publish to.

Abolfazlak commented 1 year ago

thanks. after running this command it gives me 7 images. what should I do for creating some nodes or adding some transactions?

Screenshot 2023-08-26 at 1 16 45 AM
Abolfazlak commented 1 year ago

@non-fungible-nelson @garyschulte could you please help me?

garyschulte commented 1 year ago

@non-fungible-nelson @garyschulte could you please help me?

This guide uses the main besu docker images , but should help you become more familiar with how to start and run a blockchain https://besu.hyperledger.org/stable/private-networks/tutorials/quickstart

Once you have an idea how it works, starting up my-super-besu can be as simple as running

docker run abolfazlak/my-super-besu:23.7.2-SNAPSHOT

Abolfazlak commented 1 year ago

when I run this command it will return: {"gasUser":"0x0","timens":212958,"time":212,"gasTotal":"0x0","output":"0x"} and finished.