Verifiable randomness for your smart contracts.
ABC Entropy is a lightweight commit-reveal randomness oracle designed to deliver verifiable, on-chain random numbers to your dApp with minimal friction.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// Request a random number.
request = abc_entropy.get();
// Receive it in a callback.
function entropy_callback(response) {
bytes32 entropy = keccak256(A, B, C);
}
How ABC entropy works
This is a commit-reveal scheme built on three components, each contributing part of the final random number:
-
A Your dapp users
Your frontend provides the user's entropy contribution.
-
B Generator (us)
We lock our entropy contribution behind a hash beforehand, allowing post-reveal verification.
-
C Sequencer (Network)
It introduces additional entropy to prevent any party—including us—from manipulating the outcome.
As long as we aren't running the sequencer, the system remains tamper-proof, even against us. Read Security model
Integrate in a few lines
Below is an example consumer contract implementing `IEntropyConsumer` (see ABCEntropyExample.sol for the full source code and detailed inline comments):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@pulsartronic/entropy/Definitions.sol";
struct UserState {
EntropyRequest entropy_request;
HashRecord hash_record;
}
contract ABCEntropyExample is IEntropyConsumer {
IABCEntropy public abc_entropy;
mapping(address => UserState) public user_state_map;
event RandomEvent(address user, bytes32 random_number);
constructor() {
// Arbitrum Sepolia example address.
abc_entropy = IABCEntropy(0x295A56c7ed8083c33c23C125187A0E840dc7E379);
}
function get_entropy(bytes32 user_entropy) external payable {
bytes memory a_seed = abi.encodePacked(user_entropy, msg.sender);
bytes32 entropy_a = keccak256(a_seed);
UserState storage user_state = user_state_map[msg.sender];
bytes32 callback_id = bytes32(uint256(uint160(msg.sender)));
uint256 callback_gas_limit = 50000;
uint256 fee = abc_entropy.get_fee(callback_gas_limit);
// Request a randoom number.
user_state.entropy_request = abc_entropy.get{value: fee}(
callback_id,
callback_gas_limit,
user_state.hash_record.id,
entropy_a
);
}
function entropy_callback(
bytes32 callback_id, EntropyResponse calldata entropy_response
) external payable {
require(msg.sender == address(abc_entropy), "INVALID_PROVIDER");
address user = address(uint160(uint256(callback_id)));
UserState storage user_state = user_state_map[user];
// Get the requested random number.
Verified memory verified = abc_entropy.verify(
user_state.hash_record.hash,
user_state.entropy_request,
entropy_response
);
// Emit an event with the generated random number.
if (verified.b || bytes32(0) == user_state.hash_record.hash) {
user_state.hash_record = verified.next_hash_record;
emit RandomEvent(user, verified.random_number);
}
}
}
Built for production dapps
Verifiable
Every number ships with a proof that anyone can check on-chain.
Fast
Results arrive in your callback within a few seconds on supported chains.
Predictable cost
One flat fee per request, readable from the contract with get_fee().
Simple to integrate
One request function, one callback. No off-chain infrastructure to run.
Supported networks
| Mainnets | Contract | Fee per request |
|---|---|---|
| Monad | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | ~0.005$ |
| Arbitrum One | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | ~0.005$ |
| Optimism | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | ~0.005$ |
| Base | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | ~0.005$ |
| Binance | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | ~0.005$ |
| Testnets | Contract | Fee per request |
|---|---|---|
| Monad | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | ~0.00$ |
| Arbitrum | 0x29A269640D240B4d08e74b2564832aEcA00484FC | ~0.00$ |
| Optimism | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | ~0.00$ |
| Base | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | ~0.00$ |
| Binance | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | ~0.00$ |
Security Model
ABC Entropy relies on a cryptographically secure commit-reveal architecture designed to prevent any single party from predicting, altering, or rigging the final outcome. The resulting random number is derived by combining three independent entropy sources:
How the Trust Guarantee Works
random_number = keccak256(A, B, C)
- Entropy A is the user contribution (a seed generated by your front-end dApp).
- Entropy B is our contribution, which we first publish as "hash(B)"
- Entropy C is the block hash in which your dApp sends A requesting B (It places A before C).
why
Mitigating external threats is "easy". The core challenge in building a verifiable random number oracle is preventing ourselves from acting as a privileged user within your dApp.
This threat is neutralized through Entropy C:
- Even though we could know Entropies A and B in advance (by acting as a user), we couldn't know C before we commit to A and B, which prevents any pre-calculation.
- Something similar would happen to the Sequencer where it could know Entropies A and C in advance, but not B.
Trust Assumptions
This security model remains fully tamper-proof as long as the service provider (us) does not control the entity generating Entropy C (the sequencer). We mitigate this risk by letting you choose your preferred sequencer from a (growing) list, making it unlikely that we control all available options.
Get your first random number
Open our example contract in remix and obtain your first random number.