IoT

Last updated 24 days ago

Internet Of Things linkage to Corrently Ecosystem based on Ethereum Blockchain

asciicast

Ethereum Bockchain Twin

0xa3436ffe33796f6c95cbab6b45c88a2f803261af

Usage

Purpose of this simple Smart Contract is to store values of "Things" in the Ethereum Homestead blockchain. An event gets triggered as soon as value is changed.

pragma solidity ^0.4.18;
contract corrently_iot {
mapping (address => uint256) public value;
event Value(address indexed thing, uint256 value);
function setValue(uint256 _value) public {
value[msg.sender] = _value;
emit Value(msg.sender,_value);
}
}

RESP API

A public RESP is provided by STROMDAO to allow conditional twin generation and easy implementation into standard automation platforms.

get
Setting Values

https://api.corrently.io/iot
Request
Response
Query Parameters
inc
optional
number
increments given value to value (Note: given value parameter will be ignored)
add
optional
number
adds given value to value (Note: given value parameter will be ignored)
condition
optional
string
Javascript style "IF" Condition that will be bound to thing. If this condition evaluates true during an update a blockchain transaction will be issued (requires account to have positive Ether balance to pay for gas)
secret
optional
string
Instead of using a signature to authorize value updates a secret might be used. Requires an initial update with signature in order to set or update secret
value
required
integer
Unsinged value to set for thing
signature
optional
string
Authorize value update for account. If account parameter is given signature could be either last signature returned as response or an Ethereum transaction signature.
account
optional
string
Ethereum Address of thing to update. If no account is provided a new address will be generated.
200: OK
If value is provided in request, response contains signature required to update value.
{
result: {
value: 1337,
account: "0x500a2bA2C2301e85e75b26b1589cA2cD28Df4909",
signature: "0xb420cef82538e8a995bd41599adfaad6dfb72a8c5f1f9982d6a94a39766755ff29469f83bba45f0a4cf11fc8cd8f2fca015c1c5d8dfc10d5e5fa08ebf8100de31c",
previous_value: 0,
nonce: 1,
err: null
}
}

get
Getting Values

https://api.correntiy.ip/iot
Returns last value of a thing.
Request
Response
Query Parameters
account
required
string
Ethereum Address to return
200: OK
Returns value and some statistical information about account. Value provided might be transient and not commited to Ethereum blockchain.
{
result: {
value: 1337,
account: "0x500a2bA2C2301e85e75b26b1589cA2cD28Df4909",
nonce: 1,
timeStamp: 1542542971316,
previous_value: 0
}
}