-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sol
More file actions
41 lines (35 loc) · 860 Bytes
/
update.sol
File metadata and controls
41 lines (35 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/// Smart contract for information update
pragma solidity ^0.4.25;
contract update {
uint private serial_imei;
uint timestamp;
bytes32 private H;
bytes32 private pub;
event update_serial(
uint timestamp,
bytes32 pub
);
event update_imei(
uint timestamp,
bytes32 pub,
bytes32 H
);
function log_serial(uint _s_i)
public{
serial_imei = _s_i;
pub =
sha256(abi.encode(serial_imei));
timestamp = now;
emit update_serial(timestamp, pub);
}
function
log_imei(uint _s_i, uint _H)
public{
serial_imei = _s_i;
H = sha256(abi.encode(_H));
pub =
sha256(abi.encode(serial_imei));
timestamp = now;
emit update_imei(timestamp,H, pub);
}
}