Arbitrum has three modes: channels, AnyTrust sidechains, and rollup. Channels and sidechains provide the AnyTrust Guarantee which ensures that the code will run correctly as long as any validator is honest.
The following documention describes how to use Arbitrum Rollup.
To build a docker image hosting a local test blockchain docker image with Arbitrum smart contracts already deployed, run:
To start the local blockchain inside the Arbitrum monorepo, run:
The local test blockchain should be running for all steps inside this tutorial. Note that stopping and restarting the client will lose all blockchain state.
Now you'll compile and run a demo dApp on Arbitrum. The dApp is based on a simple Pet Shop dApp that is used in a Truffle tutorial.
Inside the Arbitrum monorepo, open the
pet-shop demo dApp:
Build and Run
Compile Solidity to Arbitrum:
Truffle will output the compiled contract as
truffle migrate --network arbitrum
Create a rollup chain with the given
contract.aoand prepare 3 validators to validate it.
../../scripts/setup_local_rollup.py contract.ao 3
Note: this step may take about 10 minutes the very first time. Subsequent builds are much faster. You can also use the
--upflag to skip builds if one has completed successfully before.
Run the 3 validators given a path to the
validator-statesfolder created by the previous command
Examine the output from the previous step
When pet-shop is finished being deployed, you should start seeing blocks of text like:
arb-validator1_1 | 2020/02/04 16:25:43 arb-validator1_1 | == nodes: arb-validator1_1 | == 0:3097fd arb-validator1_1 | == 3:e01d08 leaf latestConfirmed stake:dec077 stake:bcaf2d arb-validator1_1 | == stakers: arb-validator1_1 | == depth:1 addr:dec077 created:5733000 loc:e01d08 arb-validator1_1 | == depth:1 addr:bcaf2d created:5733000 loc:e01d08
Use the DApp
Once Metamask is installed, open it and select
Import Accountand enter one of the following pre-funded private keys
0x979f020f6f6f71577c09db93ba944c89945f10fade64cfc7eb26137d5816fb76 0xd26a199ae5b6bed1992439d1840f7cb400d0a55a0c9f796fa67d7c571fbb180e 0xaf5c2984cb1e2f668ae3fd5bbfe0471f68417efd012493538dcd42692299155b 0x9af1e691e3db692cc9cad4e87b6490e099eb291e3b434a0d3f014dfd2bb747cc 0x27e926925fb5903ee038c894d9880f74d3dd6518e23ab5e5651de93327c7dffa 0xe4b33c0bb790b88f2463facaf86ae7c17cbdab41187e69ddde8cc1c1fda7c9ab
Select local network test in Metamask
- Go back to Metamask or click the extension icon
Main Ethereum Networktop right hand side
Local Testas the network name
http://127.0.0.1:7545as the RPC url
- Press the save button
- Metamask should now have an Local Test account holding ETH
Launch the front-end
In another session navigate to
The browser will open to localhost:8080
In the popup window that appears, select
Adopt some pets
The pet shop dapp should now be running in your browser. Choose a pet or two and click the adopt button to adopt your new animal friend(s).
If you want to try another dapp run, first run the following to compile the Solidity contract and deploy validators:
cd demos/election truffle migrate --network arbitrum ../../scripts/setup_local_rollup.py contract.ao 3 ../../scripts/arb_deploy.py validator-states
Then open a new command line session, navigate to
demos/election, and run: