LearnBlockChain

Ethereum

The Contracts folder contains some examples of contracts written using solidity programming language. The Apps folder contains a sample asset management web application, written in ASP.Net Core 3.1 Blazor Webserver and uses Web3js to communicate with the deployed Smart contract SimpleAssetAuditLogs.sol. It also uses Entity framework core to store the Asset data.

To run the Web app,

  1. Clone the repository.
  2. Open solution in VS2019.
  3. Run the database migration script to create a local database and migrate to the latest corresponding entities.
  4. Download nuget packages
    Ganache CLI: To install globally run Npm i -g ganache-cli
    Web3js: Since Web3js distributions files are already added to the APP, it is not necessary to download the package again.
    If you wish to use latest Web3js package code, then use the command Npm i --save ethereum/web3.js to download the package and follow the instructions from https://github.com/ethereum/web3.js/ to build and run.
    If not you can also donwload the latest Dist file from the above mentioned Web3 github page and use.
  5. Run from cmd prompt ganache. This will start a local ethereum in your PC and will provide you a list of accounts to deploy and test your contract.
  6. Install Metamask chrome extension from https://metamask.io/. Follow its instructions to create a new wallet account with passphrase. After running ganache you can import your local wallet into metamask and control your account from the wallet.
  7. Open Remix IDE https://remix.ethereum.org/ to deploy the contract SimpleAssetAuditLogs.sol. Use Injected Web3 to deploy the smart contract using Metamask.
  8. Copy the ABI and Contract address from remix into the javascript file blockkchain.js available in the App and assign it to the corresponding variables.
  9. Run the App, and play around.

Photo by David McBee from Pexels