Найти в Дзене
111
pragma solidity ^0.8.0; contract Randomizer { uint private nonce; function random() public returns (int256) { nonce++; int256 random_number = int256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, nonce))) % 101 - 50; return random_number; } }
2 года назад
Random
pragma solidity ^0.8.0; contract Randomizer {   uint private nonce;   function random(uint256 range) public returns (uint256) {     nonce++;     return uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, nonce))) % range;   } }
2 года назад
genesis.json
{ "config":{ "chainid":15, "eip150Block":0, "eip155Block":0, "eip158Block":0, "eip155Block":0, "homesteadBlock":0, "byzantiumBlock":0, "constantinopleBlock":0 }, "gasLimit":"21000000", "difficulty":"0x4", "nonce":"0x0000000000000033", "timestamp":"0x0", "alloc":{ "0xA44363888c43cd0b7fb37452b24f3Bd74a911d32" :{"balance":"100000000000000000000"}, "0xeb0C25Ed412B4de82fE1B97F76a460AeB9aeb27E" :{"balance":"0"}, "0x5C22E3FFb2C81EacB7f3230518EB48C12A58c5ff"...
2 года назад
подсказки
geth account new --datadir "C:\Users\McLovin\Desktop\geth" geth.exe --datadir "C:\Users\McLovin\Desktop\geth" init "genesis.json" geth.exe --http --http.addr "127.0.0.1" --http.api "personal, eth, miner, net, web3, admin" --networkid 15 --datadir "C:\Users\McLovin\Desktop\geth" --allow-insecure-unlock --http.corsdomain "*" console web3.personal.unlockAccount( "0xA44363888c43cd0b7fb37452b24f3Bd74a911d32" , "111") или web3.personal.unlockAccount(eth.accounts[0], "111", 300) miner.setEtherbase("0xA44363888c43cd0b7fb37452b24f3Bd74a911d32") miner.start(1) web3.personal.unlockAccount("0xa44363888c43cd0b7fb37452b24f3bd74a911d32") >pyuic5 path\to\untitled...
2 года назад
geth+remix
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title Owner * @dev Set & change owner */ contract Owner { struct User { string name; string password; uint money_cmon; uint money_eth; address[] whitelistPrivate; } struct Request {//заявки string name; address requester; } mapping (address => User) Users; Request[] public requests; //time uint Time_start; //время старта uint public Time_dif; //времянная разница uint Time_now; //время сейчас uint Time_system; //время жизни системы //main...
2 года назад