harmony-one / bounties

Bounty program is to help the community take part in the development of the Harmony blockchain. It covers from core feature to validator tooling, from dApp development to DeFi integration.
MIT License
59 stars 23 forks source link

Ganache support #2

Closed LeoHChen closed 3 years ago

LeoHChen commented 3 years ago

Description

This bounty is to support Ganache for Harmony blockchain.

Context

Ganache is widely used for dApp developers to test smart contracts locally for fast iteration w/o interaction with testnet. Since Harmony has full Ethereum RPC compatibility and EVM compatibility support, it should be possible to support a Ganache fork for Harmony blockchain.

Acceptance Criteria

Reward

USD 2,500 equivalent amount of Harmony ONE token

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 10065.8979 ONE (1988.14 USD @ $0.2/ONE) attached to it.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 10065.8979 ONE (1974.84 USD @ $0.2/ONE) has been submitted by:


gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 2 months from now. Please review their action plans below:

1) luisantoniocrag has started work.

Integrate Harmony to Ganache 2) publicviewtoken has started work.

Harmony One Dapp Starter Kit

kit for devs to get starter working on making a dapp with harmony one. -doc file on how to install the kit and how to use it. -video for the project -simple Dapp example using truffle ganache

Learn more on the Gitcoin Issue Details page.

nikbhintade commented 3 years ago

hey @LeoHChen, can you explain the last acceptance criteria?

This one. Does this mean a truffle box for harmony? If there are any other prebuilt images of another blockchain, can you share them?

LeoHChen commented 3 years ago

@nikbhintade , thanks for your question and interest.

There is already a harmony box created in truffle box after I created this bounty, https://www.trufflesuite.com/boxes/harmony-box

Have you tried to deploy local network of Harmony? With Ganache, I'd like to see the transaction records on harmony local net via Ganache interface.

GabrielNicolasAvellaneda commented 3 years ago

@LeoHChen I understand exactly what you want and why nobody made it yet. I looked into the Ganache internals and tried some stuff. What you want is actually to create a Ganache integratoin as this is not just pointing the JSON RPC client to the localnet. Today Ganache has integration for Ethereum, Filecoin and CORDA all work very different.

So the goal here is to:

  1. Fork Ganache
  2. Update to run a localnet hmy as a child process when you click "Quickstart Harmony one"
  3. Create an integration that interacts with localnet. This will be based on the eth integration.
  4. Automatically create accounts and see transactions in the Ganache UI (truffle is another integration but should work wihtout changes)
  5. Use the one coin
  6. After the work is done we should pull request into Ganache main repo.

The UI will look like this: example

Now, as this will take a good amount of time and effort, do you think you can review the bounty prize? Confirming this we have a deal. Thanks!

LeoHChen commented 3 years ago

@GabrielNicolasAvellaneda , I think you have elaborated the goals of this bounty very well! Thanks for your insightful comments. I am not an expert of Ganache myself but I think what you have described matches my thinking. Harmony supports a local net setup with multiple local nodes, either one shard or two shards. We usually start localnet to test changes. Ganache will be a nice frontend to interact with our local net. I think I can up the ante of this bounty to US$2,500 if you can work on it. After all, we have a full ethereum compatible blockchain. You need to have some deep dive into how Ganache works.

GabrielNicolasAvellaneda commented 3 years ago

@GabrielNicolasAvellaneda , I think you have elaborated the goals of this bounty very well! Thanks for your insightful comments. I am not an expert of Ganache myself but I think what you have described matches my thinking. Harmony supports a local net setup with multiple local nodes, either one shard or two shards. We usually start localnet to test changes. Ganache will be a nice frontend to interact with our local net. I think I can up the ante of this bounty to US$2,500 if you can work on it. After all, we have a full ethereum compatible blockchain. You need to have some deep dive into how Ganache works.

@LeoHChen Glad to hear this. We have a deal. Thanks for the additional information. I will keep you updated. Thanks!

GabrielNicolasAvellaneda commented 3 years ago

@LeoHChen I already started working on the Ganache integration. I've found Ganache pretty buggy but it's not a big deal. I started from the develop branch which is the main branch but I decided to start over but with the beta branch which is for the next release, this way the merge will be easier and we will have more changes that they will accept the integration as official. That's all for now.

LeoHChen commented 3 years ago

any update or help needed @GabrielNicolasAvellaneda ?

GabrielNicolasAvellaneda commented 3 years ago

Hey @LeoHChen I've got the harmony blockchain to work with Ganache as we want but still I need to complete the integration. I used the harmony-test blockchain for this test and there are some things that I need to figure out yet. Something that could be helpful is if you can point me to some example of how I can set a genesis configuration for the localnet to set a list of accounts instead of using the ones that are set in the harmony-test project (which are the faucet and other ones used for testing but I would like to set a different set of accounts instead). Basically I would like to configure the localnet like you do with geth where you set the alloc property in the genesis file with the set of accounts that you want. Do we have something like that? Another thing that can help is if there is a way to not produce a block every 2 seconds but instead as demand when a transaction needs to be validated. Geth also has this option and this is useful to not show a long list of blocks in the Ganache UI but the ones that has transactions. I have some workarounds in mind if these things are not possible though. Another thing is that I will probably will need 1 more week to close these changes. Thanks!

GabrielNicolasAvellaneda commented 3 years ago

Hi @LeoHChen, nevermind, I've found a way around now for setting up the initial accounts so I'm wrapping things up.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 10065.8979 ONE (1477.13 USD @ $0.14/ONE) has been submitted by:

  1. @aadorian

@papiofficial please take a look at the submitted work:


GabrielNicolasAvellaneda commented 3 years ago

@LeoHChen I've submitted my solution. I will record a video now and do some minor improvements. Hope you like it.Thanks!

GabrielNicolasAvellaneda commented 3 years ago

Hi @LeoHChen,

Repository https://github.com/GabrielNicolasAvellaneda/harmony-one-ganache-support Demo Video https://github.com/GabrielNicolasAvellaneda/harmony-one-ganache-support/blob/main/docs/demo-ganache-harmony.mp4

LuttyYang commented 3 years ago

@LeoHChen @GabrielNicolasAvellaneda

Looks very good, but has some small suggestions:

  1. It looks like build a testnet image from ubuntu, Is it possible to inherit an existing testnet image (https://hub.docker.com/r/harmonyone/localnet-test)?
  2. At present, the build script is performed on the host computer, can it be moved to dockerfile, so that there is no dependency on the environment of the host computer
  3. Is it possible to display of Bech32 Harmony One account format in block detail? image
  4. The unit is wrong on the transtation detail page. image
  5. The data on the transtation page will disappear in about a minute image
GabrielNicolasAvellaneda commented 3 years ago

@LeoHChen @GabrielNicolasAvellaneda

Looks very good, but has some small suggestions:

1. It looks like build a testnet image from ubuntu, Is it possible to inherit an existing testnet image (https://hub.docker.com/r/harmonyone/localnet-test)?

2. At present, the build script is performed on the host computer, can it be moved to dockerfile, so that there is no dependency on the environment of the host computer

3. Is it possible to display of Bech32 Harmony One account format in block detail?
   ![image](https://user-images.githubusercontent.com/14296262/117468354-2cae5380-af87-11eb-80f3-aed7040607e9.png)

4. The unit is wrong on the transtation detail page.
   ![image](https://user-images.githubusercontent.com/14296262/117468618-726b1c00-af87-11eb-9e65-e30244948521.png)

5. The data on the transtation page will disappear in about a minute
   ![image](https://user-images.githubusercontent.com/14296262/117468911-bf4ef280-af87-11eb-81d1-54aeb86c9d89.png)

Thanks @LuttyYang for your suggestions!

  1. Regarding the Dockerfile we could do FROM localnet-test but I will propose to change the localnet-image to do not remove the harmony directory. https://github.com/harmony-one/harmony-test/blob/master/localnet/Dockerfile#L18 and I will override the the entrypoint on my Dockerfile. Otherwise we will need to git clone harmony repository again in the derived image. We will place the new harmonyone/localnet-ganache on dockerhub so we don't need to do a local build, my final goal was to do just a docker pull harmonyone/localnet-ganache instead of the build.sh but this will happen when we merge this code. I could prepare everything to work this way.
  2. I could embed the Ganache build inside of the Dockerfile though in this case we will need to run the docker container as a GUI application. A better option could be to just provide a Ganache build AppImage from the Github release of this repository (which we could rename to just harmony-ganache). We could configure Jenkins to build this and create the release, then Harmony Developers will just download an AppImage and it will automatically pull from dockerhub the localnet-ganache
  3. Yes we could display the Bech32 addresses, I will do this change.
  4. You are correct, the uint is wrong. I realized this when I recorded the video too, I will do this change.
  5. You are correct, the listing does not work properly. I already noticed this too. We could see the transaction details when navigating from a block but not when we try to list all transactions, I will check why and fix.

Please let me know if you agree with these ideas. Thanks!

LuttyYang commented 3 years ago

Thank you for your hard work, looking forward to your change

GabrielNicolasAvellaneda commented 3 years ago

Hi @LuttyYang @LeoHChen

I fixed items 1, 3 and 4.. Item 2 the best option is to provide a release .AppImage this way is easier for our users. No build needed, we will do this after we move/fork the repository to harmony-one organization.

I will complete item 5 and add some more improvements during this week or weekend.

bech32-block-details bech32-transaction-details

GabrielNicolasAvellaneda commented 3 years ago

Hey @LeoHChen @LuttyYang

I completed all the request changes plus some additional improvements.\ Here are the latest changes:

  1. Fixed the search for blocks and transactions which was also showing incorrect units
  2. Fixed transaction listing, which was not always showing results due to the production of blocks of every 2 seconds
  3. Fixed the private key listing, which was not working properly
  4. Improved the container to wait until block 6 so accounts balances are always loaded before we show in the UI
  5. Added a load progress to show localnet docker container status
  6. Improved the user experience during setup as this just now requires just one file download from the release section. Please note that for this to actually work we must push the harmonyone/localnet-ganache to Dockerhub so ganache will pull automatically (For now if you want to test you must first run the ./scripts/build-docker.sh). I added a simple script for you to do it.

I put a new video to show all of these changes at https://github.com/GabrielNicolasAvellaneda/harmony-one-ganache-support/blob/main/docs/demo-ganache-harmony.mp4?raw=true, please take a look and let me know your thoughts. Hope you like it! Thanks!

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 10065.8979 ONE (1161.65 USD @ $0.11/ONE) attached to this issue has been cancelled by the bounty submitter

GabrielNicolasAvellaneda commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done

The funding of 10065.8979 ONE (1161.65 USD @ $0.11/ONE) attached to this issue has been cancelled by the bounty submitter

* Questions? Checkout [Gitcoin Help](https://gitcoin.co/help) or the [Gitcoin's Discord](https://discord.com/invite/83BK5z55yB/)

* $1,714,272.18 more funded OSS Work available on the [Gitcoin Issue Explorer](https://gitcoin.co/explorer)

Hi @LeoHChen @LuttyYang Do you know why this happen?

LuttyYang commented 3 years ago

@GabrielNicolasAvellaneda @LeoHChen

Thanks for your feedback, Looks very good.

I tested most of the scenes and found no problems.

GabrielNicolasAvellaneda commented 3 years ago

@LuttyYang @LeoHChen Awesome! Glad to hear this. BTW, thanks for your testings and feedback.

Can we then consider this as complete so we can move on to other harmony one needs? BTW, I made the submission on round one before it closed. What are next steps? Thanks!

LeoHChen commented 3 years ago

Thanks @GabrielNicolasAvellaneda for the submission. I'll close and reward you this bounty.

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 10065.8979 ONE (1033.74 USD @ $0.1/ONE) attached to this issue has been approved & issued to @gabrielnicolasavellaneda.