- Is open source and is a blockchain-native service that developers can easily integrate into their dApps.
- Is based on the Signidice algorithm and RSA verification. Signidice was chosen for its excellent randomization and non-gameablity characteristics, in addition to yielding a cleaner workflow for dApp developers and being provably fair. RSA verification ensures uniqueness of the signature and removes the ability for the results to be manipulated (if any other type of signing algorithm were used, it would allow many valid signatures for the same signing_value which could result in manipulation).
- Can easily be established as provably fair. The self-verifying WAX RNG Native Blockchain Service confirms that the RSA signature that comes back from the WAX RNG oracle is valid and authentic before being utilized by the dApp. When dApp customers can easily establish fairness, they have a higher degree of confidence in using the dApp.
For more information, check out the WAX blog.
-
Requirements
- docker, installed and configured to run without sudo
- make
-
Build and test
# Build the smart contract make docker-build # Run tests npm install npm run test
WAX RNG allows dapps to pay for their own bandwidth, which can prevent your dapp from losing service during times of high activity on the rng contract. In the future, WAX will reduce the free bandwidth available for dapps, so it is a good idea to migrate to this to ensure your dapp is always up with respect to random number generation.
- create new permission name
paybw
and delegate it tooracle.wax@rngops
cleos set account permission payer111111 paybw '{"threshold":1,"keys":[],"accounts":[{"permission":{"actor":"oracle.wax","permission":"rngops"},"weight":1}]}' -p payer111111
- Allow
paybw
permission to callboost.wax
noop
cleos set action permission payer111111 boost.wax noop paybw
- Dapp register for bandwith payer
cleos push action orng.wax setbwpayer '["dapp11111111", "payer111111"]' -p dapp11111111
- Payer accept to pay bandwidth
cleos push action orng.wax acceptbwpay '["dapp11111111", "payer111111", true]' -p payer111111
To pay bandwidth for multiple contracts under one bandwdth paying account:
-
Permission your payer account as in steps 1 and 2 in the previous section "Register bandwidth payer"
-
Do multiple
setbwpayer
actions as in the previous section using the same payer account for each. The contract being allowed must make the request
cleos push action orng.wax setbwpayer '["dapp1", "payer111111"]' -p dapp1
cleos push action orng.wax setbwpayer '["dapp2", "payer111111"]' -p dapp2
cleos push action orng.wax setbwpayer '["dapp3", "payer111111"]' -p dapp2
- Payer must accept each set bandwidth payer request:
cleos push action orng.wax acceptbwpay '["dapp1", "payer111111", true]' -p payer111111
cleos push action orng.wax acceptbwpay '["dapp2", "payer111111", true]' -p payer111111
cleos push action orng.wax acceptbwpay '["dapp3", "payer111111", true]' -p payer111111
WAX RNG support developer to record error message to smart contract. Dapp need to delegate permission for oracle.wax, and has RAM to pay for store error message.
- create new permission name
ornglog
and delegate it tooracle.wax@rngops
cleos set account permission dapp11111111 ornglog '{"threshold":1,"keys":[],"accounts":[{"permission":{"actor":"oracle.wax","permission":"rngops"},"weight":1}]}' -p dapp11111111
- Allow
ornglog
permission to callorng.wax
dapperror
cleos set action permission dapp11111111 orng.wax dapperror ornglog
- Set error log size
Last N error message will be stored on smart contract table
cleos push action orng.wax seterrorsize '["dapp11111111", 10]' -p dapp11111111
- Check for error message
Check table errorlog.a
with scope is dapp contract name
cleos get table orng.wax dapp11111111 errorlog.a