gm gm Pythians
The Pyth contributors have rolled out Entropy V2, a major developer experience upgrade to Pyth’s on-chain randomness protocol.
Entropy V2 introduces:
- Configurable Gas Limits for Callbacks
- Enhanced Callback Statuses
- Upcoming Public Entropy Explorer
- Improved Reliability
Configurable Gas Limits 
Now, users can set custom gas limits for callbacks while requesting random numbers.
function requestRandomNumberWithCustomGas(
uint32 customGasLimit
) external payable {
// Calculate the fee for the custom gas limit
uint256 fee = entropy.getFeeV2(customGasLimit);
// Request random number with custom gas limit
uint64 sequenceNumber = entropy.requestV2{ value: fee }(customGasLimit);
}
Moreover, IEntropyV2 introduces several new ways to request random numbers:
requestV2(): Uses an in-contract PRNG to generate user’s random number.requestV2(uint32 gasLimit): Sets the callback’s gasLimit passed by the user + Uses an in-contract PRNGrequestV2(address provider, uint32 gasLimit): Uses provider passed in the argument + Sets the callback’s gasLimit passed by the user + Uses an in-contract PRNGrequestV2(address provider, bytes32 userRandomNumber, uint32 gasLimit): Uses provider passed in the argument + Uses user’s random number to generate + Sets the callback’s gasLimit passed by the user + Uses an in-contract PRNG
Entropy uses 2-party random number generation procedure, which is an extension of a simple commit/reveal protocol. Please read the Protocol Design for the full explanation.
NOTE: This update is backward compatible. If you are using Entropy already in your smart contracts, you don’t need to update your contracts unless you want to need custom gas limits for your callbacks.
Enhanced Callback Statuses
Entropy V2 introduces callback statuses, which allow users to track the status of their callbacks.
These callback statuses are emitted in the Revealed event. The new interface of the event includes bool callbackFailed flag, which helps users to easily tracks the status of their callbacks.
event Revealed(
address indexed provider,
address indexed caller,
uint64 indexed sequenceNumber,
bytes32 randomNumber,
bytes32 userContribution,
bytes32 providerContribution,
bool callbackFailed,
bytes callbackReturnValue,
uint32 callbackGasUsed,
bytes extraArgs
);
Entropy Explorer 
Entropy V2 introduces an public Entropy Explorer, which will allow teams to easily track the status of their callbacks and re-request them if they fail on-chain.
Improved Reliability
Entropy V2 introduces a more resilient callback architecture, adding an expanded keeper network which improves delivery guarantees.
This enhancement builds on the original design and enables requests to be fulfilled more reliably during unstable chain conditions.
Let’s Discuss Entropy V2! 
This is an open discussion thread for Entropy V2. Please use this space to:
Share your feedback:
- Integration experiences (smooth sailing or hit any bumps?)
- How you’re using the new callback statuses for debugging
- Creative use cases for configurable gas limits
- Performance improvements you’ve noticed
- Suggestions for future enhancements
Show off your builds:
- Projects using Entropy V2 (screenshots welcome!)
- Code snippets demonstrating interesting implementations
- Real-world examples of the enhanced callback statuses in action
Ask questions:
- Technical implementation questions
- Best practices for specific use cases
- Help with integration challenges