Skip to content

ceyonur/smart-energy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartEnergy

Setup

Ethereum

Install geth following link: https://geth.ethereum.org/install-and-build/Installing-Geth. In this project geth 1.8.27-stable is used.

Run geth with following command:
geth --testnet --syncmode "light" --rpc --rpcapi "eth,net,web3,personal" --rpccorsdomain '*' --rpcaddr 0.0.0.0 --rpcport 8545
This command sync lightchain which is faster and uses less memory than real chain. However this is an experimental feature so if it does not work run the same command with --syncmode "fast".

node-red

Install node red following link: https://nodered.org/docs/getting-started/installation. In this project node-red v0.20.5 and node.js v8.16.0 is used.

web3 node-red

In this project we used web3 v0.20.0, you can change the version but there's no guarantee that other versions work well with this project.
You can install web3 on node-red as follows: go to .node-red/ directory then under this directory you can install web3:
npm install --save [email protected] --unsafe-perm=true --allow-root
There is a configuration file named settings.js in the node-red directory. Open it with your favorite text editor and find setting functionGlobalContext. Then add web3:require('web3') under this setting. For example:

functionGlobalContext: {
//  osModule:require('os'),
    web3:require('web3')
}

Make sure that web3 is installed for node-red by looking at package.json file.

You can import the flow under cloud/flows.json to the node-red. Ethereum client must be already working before you deploy and use the flow. There is a static account address on the function updateSensorData if you want to use another account you need to change it.

Smart Contract

You can deploy the smart contract or use already deployed one. The smart contract deployed on link https://ropsten.etherscan.io/address/0xcde24e25421174829a704e6411cc5ca1ce25756f.
In this project we used Brave+Metamask plugin which ease the signing new transactions and displaying account data. You can follow this link to install Brave + Metamask: https://brave.com/into-the-blockchain-brave-with-metamask/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages