Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Power your dApp with Verifiable Real-world Data #36

Open
simonerom opened this issue May 24, 2021 · 4 comments
Open

Power your dApp with Verifiable Real-world Data #36

simonerom opened this issue May 24, 2021 · 4 comments

Comments

@simonerom
Copy link
Member

simonerom commented May 24, 2021

Power your dApp with Verifiable Real-world Data

Welcome!

Thank you for your interest in IoTeX. You are welcome to participate in our competitions. Also, take a look at the other prizes:

Please join our Discord to discuss the bounties.

Bounty Prize

2500 USDT
to the most creative submission

The Challenge

Pebble Tracker is a multi-sensor IoT board that converts real-world phenomena into verifiable, blockchain-ready data. We would like you to create a simple dApp that gets periodically fed by these verifiable data messages containing sensor values, verifies the message signature, and takes specific actions based on the sensor's values.

Below we provide the basic specifications, but anyone is free to extend it and get creative:

  1. Use our Pebble Simulator to generate a set of Pebble sensor data points along with their signature.
  2. Create a smart contract that stores a list of "registered" devices. The contract owner can allow or block/delete devices. Anyone can "register" a new device (use the device IMEI and Public key for identification).
  3. The contract should have a method to receive a Pebble data message and verify both data source device and data integrity.
  4. The contract will reject data messages that come from non-whitelisted devices or whose signature is invalid.
  5. For valid data messages, The contract will take some action based on the sensor values it received (e.g., store the latest values, transfer funds if a specific event is detected, etc...)
  6. Create a frontend for the smart contract that allows users to log in with Metamask; allows any user to register a device, and the contract owner to allowlist, block, or delete registered devices, and displays any data relevant to the smart contract (e.g., display all devices, display latest data per device, display token transfers, contract balance, etc...)

For the Smart Contract, you are required to use Solidity 0.5.13, for the frontend we suggest our dApp sample (though not a strict requirement)

Acceptance Criteria

  • Code must be clear and well documented
  • Applicants work must be open-source on GitHub
  • Although simple, the frontend should be clean and pleasant
  • You will are allowed to be creative and build your own IoT data service, as long as all the functions described above are included
  • The dApp repository must include a detailed installation & usage guide
  • Additional grant via Halo Program if strongly exceeds expectation

Judging Criteria

  • We will require a demo of the submission
  • We will assign the prize to the dApp that uses the IoT data in the most creative way

Misc/References

Useful links

Pebble Message Verification

Important notice: the simulator only support Linux and macOS

Data message verification is the key concept behind the verifiability of Pebble Tracker data: you can both verify the source (i.e. the device public key) of the data, and the integrity of the data in one single step using the signature included in the Pebble Tracker data messages:

...
"signature": {
  "r":"4c05a4fa3eba782780a517ba03ef6fdd65e5b560a027808b47fcc6ed2b864169",
  "s":"05bde29104febe10c096c550b91f5d8ed2cf0d15fe48e164ee0e9765dda76f34"
}

rand s are the two components of the elliptic curve signature (using secp256k1 curve) of the data message, obtained by signing the keccak256 hash of the JSON object rendered to a string without any formatting. A possible example to verify the message signature would be the following, using the solidity ecrecover function:

// The verification function is called with all Pebble IoT data values, including the signature `r` and `s` components
function receiveData(string temperature, string latitude, string longitude, ..., bytes32 r,  bytes32 s)

// buildJsonString should just rebuild the original pebble data message into an unformatted
// json string using the data passed to receiveData(), and returns the string cast to bytes  
bytes32 hash = keccak256(buildJsonString(temperature, latitude, longitude, ...));
 
// Recover device address from the data message signature 
bool hit;      
address deviceAddress;
// the signature version "v" can be either 27 or 28, the device does not provide it so
// we test both of them       
for (uint8 v = 27; v < 29; v++) {        
  deviceAddress = ecrecover(hash, v, r, s);        
  if (whitelist[deviceAddress] == 1) { 
    hit = true;          
    break;        
  }     
}

If ecrecover() returns a valid, non-zero address, this means that the data integrity is assured (i.e. the data passed to the contract correspond to those originally signed by the device). If the returned address is also included among the whitelisted devices then both the source and integrity of the data are verified, all is good and the contract can go ahead processing the sensors data (which is now trusted data!) and taking the specific actions required by the dApp.

IoTeX Useful Links

Discuss: Please join our Discord Dev Chat to ask questions or reach out to Simone_IoTeX on Discord if you need any help.

Docs: IoTeX Docs | Ethereum Compatibility | DID | Full Nodes

Follow Us: iotex.io | Telegram | Twitter | Medium | Reddit

@simonerom simonerom changed the title [TBD] A Pebble Tracker demo app [TBD-GR10] A Pebble Tracker demo app Jun 13, 2021
@simonerom simonerom changed the title [TBD-GR10] A Pebble Tracker demo app [TBD-GR10] Verifiabe IoT Data simple dApp Jun 13, 2021
@simonerom simonerom changed the title [TBD-GR10] Verifiabe IoT Data simple dApp [TBD-GR10] A simple dApp that makes use of verifiable IoT data from Pebble Tracker Jun 13, 2021
@simonerom simonerom changed the title [TBD-GR10] A simple dApp that makes use of verifiable IoT data from Pebble Tracker [TBD-GR10] Power your dApp with verifiable IoT data Jun 14, 2021
@raullenchai raullenchai changed the title [TBD-GR10] Power your dApp with verifiable IoT data [TBD-GR10] Power your dApp with Verifiable Realworld Data Jun 14, 2021
@raullenchai raullenchai changed the title [TBD-GR10] Power your dApp with Verifiable Realworld Data [TBD-GR10] Power your dApp with Verifiable Real-world Data Jun 14, 2021
@simonerom simonerom changed the title [TBD-GR10] Power your dApp with Verifiable Real-world Data Power your dApp with Verifiable Real-world Data Jun 15, 2021
@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 2500.0 USDT (2500.0 USD @ $1.0/USDT) attached to it.

@gitcoinbot
Copy link

gitcoinbot commented Jun 19, 2021

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 19 hours ago.
Please review their action plans below:

1) jpick713 has been approved to start work.

The project will allow monitoring of VOC emissions from a kiln to conform to environmental regulations and also though temperature and humidity tracking give insight into MC% at a given time and possibly trigger actions once certain conditions are met.

Learn more on the Gitcoin Issue Details page.

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 2500.0 USDT (2500.00 USD @ $1.0/USDT) has been submitted by:


@gitcoinbot
Copy link

gitcoinbot commented Jul 10, 2021

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 2500.0 USDT (2500.00 USD @ $1.0/USDT) has been submitted by:

  1. @65black
  2. @nicky-ru

@simonerom please take a look at the submitted work:


Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants