Coder Social home page Coder Social logo

sdlc_blockchain_demo's Introduction

SDLC_Blockchain_Demo

A prototype decentralized application (dApp) utilizing Blockchain developed internally by SDLC Partners L.P

Codebase initial setup

Assuming node and npm are insalled in your machine. Requires node.js v8 or higher.

Also assuming you have already pulled a copy of the repo down using git pull in Git itself or downloading and unzipping the code base from GitHub.

To learn more about the project dependencies please consult the document "Dependency Checklist SDLC Blockchain App".

Some differences between setting up the code base initially and running an existing code base will be noted below.

Installing truffle: truffle-cli provides tool to compile,migrate,test, build the smart contracts.

NOTE: DO NOT USE THE "-g" (global) PART OF THE BELOW COMMANDS ON A HOSTED ENVIRONMENT (E.G. THE VM). ONLY USE ON LOCAL MACHINES (E.G. YOUR PC). For example, use npm install truffle @4.1.14 and npm install ganache-cli . Really, using "-g" is not best practice, it is more for convenience (i.e. so you do not have to keep setting up the code base repeatedly if you make local copies).

Also, do note that some commands require root/admin privilege. The below commands assume you are using a shell with root/admin access. If you are not, write sudo before the below commands to use root/admin access. For example: sudo npm install -g [email protected] You may have to authenticate each time if you do it this way. You do not need sudo for everything, so it is a good idea (but less convenient) to only add it when needed.

npm install -g [email protected]

Installing ganache-cli: Ganache-cli is a personal blockchain for Ethereum development you can use to deploy contracts, develop applications, and run tests on.

npm install -g ganache-cli

Once you have these installed correctly, clone the project and cd into project_code_base

Open terminal or cmd and cd into project_code_base and run truffle compile

If the command runs successfully, you will see build folder

Note: If the command does not do anything, either it did not work (unlikely), or the compilation occured before and does not need done again. It does not hurt anything to run it every time you run the app, even if unnecessary.

After compile, run ganache-cli -b it will start your blockchain instance and listen to the port 8545. Leave this window open

Open new terminal/cmd window and cd into project_code_base and run truffle migrate

Open a new terminal/cmd window and cd into project_code_base/ui. Note: If this is the first time you are setting up the environment, then run npm install. If this has been done before (e.g. existing setup directory), then there is no need for it and you may receive error messages if you try to do it.

From project_code_base/ui run npm start, it will start the application at port 3000

Troubleshooting and other important information:

If you face any issues while building and running the project, please consider the following steps:

  • If you are just trying to run an existing stable build of the app on the VM then please refer to the document: "Run SDLC Blockchain App On VM Instructions.docx". The instructions are VM-specfic, but still may be useful for setup (as of writing this document is the most complete guide). Other in-depth guides for how to run/setup the code base in different environments are in progress.
  • If one of the installs fail, pay attention to the errors. Some software has unexpected dependencies (e.g. Python 2) that will need installed first before the install above will succeed. To see what dependencies your folder has now, use this command while in that folder: npm list --depth=0 . Unmet dependencies will be shown with red text, extraneous (unnneeded) dependencies will be shown with green text. If you are having issues with depencenies (e.g. warnings about unmet dependencies, npm list shows warnings, etc.) you can use npm audit fix to have npm automatically try to fix issues for you or just npm audit to have npm show you the issues so you can manually fix them yourself by updating them (e.g. npm install {problemSoftware}@{versionNeeded}. If you would like to remove unnecessary software in the folder, you can use npm prune . Note: Some dependencies may be added or removed over time as the project evolves. Try to keep installed software minimal. For more information, consult the document "Dependency Checklist SDLC Blockchain App".
  • Disable the metamask plugin from chrome, if you are using one!
  • Truffle version MUST BE 4.1.15, you can force npm to install the particual version by doing: npm install [email protected]
  • The'contacts' folder inside ui/src/ is a symbolic link refering to build/contracts directly inside the project_code_base, this link can be broken/won't work based on your operating system, so you could manually copy all the files from build/contracts from project_code_base and paste it inside ur/src/contracts. A more permanent solution would be to (re)create the symbolic link. This can be done via terminal or GUI in Windows (see https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/), or on Linux/Mac from terminal use ln -s /[fullpath]/[to]/[build]/[contracts]/ [fullpath]/[to]/[ui]/[src].
  • When running consecutively, remember the app itself runs on port 3000 and the blockchain on 8545 (if using command line per the instructions). When rerunning you will want to stop the processes on those ports before starting them both again. The app will prompt you to switch ports automatically if you restart the app and forget to kill the existing app instance, but the Blockchain will not!

sdlc_blockchain_demo's People

Contributors

donnull0ck avatar bhimdahal avatar ytang-profile avatar ranjansparrow avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.