Solution to iDASH'19 challenge track 1
INSTRUCTIONS TO RUN GeneDrugRepo SMART CONTRACTS IN TRUFFLE
Part 1: Configuring Truffle Directories
-
Install Truffle via the following terminal command:
npm install -g truffle
-
Make a directory named "truffle" and navigate to it.
-
Initialize Truffle via the following terminal command:
truffle init
-
This will create four sub-directories and a config file: /build, /contracts, /migrations, /test, and truffle-config.js.
-
Move the smart contract solidity files to the /contracts dir.
-
Create a file in the /migrations dir named 2_deploy_contracts.js with the following contents:
var GDR = artifacts.require("./GeneDrugRepo.sol"); module.exports = function(deployer) { deployer.deploy(GDR); };
-
Move the gdr_train javascript test files to /test.
Part 2: Running Contracts in Truffle Test Network
-
Open terminal, cd to truffle dir, run the following command:
truffle develop
-
Open a second terminal window. Run the test files to observe contract behavior via the following command:
truffle test ./test/[name of javascript test file]
-
Alternatively, to deploy contracts to a truffle test network and call transactions, see the instructions on the Truffle documentation: site: https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations