openzeppelin-solidity
randao
Our great sponsors
openzeppelin-solidity | randao | |
---|---|---|
4 | 7 | |
10,805 | 826 | |
- | 0.0% | |
9.4 | 0.0 | |
almost 3 years ago | about 1 year ago | |
JavaScript | JavaScript | |
MIT License | GNU General Public License v3.0 only |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
openzeppelin-solidity
-
Attack Vectors in Solidity #6:Unexpected Ether( Incorrect Use of this.balance)
pragma solidity ^0.5.0; import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract MyContract { using SafeMath for uint256; function deposit() public payable { // code to deposit ether } function withdraw(uint256 _amount) public { require(this.balance.sub(_amount) >= 0, "Insufficient funds"); // code to withdraw ether } }
-
How to check if tokenholder is holding 2 different tokens at the same time before an event is triggered?
The basic structure could be done as follows using OZ ERC20 interface https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/IERC20.sol
-
Is this why shib price keeps going down?
return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; }
-
can someone tell me what this contract wants?
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
randao
-
Gas is the cheapest it's been in a long time. Imagine that this will be the norm a year or so from now
There's really no "forcing", in sharding validators are randomly assigned to a shard, similarly to how they're currently randomly split up into committees that attest to the validity of blocks. There's no centralizing force: the randomness into the process is provided in a decentralized fashion by the validators themselves, through a mechanism called RANDAO.
-
Explaining Ethereum's consensus mechanism after The Merge
Article author here.
Great questions, should have explored the randomness beacon more. Ethereum uses [RANDAO](https://github.com/randao/randao), which is a distributed commit-reveal scheme where participants in the generation post a hash of their data on the commit portion and then at a later timestamp reveal the data preimage, and get slashed if they do not reveal a correct preimage. Then all participant data is aggregated together. This means if there is at least one honest participant the generation will be random.
A supermajority (2/3rds) of validators is required to finalize a block, in case of a 50-50 network partition blocks would stop being finalized and attestation rewards would stop. Non-participating validators would slowly leak stake through the inactivity leak until online validators once again had a supermajority. This is the "self-healing" mechanism that allows both safety and liveness.
-
How does Eth 2.0 PoS choose block proposer randomly?
https://github.com/randao/randao Is this what you’re referring to? It says it’s a DAO.
-
Proposals on random
So according to this generating randoms for the eth chain is like validating but with shorter cycle and more profitable. Now I have even more questions like: How can I participate Is there software like prysm for using random contracts What is the minimum stake for random contracts Is anyone doing this, is it wort it
-
Suggestion for multiple-user seed
Thank you Eric, I discussed it too in the PoolTogether discord and got this reponse from one of the founders: " What you're describing is a version of "RANDAO". See here: https://github.com/randao/randao Really, the VRF is an unnecessary step if a seed is being selected by all participants If you look through the above project, you'll see they try to handle a few corner cases like if a user refuses to reveal their seed, or preventing a seed from being used twice The trouble with Randao is the amount of coordination and expense that it incurs. " I understand ETH 2.0 will be doing some implementation of RANDAO along VDFs for the Beacon chain. Algorand implements this too. I found this talk from Justin Drake talking about this algorithm: https://www.youtube.com/watch?v=zqL_cMlPjOI
What are some alternatives?
RegEx-DoS - :cop: :punch: RegEx Denial of Service (ReDos) Scanner
ethereumbook - Mastering Ethereum, by Andreas M. Antonopoulos, Gavin Wood
openzeppelin-contracts - OpenZeppelin Contracts is a library for secure smart contract development.
echidna - Ethereum smart contract fuzzer
truffle - :warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
eattheblocks - Source code for Eat The Blocks, a screencast for Ethereum Dapp Developers
annotated-spec - Vitalik's annotated eth2 spec. Not intended to be "the" annotated spec; other documents like Ben Edgington's https://benjaminion.xyz/eth2-annotated-spec/ also exist. This one is intended to focus more on design rationale.
yulp - ➕ A low-level, highly efficient extension to Yul, an intermediate language for the Ethereum Virtual Machine.
teku - Open-source Ethereum consensus client written in Java
bytecode-verifier - Compile Solidity source code and verify its bytecode matches the blockchain
prysm - Go implementation of Ethereum proof of stake