Skip to content
D20DAO

Why Does a Direct Wallet VRF Request Revert?

Diagnose D20DAO's ContractConsumerRequired error on Arc and Robinhood Chain. Separate wallet sponsorship, contract consumer, callback authentication and refund address.

Start with the account that called the coordinator

A developer connects a wallet to a contract explorer, supplies the VRF request fee and calls D20DAO's coordinator directly. If that immediate calling address has no runtime code, the current Arc and Robinhood coordinators reject creation with ContractConsumerRequired. Decode the revert before adjusting the request's gas or payment.

The relevant check is msg.sender.code.length. It examines the immediate caller of the coordinator. The transaction's signing wallet can sponsor an application's request while a deployed application contract makes the coordinator call and receives the eventual callback. Those are different roles in the same transaction.

Use the application's request entry point

For a matchmaking application, a wallet normally calls the deployed matchmaking contract's documented request method. That contract pays the quoted service fee when it calls requestRandomness or requestMappedRandomness. The coordinator records the calling contract as the consumer.

Trace that call path when debugging: wallet to application consumer, then consumer to coordinator. Keep the returned request ID associated with the match. Sending the wallet's transaction directly to the coordinator changes the immediate caller and bypasses the application's state setup. Use the selected chain's deployment manifest to verify the coordinator address configured in the consumer.

Complete consumer deployment before opening a request

A contract under construction does not yet have its final runtime code installed. Calling the coordinator from that constructor can therefore encounter the same code-length rejection, even though the intended caller is an application contract. Solidity stores the final code after constructor execution completes.

Finish construction before invoking the consumer's request entry point. A factory can deploy the consumer and call it afterward within the same transaction; no extra block is inherently required. Verify its address, coordinator and application initialization. A predicted address alone does not establish that the expected runtime code is available.

Authenticate the callback from the configured coordinator

D20VRFConsumer binds an immutable vrfCoordinator address in its constructor. Its rawFulfillRandomness entry point checks that msg.sender equals that address before calling the application's fulfillment hook. Configure the coordinator proxy for the chosen network when deploying the consumer.

A keeper wallet submitting a proof is not the callback sender: the coordinator performs the consumer call after accepting the proof. Application code should preserve that authentication boundary. A direct wallet call to the callback must not be treated as a valid result, and a consumer configured with the wrong coordinator will reject delivery from another address.

Runtime code alone does not prove callback compatibility

The creation guard checks for code; it is not a complete interface or application-readiness test. A code-bearing wallet, forwarder or other contract needs a design that accepts the expected callback and associates its request with the correct operation. An account's wallet label alone does not tell you whether it passes the check.

The current coordinators deliver rawFulfillRandomness to the stored consumer using a low-level call. Its reported success does not independently prove that the intended application hook ran or that a match was finalized. Verify the actual consumer behavior and stored application result. This guide does not claim support for any particular delegated-wallet setup.

Keep the refund address separate from the consumer

The refundAddress argument identifies where eligible fee refunds and credits belong. Supplying a contract there does not make that contract the consumer and does not satisfy the immediate-caller guard. Conversely, the wallet paying for a matchmaking operation is not automatically the address that receives its callback.

Document four fields in the application's integration record: sponsoring wallet, consumer, coordinator and fixed refund recipient. Review them separately in the creation receipt and application configuration. If the refund recipient is a contract, its ability to receive or withdraw refunds needs an explicit implementation path.

Use the documented API for an offchain application

An offchain service that needs a verifiable selection can use D20DAO's documented HTTP agent API instead of directly invoking the contract request method from a code-free wallet. The service opens its underlying requests on Arc; that API description should not be generalized into a Robinhood Chain endpoint.

Choose the access path around where the application must consume the result. Contract integrations need authenticated onchain delivery and application state handling. HTTP clients need their documented response, evidence and recovery flow. An SDK installation does not turn a wallet address into a callback-compatible consumer.

Check caller identity and delivery before integration

Use these acceptance requirements for local application tests. They are proposed checks, not executed deployments or integration results:

  1. Call creation from an address without runtime code and confirm the expected consumer-required rejection.
  2. Open a request through the deployed application and verify that the recorded consumer is that application.
  3. Reject a callback from an unrelated wallet or coordinator address.
  4. Authenticate a valid callback, retain its request association and check the stored application result.
  5. Exercise constructor-time creation, incompatible callback code and a refund address distinct from the consumer.