Skip to content
/ IOT Public

Research related to Ethereum Smart Contracts

Notifications You must be signed in to change notification settings

nahtnam/IOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IOT

The contract is located in the contract.sol file and the code for the script is in index.js.

Requirements

  • Node.js 8+
  • NPM 5+
  • 2 addresses with priv keys

Usage

  1. Run npm install
  2. Add the following environment variables:
# EVERYTHIGN RUNS ON THE ROPSTEN NETWORK!
export CONTRACTOR_ADDRESS="" # contractor address
export CONTRACTOR_PRIVATE_KEY="" # contractor private key
export USER_ADDRESS="" # client address
export USER_PRIVATE_KEY="" # client private key
export CONTRACT_ADDRESS="" # address of published contract
  1. Run npm start in two different terminals
  2. Select contractor in one and client in the other.
  3. Register a contractor from 0 to 10
  4. After the transaction confirms, make a query from the client with the following text: FROM X TO Y where X and Y are between 0 and 10;
  5. Mine the transaction with the given hash
  6. Check the result of the query in client

Todo

  • Fix CTRL + C issue
  • Automatically mine when in contractor mode
  • Calculate the cost based on the length of the return
  • Add support for events in the contract
  • Set up private contractors
  • Handle refunds based on block number and duration specified by the client
  • Add 0x to the TXIDs
  • Add support for pub/priv/shared keys

About

Research related to Ethereum Smart Contracts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published