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 |
inputs | 1 | address | miningKey |
Mining key of notary which is proposed to add or remove |
inputs | 2 | bool | addAction |
Flag: adding is true, removing is false |
inputs | 3 | string | memo |
Ballot's memo |
Adds new notary
inputs | 0 | address | miningKey |
Notary's mining key |
inputs | 1 | uint256 | zip |
Notary's zip code |
inputs | 2 | uint256 | licenseID |
Notary's license ID |
inputs | 3 | uint256 | licenseExpiredAt |
Notary's expiration date |
inputs | 4 | string | fullName |
Notary's full name |
inputs | 5 | string | streetName |
Notary's address |
inputs | 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 |
|
outputs | 1 | address | miningKey |
|
outputs | 2 | string | memo |
|
outputs | 3 | uint256 | createdAt |
|
outputs | 4 | uint256 | votingStart |
|
outputs | 5 | uint256 | votingDeadline |
|
outputs | 6 | int256 | votesAmmount |
|
outputs | 7 | int256 | result |
|
outputs | 8 | bool | addAction |
|
outputs | 9 | bool | active |
Changes mining key
inputs | 0 | address | miningKey |
Current mining key |
inputs | 1 | address | miningKeyNew |
New mining key |
Changes payout key
inputs | 0 | address | payoutKey |
Current payout key |
inputs | 1 | address | payoutKeyNew |
New payout key |
Changes voting key
inputs | 0 | address | votingKey |
Current voting key |
inputs | 1 | address | votingKeyNew |
New voting key |
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 |
inputs | 1 | address | payoutAddr |
Payout key |
inputs | 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 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 |
Mining key of notary |
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 active ballots' ids
outputs | 0 | uint256[] | value |
Array of active ballots ids |
Gets disabled notaries addresses
outputs | 0 | address[] | value |
Array of disabled notaries addresses |
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 addresses
outputs | 0 | address[] | value |
Array of active notaries addresses |
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 |
|
outputs | 1 | string | streetName |
|
outputs | 2 | string | state |
|
outputs | 3 | uint256 | zip |
|
outputs | 4 | uint256 | licenseID |
|
outputs | 5 | uint256 | licenseExpiredAt |
|
outputs | 6 | uint256 | disablingDate |
|
outputs | 7 | string | disablingTX |
Votes
inputs | 0 | uint256 | ballotID |
Ballot unique ID |
inputs | 1 | bool | accept |
Vote for is true, vote against is false |