- NodeJs - https://nodejs.org/en/download/
- Truffle - https://www.trufflesuite.com/truffle
- Metamask - https://metamask.io/download.html
In the blockchain that you are using, you need to enable websocket. If you are using the Hyperledger Besu client, you can find instructions here
- Clone the repository to the user's home directory and go to the project directory:
cd "${HOME}" && git clone https://github.com/kostiask/Mako2.git && cd Mako2
- Go to directory Oracle:
cd Oracle
- Install modules:
npm install
- Into truffle-config.js put blockchain and account data:
development: {
host: '<host blockchain>',
port: <port>,
network_id: '*',
from: <address account>
}
Besu does not support private key management. To use Besu with Truffle, you must configure a Truffle wallet. To install a Truffle wallet:
npm install --save @truffle/hdwallet-provider
To add the wallet provider, update the truffle-config.js file in the project directory. Replace:
- with the JSON-RPC endpoint (IP address and port) of a Besu node.
- with the private key of an Ethereum account containing Ether.
const PrivateKeyProvider = require("@truffle/hdwallet-provider");
const privateKey = "<account-private-key>";
const privateKeyProvider = new PrivateKeyProvider(privateKey, "<JSON-RPC-http-endpoint>");
- Compile Smart Contract:
truffle compile
- Deploy Smart Contract:
truffle migrate
If you using Besu:
truffle migrate --network besuWallet
After executing the command from point 6 of the instruction, the terminal will display the address of the new Oracle smart contract:
- The address of the smart contract Oracle from point 6 of the instruction must be placed in the js_Oracle/index.js file:
const addressOracle = "<address-Oracle-contract>";
and in the dapp/contracts/oracleAPI.sol file:
address OracleAddress = <address-Oracle-contract>;
- Go to directory js_Oracle:
cd ../js_Oracle
- Install modules:
npm install
- In index.js put blockchain websocket address:
web3 = new Web3(new Web3.providers.WebsocketProvider('<blockchain-websocket>'));
- In index.js put private account key(0x.....) on which there is ether for signing transactions:
const privateKey = "<private-key-account>";
- Start an application:
node index.js
- In the new terminal window, go from the main directory to the dapp directory
cd dapp
- Install modules:
npm install
-
Follow step 2 from the instructions for the file truffle-config.js.
-
Compile Smart Contracts:
truffle compile
- Deploy Smart Contracts:
truffle migrate
If you using Besu:
truffle migrate --network besuWallet
After executing the command from point 17 of the instruction, the terminal will display the address of the new RDF smart contract: 18. The address of the smart contract RDF from point 17 of the instruction must be placed in the dapp/client/src/app.js file:
address: "<smart-contract-RDF-address>",
- From root directory, go to the directory server:
cd ../server
- Start server, which will return the graph:
node server.js
- In a new terminal window, from the root directory, go to the directory dapp/client
cd dapp/client
- Install module:
npm install
- Start app:
npm run dev