Random

Rand module allows you to post a random number request to the IRIS Hub and query the random numbers or the pending random number requests.

Available Commands

NameDescription
requestRequest a random number with an optional block interval
randomQuery the generated random number by the request id
queueQuery the pending random number requests with an optional height

iris tx random request

Request a random number.

iris tx random request [flags]

Flags:

Name, shorthandTypeRequiredDefaultDescription
--block-intervaluint64true10The block interval after which the requested random number will be generated
--oracleboolfalseWhether to use the oracle method
--service-fee-capstring""Max service fee, required if "oracle" is true

Request a random number

Post a random number request to the IRIS Hub, the random number will be generated after --block-interval blocks.

# without oracle
iris tx random request --block-interval=100 --from=<key-name> --chain-id=irishub --fees=0.3iris

# with oracle
iris tx random request --block-interval=100 --oracle=true --service-fee-cap=1iris --from=<key-name> --chain-id=irishub --fees=0.3iris

TIP

You will get a unique request id if the tx is committed, which can be used to query the status of the request. You can also query the tx detail to get the request id.

iris query random random

Query the generated random number by the request id.

iris query random random <request-id> [flags]

iris query random queue

Query the pending random number requests with an optional block height.

iris query random queue <gen-height> [flags]

Query random number request queue

Query the pending random number requests with an optional block height at which random numbers will be generated or request service.

iris query random queue 100000