Questions tagged [random]
The random tag has no usage guidance.
42 questions
0
votes
1
answer
21
views
VRF subscription sepolita testnet
i'm new on ethereum.
I followed the following guide:
https://docs.chain.link/vrf/v2-5/subscription/get-a-random-number
and everything seems to have gone fine.
but after 15 hours the process is still ...
2
votes
1
answer
130
views
How does randomBytes or extra entropy effect in wallet generation using ethers?
I'm trying to generate new wallet using ethers.js
From the examples I got online, randomBytes(16) is used. I wonder if I put randomBytes(128) make any difference.
Does it make the wallet generation ...
0
votes
2
answers
77
views
What are the best up-to-date secure approaches of generating pseudorandom number in Solidity? [duplicate]
I am thinking about creating a lottery with more than one winner and one round for users. Please don't consider usual 'commit-reveal' scheme. However, person can claim rewards on their own at the end ...
2
votes
0
answers
171
views
Is there any natural source of entropy when running `forge test`?
I'm looking for a pseudo-random value that is different each time the command is run.
Either forge test or forge script.
2
votes
0
answers
223
views
Is there an alternative to Chainlink to get a random number in a solidity contract?
I'm trying to create an NFT that selects at random between 3 json metadata files. The only way I know of to do this is to use Chainlink. I've seen one tutorial that implements "@chainlink/...
0
votes
1
answer
33
views
Random seed generator algorithm, who can explain this algo to me? is this a good one? what's the design about it?
function generateSeed(uint256 tokenId) public view returns (uint256) {
uint256 r = random(tokenId);
uint256 headSeed = 100 * (r % 7 + 10) + ((r >> 48) % 20 + 10);
uint256 faceSeed = ...
0
votes
2
answers
264
views
How to generate secure and pure Randomness number without Chainlink VRF?
I found that the Chainlink VRF do not really support all the networks.
So, I am considering to use off-chain and make my oracle to generate random number.
I have a vague idea just down below
Create a ...
1
vote
0
answers
132
views
Chainlink Random Number generator failing with Gas error
I am trying to generate a random number using chainlink VRF
i have changed all the address as per goreli
I have deployed in goreli testnet and sent some link token to the contract address
Clicking on ...
6
votes
1
answer
2k
views
Using block.prevrandao as randomness for Miller-Rabin Primality test
I am interested in using the new PREVRANDAO value as a source of pseudo-randomness in calculating the Miller-Rabin probabilistic primality test on-chain. Chainlink VRF is an option but ideally I would ...
2
votes
3
answers
610
views
How to generate random number and get it at the same time using Chainlink VRFv2?
I need to generate random number, on a single function hit and get it there only.
I am not able to do that, due to block confirmations required which is set to min. 3.
Is there any way to get this or ...
1
vote
1
answer
16
views
Link tokens required on Avg for random number generation
Can someone tell how much link tokens are required on an avg. to generate random number via VRF chainlink method??
2
votes
1
answer
203
views
Can I generate multiple random uint8 from a uint256?
The chainlink VRF returns a uint256, for my application I need a uint8. If I utilize one uint256 and break it up into separate uint8 is that still secure as a source of randomness? Also, what's the ...
1
vote
1
answer
204
views
function call gives me "pending.."
I have a problem with a function in a lottery contract.
given that library for pseudorandom:
library Random {
/*
* @dev startingValue is inclusive, endingValue is inclusive
* naive implementation! ...
1
vote
1
answer
225
views
Generating Random Number in Solidity is pending
pragma solidity ^0.8.0;
uint256 private RandNonce = 0;
function RandomNumber() public returns(uint256){
uint256 rand = uint(keccak256(abi.encodePacked(block.timestamp,msg.sender,...
1
vote
0
answers
178
views
Random number generator
I am trying to hack a random number generator contract as follows :
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
contract Guess {
uint256 private randNonce;
uint256 private result;...
0
votes
1
answer
38
views
Generating psuedo-random numbers from a non-verified contract
I understand that since psuedo-randomness in solidity is deterministic, miners and hackers will be able to reverse engineer or manipulate the pieces to force their hand. However, if I had a separate ...
1
vote
1
answer
60
views
Best way to get notified when fallback arrived
When you request random number, the Chainlink VRF2 returns it by calling following function.
function fulfillRandomWords(
uint256, /* requestId */
uint256[] memory randomWords
) ...
0
votes
1
answer
178
views
Correct way of using Random() Function while using Loops in solidity?
I want to generate a random number several times using a loop. I am currently using block.timestamp logic but it is giving the same number on every iteration. Which is correct I think because the ...
1
vote
1
answer
332
views
What is the max number of inputs that can be entered in a keccak256(abi.encodePacked()) function?
I'm learning to use the keccak function on an online Solidity tutorial, and seeing that this function takes three inputs:
uint(keccak256(abi.encodePacked(now, msg.sender, randNonce)))
made me wonder ...
0
votes
2
answers
24
views
How does delaying on-chain randomness effect the security of number guessing games?
Say a number guessing game allows users to submit their guess before block N and reveals the winning number N + 100 games later, which is random number based on the block hashes of block N until block ...
0
votes
0
answers
101
views
Random DNA mix in Solidity
Hello I have DNA mix function and I am trying to implement random function while mixing DNA
for example dad DNA is 10 10 10 10 10 10 10 10 10 10 and mum DNA is 21 21 21 21 21 21 21 21 21 21 and child ...
0
votes
0
answers
119
views
Unknown issue in solidity random function
I using this function to generate random numbers (example value of that 3 variables are commented in code below)
this code sometimes works and sometimes does not.
when I tested with manual value and ...
2
votes
1
answer
312
views
Randomizing values in mintable NFTs
I've read and written simple smart contracts in the past yet I'm relatively new to getting random data in a transaction, which seems to be harder than I've thought, due to the nature of determinism of ...
0
votes
1
answer
458
views
Commit reveal scheme with random number -- user chooses when to reveal... possible?
I've researched commit reveal schemes, but am not sure the following is possible...
User mints a playing card. The number of card is hidden.
At anytime, the user can choose to reveal the card number.
(...
0
votes
2
answers
571
views
On-chain Random Number Generator
I've been doing some research on gasleft() (used to be msg.gas but is now deprecated) and was unable to find any specifics on how or where this value is defined. I was able to find another detailed ...
0
votes
1
answer
366
views
Generate random nft art from characteristics
What is the best way to generate random art from characteristics? I’m looking into creating profile picture nfts like how wicked craniums, punks and bored bananas are random. Also what is the best way ...
1
vote
1
answer
51
views
Would this be a good choice?
Would this pseudo random algorithm be failproof:
I'm implementing a lottery contract and the winner is chose by getting addresses of each player who joined , packing the addresses into a string and ...
0
votes
2
answers
2k
views
Can you get an array of random numbers?
The question says it all. Can I get an array of random numbers in solidity?
0
votes
1
answer
55
views
Help to get variable in a pseudo random lottery contract
Hi everyone at the other side!
I'm doing a pseudo random lottery contract on solidity. It's working 100% good. The logic of the contract is that a player pays for getting a number in order to match ...
1
vote
1
answer
2k
views
Chainlink VRF fulfillRandomness doesn't use enough gas to perform function - how to get it to use more?
Chainlink VRF allows users to get a random number by calling requestRandomness and then waiting for the fulfillRandomness callback to be called by the Chainlink contract.
I have a function ...
2
votes
1
answer
1k
views
Ensuring a fair distribution of an NFT set?
Suppose I have 1000 NFT's I would like to distribute. The user can see what any NFT looks like in advance, but they don't know what they'll be getting until they actually buy it. In other words, there ...
3
votes
2
answers
7k
views
Random BigNumber in ethers.js
I'm looking to generate a random ethers.js BigNumber in a certain range. While this question has answers about random number generation, the answers as of this writing (April 2021) only cover BigInt, ...
0
votes
0
answers
356
views
Alternatives to get LINK tokens in Ropsten, for RNG
Sorry if this question sounds like very newbie (and maybe it is.
I'm developing a Smart Contract which needs a random number generation, and after researching some time it seems that ChainLink VRF ...
1
vote
1
answer
186
views
Call Smart Contract At Unpredictable Time
Is there a call scheduling service that lets you schedule a call at a time in the future not predictable by someone with access to contract code and transaction details?
The scheduling services I've ...
0
votes
1
answer
556
views
Minereum Lucky Draw claims 100% Safe randomness on a smart contract without oracles, is it really possible? [duplicate]
Is the way Minereum Lucky Draw game works really safe 100% onchain RNG and verifiable on smart contract?
They claim yes but I would like to know expert technical answer for this, if so, isn't this a ...
2
votes
2
answers
3k
views
Generating random uint256 numbers in JS
I need to generate a uint256 random number offchain (in a Node.js client). Since BN doesn't have a random() function, what's the best way to do so?
3
votes
2
answers
4k
views
Generating random number in Solidity without Chainlink
Hello I'm well aware there are plenty of threads around discussing different methods. Just curious and wanted to ask directly here because feel like the situation might be different. Essentially I'm ...
0
votes
1
answer
42
views
Proof that a variable is truly random [duplicate]
I have thinking of the wonder that an application could offer if it could prove that some of its data are truly random and so not controlled.
Can the ethereum blockchain offer such a service and how ...
0
votes
1
answer
601
views
Blockhash Minus-256 Problem [duplicate]
What is meant by Blockhash Minus-256 Problem?
I am reading an article at:
Bad Randomness
It talks about Blockhash Minus-256 problem but does not explain much about it. As a result I can’t ...
1
vote
1
answer
308
views
How can I convert an element of a byte32 array to number?
The array contains an SHA256 hash. I want to add up 2 hexadecimal values, and later multiply them by 1.125 (only keeping integer). The resulted number would represent an alphanumerical character, it ...
3
votes
0
answers
30
views
Oraclizer does not respond periodically
Contract that use oraclizer work just fine from moment of deploy. But three days ago oraclizer start to ignore requests of my contract(not allways).
In this trx oracle dont return callback, but when ...
2
votes
1
answer
373
views
Multiple callbacks with provable random oracle
I'm making a simple lottery game where there are hourly, daily and weekly prizes. My contract has functions to pick winners for each of these game types. Each game types will have different number of ...