Just run truffle unbox RhombusNetwork/lighthouse-local
from your command line
A game where users can deposit and bet ether on the outcome of a dice roll. Created to showcase the Rhombus lighthouse oracle local testing capabilities. Created truffle, test cases written in both solidity and javascript, random numbers generated by a Rhombus oracle.
Rhombus deploys oracles to main/test Etherium networks for you to use. These oracles (called Lighthouses) store verified values from outside the chain, such as New York City temperature, Amazon stock prices, or randomly generated numbers.
While useful, it is hard for projects under development to simulate interactions with a lighthouse. Developers must build the whole project, deploy on a test net, and then interact with the lighthouse to see if data reading works. This is tedious and would speed up development if data reading could be tested on a local testing chain as the project is under development
Using the Truffle and Ganache development environment, users are able to quickly create a local blockchain to experiment with. Projects will be deployed on this local chain that is under your control, and tests suites can be written to interact your smart contract under development.
Rhombus local testing utilizes Truffle tests. If you are unfamiliar with Truffle, first go through their testing documentation here.
To set up a copy of the main/test net scenario, users will first deploy their own lighthouse on the local Ganache chain. Then they will need to write a hard coded value (say NYC temperature) into the lighthouse. This is all done by the Rhombus team on main/test nets! Users are only deploying this local lighthouse to simulate our setup.
Now that the lighthouse is deployed, users can deploy their smart contract and pass it the lighthouse address where it will go to obtain information, all in the same testing file. Now users have both the lighthouse and smart contract under development on one local chain, and can interact with each other!
To get started, look through this sample project which showcases the Rhombus Local Testing capabilities. We support both Solidity and Javascript tests
Alice wants to start a casino where players can bet Ether on the outcome of a dice roll. Unfortunately, it is hard to generate truly random numbers on the Etherium blockchain. To help her, the Rhombus team have created a oracle which will periodically obtain a random number generated off-chain, and store it into a lighthouse. Now Alice is all set to start her gambling game!
Users will first deposit money into the smart contract, then they can place bets on the outcome of the next dice roll. Once the dice roll happens, users will either lose the ether they have bet, or win back returns on their bet. They can withdraw all their deposited and earned ether at any time.