TAGS

besu-box

CREATED

UPDATED

STARS

INSTALL

...

REPOSITORY
GitHub Download
Please wait: Fetching readme...

b'# Besu-Box\nTo Be Used as Truffle Box Creating API Endpoints for\nHyperledger Besu network.\n\nWe use a private blockchain for Ethereum BlockChain\nDevelopment. This personalised blockchain is made with HL Besu Client.\n\nThe Smart Contract Written in solidity language\nis deployed on this Ethereum Permissioned Blockchain. Smart Contract is\nImmutable hence, once deployed it can\'t be changed.\n\nA truffle box to serve as the foundation of any Truffle and Express.js dApp.\n\nThis Box Uses NodeJS(Express JS) to provide API\nendpoints to the Ethereum Blockchain smart contract so that this\nsmart contract can be used in Android/iOS Apps as well.\n\n**Pre-Requisites**\n1. [NodeJS](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04)\n2. [NestJS](https://nestjs.com/)\n3. [Docker](https://docs.docker.com/get-docker/)\n4. [Truffle](https://github.com/trufflesuite/truffle)\n5. [Besu Docker Image](https://besu.hyperledger.org/en/stable/HowTo/Get-Started/Run-Docker-Image/)\n6. [Curl](https://curl.haxx.se/)\n\n**Installation**\n1. Install Truffle and Nestjs globally\n```\nnpm install -g truffle\nnpm install -g @nestjs/cli\n```\n\n2. Download the box. This also takes care of installing the necessary dependencies.\n```\ntruffle unbox illuzzig/besu-box\n```\n\n3. For quick, temporary tests this guide uses /tmp/besu/dev/ as mount volumes. Make sure you create the folders first in the root dir\n```\nmkdir -p /tmp/besu/dev/\n```\n\n4. To run a node that mines blocks at a rate suitable for testing purposes\n```javascript\n// in another terminal (i.e. not in the truffle develop prompt)\n// ensure you are inside the app directory when running this\nnpm run besu:docker\n```\n\n5. Now you can deploy your smart contracts. \n```javascript\n// in another terminal (i.e. not in the truffle develop prompt)\n// ensure you are inside the app directory when running this\ntruffle migrate --network besu\n```\n\n6. To run the Nestjs server\n```javascript\n// in another terminal (i.e. not in the truffle develop prompt)\n// ensure you are inside the app directory when running this\nnpm run start:dev\n```\n\n7. In a window terminal type \n```\n// in another terminal (i.e. not in the truffle develop prompt)\n// ensure you are inside the app directory when running this\ncurl http://localhost:3000/balance/0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73 \n```\nAs you can see this address holds all the metaCoin tokens accordin to the business logic implemented into the smart contract. Below the response\n```\n{"address":"0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73","balance":"10000"}\n```\n\n8. Set the variable `metaCoinAddress` (client_script/utils.js) to match the deployed MetaCoin address from `truffle migrate`. You can get the smart contract address by typing\n```\n// in another terminal (i.e. not in the truffle develop prompt)\n// ensure you are inside the app directory when running this\ntruffle networks | grep -i metacoin\n```\n9. Launch the transfer script\n```javascript\n// in another terminal (i.e. not in the truffle develop prompt)\n// ensure you are inside the app directory when running this\nnpm run transfer\n```\n\n10. The second address will receive 10 tokens from the first one. In a window terminal type \n```\n// in another terminal (i.e. not in the truffle develop prompt)\n// ensure you are inside the app directory when running this\ncurl http://localhost:3000/balance/0x627306090abaB3A6e1400e9345bC60c78a8BEf57\n```\nBelow the response\n```\n{"address":"0x627306090abaB3A6e1400e9345bC60c78a8BEf57","balance":"10"}\n```\n\n11. For web service monitoring and performance metrics you can enable the APM agent in the main.ts file and visualize the incoming requests with kibana. [Read More](https://www.elastic.co/guide/en/apm/agent/nodejs/current/index.html)\n\n**Contributors**\n1. [Giuseppe Gaetano Illuzzi](https://github.com/illuzzig)\n'