Ethereum Oracles smart contract to manage notaries in Oracles PoA
№ | Attack vector | Description | Status |
---|---|---|---|
1 | Race Conditions | The order of transactions themselves (within a block) is easily subject to manipulation | |
1.a | Reentrancy | Functions can be called repeatedly, before the first invocation of the function was finished | |
1.b | Cross-function Race Conditions | A similar attack using two different functions that share the same state | |
1.c | Pitfalls in Race Condition Solutions | Avoiding of calling functions which call external functions | |
2 | Timestamp Dependence | Timestamp of the block can be manipulated by the miner | |
3 | Integer Overflow and Underflow | Usage of unlimited increments can cause such issue | |
4 | DoS with (Unexpected) Throw | Unexpected throw is reached with some contract method for any user, because of malicious user called it before with bad parameters | |
5 | DoS with Block Gas Limit | Block gas limit can be reached, for example, with looping through an array with unknown size and sending send() in a single transaction. Sending should be divided to multiple transactions |
Install dapp cli
-
git clone https://github.com/oraclesorg/oracles-contract
// clone repository -
cd oracles-contract/
// move to folder with project -
git submodule update --init --recursive
// get submodules data -
dapp build
// compiling of contracts to./out
Expected result:
./out/Oracles.bin
- bytecode of Oracles contract
./out/Oracles.abi
- binary interface of Oracles contract
Adds new Ballot
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
1 | address | owner |
Voting key of notary, who creates ballot |
|
2 | address | miningKey |
Mining key of notary, which is proposed to add or remove |
|
3 | address | affectedKey |
Mining/payout/voting key of notary, which is proposed to add or remove |
|
4 | uint256 | affectedKeyType |
Type of affectedKey: 0 = mining key, 1 = voting key, 2 = payout key |
|
5 | bool | addAction |
Flag: adding is true, removing is false |
|
6 | string | memo |
Ballot's memo |
Adds new notary
inputs | 0 | address | miningKey |
Notary's mining key |
1 | uint256 | zip |
Notary's zip code |
|
2 | uint256 | licenseID |
Notary's license ID |
|
3 | uint256 | licenseExpiredAt |
Notary's expiration date |
|
4 | string | fullName |
Notary's full name |
|
5 | string | streetName |
Notary's address |
|
6 | string | state |
Notary's US state full name |
Gets ballot's creation time
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | uint256 | value |
Ballot's creation time |
Checks, if ballot is active
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | bool | value |
Ballot's activity: active or not |
Checks, if ballot is already voted by signer of current transaction
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | bool | value |
Ballot is already voted by signer of current transaction: yes or no |
inputs | 0 | uint256 | ||
outputs | 0 | address | owner |
|
1 | address | miningKey |
||
2 | address | affectedKey |
||
3 | string | memo |
||
4 | uint256 | affectedKeyType |
||
5 | uint256 | createdAt |
||
6 | uint256 | votingStart |
||
7 | uint256 | votingDeadline |
||
8 | int256 | votesAmmount |
||
9 | int256 | result |
||
10 | bool | addAction |
||
11 | bool | active |
Checks, if initial key is new or not
inputs | 0 | address | key |
Initial key |
outputs | 0 | bool | value |
Is initial key new or not new |
Checks, if payout key is active or not
inputs | 0 | address | addr |
Payout key |
outputs | 0 | bool | value |
Is payout key active or not active |
Checks, if voting key is active or not
inputs | 0 | address | addr |
Voting key |
outputs | 0 | bool | value |
Is voting key active or not active |
Create production keys for notary
inputs | 0 | address | miningAddr |
Mining key |
1 | address | payoutAddr |
Payout key |
|
2 | address | votingAddr |
Voting key |
Gets ballot's action
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | bool | value |
Ballot's action: adding is true, removing is false |
Gets affected key of ballot
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | address | value |
Ballot's affected key |
Gets affected key type of ballot
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | uint256 | value |
Ballot's affected key type |
Gets ballot's memo
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | string | value |
Ballot's memo |
Gets mining key of notary
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | address | value |
Notary's mining key |
Gets ballot's owner full name
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | string | value |
Ballot's owner full name |
Gets ballot's voting end date
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | uint256 | value |
Ballot's voting end date |
Gets ballot's voting start date
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | uint256 | value |
Ballot's voting start date |
Gets all ballots' ids
outputs | 0 | uint256[] | value |
Array of all ballots ids |
Gets disabled notaries mining keys
outputs | 0 | address[] | value |
Array of disabled notaries mining keys |
Gets notary's disabling date
inputs | 0 | address | addr |
Notary's mining key |
outputs | 0 | uint256 | value |
Notary's disabling date |
Gets notary's full name
inputs | 0 | address | addr |
Notary's mining key |
outputs | 0 | string | value |
Notary's full name |
Gets notary's license expiration date
inputs | 0 | address | addr |
Notary's mining key |
outputs | 0 | uint256 | value |
Notary's license expiration date |
Gets notary's license ID
inputs | 0 | address | addr |
Notary's mining key |
outputs | 0 | uint256 | value |
Notary's license ID |
Gets notary's state full name
inputs | 0 | address | addr |
Notary's mining key |
outputs | 0 | string | value |
Notary's state full name |
Gets notary's address
inputs | 0 | address | addr |
Notary's mining key |
outputs | 0 | string | value |
Notary's address |
Gets notary's zip code
inputs | 0 | address | addr |
Notary's mining key |
outputs | 0 | uint256 | value |
Notary's zip code |
Gets active notaries mining keys
outputs | 0 | address[] | value |
Array of active notaries mining keys |
Gets ballot's amount of votes against
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | int256 | value |
Ballot's amount of votes against |
Gets ballot's amount of votes for
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
outputs | 0 | int256 | value |
Ballot's amount of votes for |
inputs | 0 | address | ||
outputs | 0 | string | fullName |
|
1 | string | streetName |
||
2 | string | state |
||
3 | uint256 | zip |
||
4 | uint256 | licenseID |
||
5 | uint256 | licenseExpiredAt |
||
6 | uint256 | disablingDate |
||
7 | string | disablingTX |
Votes
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
1 | bool | accept |
Vote for is true, vote against is false |