Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalodner committed Sep 4, 2020
2 parents 5531fe1 + c1e1444 commit b04e2a7
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 84 deletions.
2 changes: 1 addition & 1 deletion docs/ArbOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Supporting these functions in Layer 2 trusted software, rather than building the

The use of a Layer 2 trusted operating system does require some support in the architecture, for example to allow the OS to limit and track resource usage by contracts

For a detailed specification describing the format of messages used for communication between clients, the EthBridge, and ArbOS, see the [ArbOS Message Formats Specification](ArbOS_formats.md).
For a detailed specification describing the format of messages used for communication between clients, the EthBridge, and ArbOS, see the [ArbOS Message Formats Specification](ArbOS_Formats.md).
7 changes: 4 additions & 3 deletions docs/Arbsys.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Any contract running on an Arbitrum Chain can call the chain's ArbSys.

ArbSys lives at address `0x0000000000000000000000000000000000000064` on every Arbitrum chain.
To call it, write something like this:

```solidity
uint256 txCount = ArbSys(address(100)).getTransactionCount();

```
Here is the interface offered by ArbSys:

```solidity
interface ArbSys {
// Send given amount of ERC-20 tokens to dest with token contract sender.
// This is safe to freely call since the sender is authenticated and thus
Expand All @@ -37,3 +37,4 @@ Here is the interface offered by ArbSys:
// able to call it
function getStorageAt(address account, uint256 index) external view returns (uint256);
}
```
51 changes: 20 additions & 31 deletions docs/Contract_Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,46 @@ Arbitrum supports standard EVM contract deployment. This allows standard Solidit

To deploy your contracts, you need to set your deployment tool to deploy on an Arbitrum rollup chain instead of Ethereum. While this should be straightforward, we include instructions for some build systems here, and we will add to the list over time. If you're using a build system that's not listed here and having trouble configuring it, please reach out to us on [Discord](https://discord.gg/ZpZuw7p).

## Truffle
## Truffle

To port an existing truffle configuration:

1. First add the `arb-ethers-web3-bridge`, `ethers`, and `arb-provider-ethers` to your project:
1. First add the `arb-ethers-web3-bridge` to your project:

```bash
yarn add --dev arb-ethers-web3-bridge ethers@^4.0.44 arb-provider-ethers
yarn add --dev arb-ethers-web3-bridge
```

2. Edit the `truffle-config.js`:

- Import `arb-ethers-web3-bridge` and `ethers`, and `arb-provider-ethers`, and set the mnemonic at the top of the file:
- Import `wrapProvider` from `arb-ethers-web3-bridge` and set the mnemonic and the url to an Arbitrum aggregator at the top of the file:

```js
const ethers = require('ethers')
const ArbEth = require('arb-provider-ethers')
const ProviderBridge = require('arb-ethers-web3-bridge')
const wrapProvider = require('arb-ethers-web3-bridge').wrapProvider
const HDWalletProvider = require('@truffle/hdwallet-provider')
const mnemonic =
'jar deny prosper gasp flush glass core corn alarm treat leg smart'
const arbProviderUrl = 'http://localhost:8547/'
```


- Add the `arbitrum` network to `module.exports`:

```js
module.exports = {
networks: {
arbitrum: {
provider: function () {
// Provider to the L1 chain that the rollup is deployed on
const provider = new ethers.providers.JsonRpcProvider(
'http://localhost:7545'
)
const arbProvider = new ArbEth.ArbProvider(
'http://localhost:1235', // Url to an Arbitrum validator with an open rpc interface
provider
)
const wallet = new ethers.Wallet.fromMnemonic(mnemonic).connect(
provider
)
return new ProviderBridge(
arbProvider,
new ArbEth.ArbWallet(wallet, arbProvider)
)
}
network_id: "*",
gasPrice: 0
}
}
};
arbitrum: {
provider: function () {
// return wrapped provider:
return wrapProvider(
new HDWalletProvider(mnemonic, arbProviderUrl)
)
},
network_id: '*',
gasPrice: 0,
},
},
}
```

Now that the truffle project is set up correctly, just run migrate to deploy your contracts
Expand Down
43 changes: 6 additions & 37 deletions docs/Developer_Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,26 @@ custom_edit_url:https://github.com/OffchainLabs/arbitrum/edit/master/docs/Develo

Arbitrum is a suite of Ethereum scaling solutions that enables high-throughput, low cost smart contracts while remaining trustlessly secure. Arbitrum has three modes: AnyTrust Channels, AnyTrust Sidechains, and Arbitrum Rollup. The following documentation describes how to use Arbitrum Rollup, which is currently live on testnet. Whether you're a developer that just wants to start building or you're curious into digging deeper into the internals of Arbitrum and how it works, this site is the right place for you.


### How does Arbitrum work?

If you're looking to discover how Arbitrum works, the best place to begin is by the [Rollups basics](Rollup_basics.md) section, which gives a high level overview of Arbitrum's internals. From there, you can jump into more detailed explainers on various components of the system.

### How Can I Start Buidling

The very first step to start building with Arbitrum is [installing](Installation.md) Arbitrum and its dependencies. Next, you'll need to have deploy an Arbitrum chain on an L1 blockchain. Arbitrum Rollup supports deployment both on a [local testnet](Local_Blockchain.md) and on the [Rinkeby Testnet](Rinkeby.md). The following quickstart walks through deployment of an Arbitrum Rollup chain on the local testnet.
The very first step to start building with Arbitrum is [installing](Installation.md) Arbitrum and its dependencies. Next, you'll need to have deploy an Arbitrum chain on an L1 blockchain. Arbitrum Rollup supports deployment both on a [local testnet](Local_Blockchain.md) and on the [Rinkeby Testnet](Rinkeby.md). The following quickstart walks through deployment of an Arbitrum Rollup chain on the local testnet.

Note that Abitrum chains support dynamic launching of contracts, so you don't need to setup an Arbitrum chain for each application you build, and indeed you may deploy your contracts on a testnet chain which you did not launch. The benefits of having multiple applications on the same Arbitrum Rollup chain is that they'll be able to interact synchronously, just as they would if they were launched directly on Ethereum.
Note that Abitrum chains support dynamic launching of contracts, so you don't need to setup an Arbitrum chain for each application you build, and indeed you may deploy your contracts on a testnet chain which you did not launch. The benefits of having multiple applications on the same Arbitrum Rollup chain is that they'll be able to interact synchronously, just as they would if they were launched directly on Ethereum.

Once you have deployed Arbitrum, you can [build and run the demo app](#hello-arbitrum) or [deploy your own contracts](Contract_Deployment.md).

**Want to learn more? Check out the** [**open source code**](https://github.com/offchainlabs/arbitrum)**. Join the team on** [**Discord**](https://discord.gg/ZpZuw7p)**.**

## Setup Blockchain

To build a docker image hosting a local test blockchain docker image with Arbitrum smart contracts already deployed, run:

```bash
yarn docker:build:geth
```

To start the local blockchain inside the Arbitrum monorepo, run:

```bash
yarn docker:geth
```

## Setup Rollup
## Setup Local Geth and Rollup BlockChain

To deploy a rollup chain, and initialize one or more validators, run:

```bash
yarn demo:initialize [--validatorcount N]
```

To launch the validators initialized in the previous step, run:

```bash
yarn demo:deploy
```

> Note: this step may take about 10 minutes the very first time. Subsequent
> builds are much faster. You can also use the `--up` flag to skip builds
> if one has completed successfully before.

The local test blockchain and the validators should be running for all steps inside this tutorial. Note that
stopping and restarting the client will lose all blockchain state, but the validators can be relaunched without losing state.
See [Local Blockchain Setup](https://github.com/OffchainLabs/arbitrum/blob/master/docs/Local_Blockchain.md).

## Hello, Arbitrum

Now you'll deploy and run a demo dApp on Arbitrum. The dApp is based on
a simple Pet Shop dApp that is used in a Truffle tutorial.

Expand Down
14 changes: 7 additions & 7 deletions docs/Ethereum_Interoperability.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ All standard methods of transferring Eth or tokens, if executed within an Arbitr

### Ethereum to Arbitrum

To move assets into an Arbitrum chain, you execute a deposit transaction on Arbitrum's global EthBridge. This transfers funds to the EthBridge on the Ethereum side, and credits the same funds to you inside the Arbitrum chain you specified. In the case of an ERC-20 or ERC-721 transfer, the Arbitrum chain will spawn a token contract of the correct type within the Arbitrum chain, at the same token contract address as the token has on Ethereum.
To move assets into an Arbitrum chain, you execute a deposit transaction on Arbitrum's global EthBridge. This transfers funds to the EthBridge on the Ethereum side, and credits the same funds to you inside the Arbitrum chain you specified. In the case of an ERC-20 or ERC-721 transfer, the Arbitrum chain will spawn a token contract of the correct type within the Arbitrum chain the first time a given token is deposited, at the same token contract address as the token has on Ethereum.

As far as Ethereum knows, all deposited funds are held by Arbitrum's global EthBridge contract.

In order to programmatically trigger transfers, call one of the following methods in the [`GlobalInbox`](https://github.com/OffchainLabs/arbitrum/blob/master/packages/arb-bridge-eth/contracts/GlobalInbox.sol) contract with the chain address equal to the address of the Arbitrum Rollup chain.

```
```solidity
function depositEthMessage(address chain, address to) external payable;
function depositERC20Message(
address chain,
Expand All @@ -41,13 +41,13 @@ function depositERC721Message(
### Withdrawing funds from Arbitrum to Ethereum

- Eth: The ArbSys library can be used to withdraw Eth, `ArbSys(100).withdrawEth(destAddress, amount)`
- ERC-20 and ERC-721: The system generated token contracts in Arbitrum contain a withdraw method
```
- ERC-20 and ERC-721: The system generated token contracts in Arbitrum contain a withdraw method:
```solidity
function withdrawERC20(address dest, uint256 amount) external;
function withdrawERC721(address dest, uint256 id) external;
```

In all cases, withdrawing is similar to a transfer, except the balance is burned on the Arbitrum side, and eventually those funds away become available to their destination on the Ethereum side.
In all cases, withdrawing is similar to a transfer, except the balance is burned on the Arbitrum side, and eventually those funds become available to their destination on the Ethereum side.

When your withdraw transaction is fully confirmed, the withdrawn funds will be put into your "lockbox" in the EthBridge.
At any time you can call the EthBridge to recover the funds in your lockbox.
Expand All @@ -58,12 +58,12 @@ At any time you can call the EthBridge to recover the funds in your lockbox.

All client-generated transaction calls on the Arbitrum chain are sent through the EthBridge using:

```
```solidity
function sendL2Message(address chain, bytes calldata messageData) external;
```

Generally calls will come in batches from an aggregator as described in Transaction Lifestyle. However, Arbitrum supports a number number of different message types described in [ArbOS Formats](ArbOS_Formats.md).

## Transaction calls from Arbitrum to Ethereum

In our initial Rollup release, we are not supporting transaction calls from contracts in a Arbitrum chain to Ethereum contracts. In the future, support for this functionality will be added.
In our initial Rollup release, we are not supporting transaction calls from contracts in an Arbitrum chain to Ethereum contracts. In the future, support for this functionality will be added.
8 changes: 4 additions & 4 deletions docs/Rollup_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Validators will deposit currency stakes, which they will lose if they behave dis

An ArbChain contains a set of contracts.
Over time, you can launch new contracts in an ArbChain, and contracts can self-destruct, exactly as they do on the Ethereum blockchain.
Arbitrum supports EVM, and therefore supports Solidity contracts. See (Solidity Support)[Solidity_Support.md] for a list of the few Solidity features which Arbitrum does not support.
Arbitrum supports EVM, and therefore supports Solidity contracts. See [Solidity Support](Solidity_Support.md) for a list of the few Solidity features which Arbitrum does not support.


## How to make an ArbChain


Suppose you’re a developer who has written a dApp for the Ethereum platform. Arbitrum interoperates with Ethereum, so you can launch your dapp on an Arbitrum Rollup chain and get better speed and scalability.

You’re starting with a dapp—or you’re planning to develop one—that’s made up of some contracts written in Solidity, along with a browser-based front end. Here’s how to use Arbitrum with your dapp. Arbitrum supports dynamic launching of contracts on deployed chains just as in Ethereum by sending transactions to address zero or by using the CREATE and CREATE2 opcodes. Arbitrum is fully compatible with standard build tools (e.g. Truffle, Buidler). You can either launch your dApp on a new Rollup or deploy it to an existing one. Here, we describe the process for launching a new chain.
You’re starting with a dapp—or you’re planning to develop one—that’s made up of some contracts written in Solidity, along with a browser-based front end. Here’s how to use Arbitrum with your dapp. Arbitrum supports dynamic launching of contracts on deployed chains just as in Ethereum by sending transactions to address zero or by using the `CREATE` and `CREATE2` opcodes. Arbitrum is fully compatible with standard build tools (e.g. Truffle, Buidler). You can either launch your dApp on a new Rollup or deploy it to an existing one. Here, we describe the process for launching a new chain.

First, you’ll want to identify an initial set of validators for your chain. We’ll talk later about how you might choose validators, and why people might want to validate a chain. Of course, validators will be able to come and go at will once the chain is going.

Expand All @@ -58,14 +58,14 @@ The Arbitrum protocol ensures that an honest party can always win challenges.
This deters dishonesty, and it ensures that any one honest party can force correct behavior, even if everyone else is dishonest.
That's what makes ArbChains trustless.

For more information on how validators advance a chain and resolve disputes, see [Progress and Dispute Resolution](Dispute_Resolution.md)
For more information on how validators advance a chain and resolve disputes, see [Progress and Dispute Resolution](Dispute_Resolution.md).

### Who will validate your ArbChain?

At this point, you might be wondering who will be validators of your ArbChain.
Arbitrum allows anyone to validate any ArbChain, but who will step up and do it?

Although validation is permissionless and anyone _can_ validate, it's important to make sure that each ArbChain always has one honest validator that is paying attention. As a dApp developer, you would probably want to validate your dApp's ArbChain, to help ensure its correctness and show confidence in your dApp.
Although validation is permissionless and anyone _can_ validate, it's important to make sure that each ArbChain always has at least one honest validator that is paying attention. As a dApp developer, you would probably want to validate your dApp's ArbChain, to help ensure its correctness and show confidence in your dApp.

For developers who do not want to validate themselves, you'll be able to hire a validator-as-a-service to validate your ArbChain once Arbitrum is released for production.
You might want to hire more than one, if you or your users worry that one might misbehave. As long as any validator behaves honestly, the Arbitrum protocol guarantees that all contracts in the ArbChain will run correctly according to their code.
Expand Down
2 changes: 1 addition & 1 deletion docs/Withdrawals.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Withdrawals

As discussed in the section on [finality](Finality.md), because Arbitrum's execution happens optimistically, the Ethereum blockchain cannot immediately confirm the correct state and must wait for the challenge window to expire (or until all challenges are resolved).

When it comes to execution within the Rollup this does not pose any problem or add any delay. The [Arbitrum Rollup protocol](Rollup_Protocol.md) manages a tree of assertions, and allows validators to pipeline execution by continuing to build the tree even before all nodes are confirmed. This means that an honest validator can continue to advance the state of the machine with confidence (and the ability to enforce) that eventually Ethereum will recognize the honest branch as the correct and valid one. And although it will take some time for Ethereum to recognize which branch is correct, anyone that is validating the chain will immediately know this. Ayone that is validating the chain will immediately know which branch is correct and therefore which branch will eventually be accepted by the protocol.
When it comes to execution within the Rollup this does not pose any problem or add any delay. The [Arbitrum Rollup protocol](Rollup_Protocol.md) manages a tree of assertions, and allows validators to pipeline execution by continuing to build the tree even before all nodes are confirmed. This means that an honest validator can continue to advance the state of the machine with confidence (and the ability to enforce) that eventually Ethereum will recognize the honest branch as the correct and valid one. And although it will take some time for Ethereum to recognize which branch is correct, anyone that is validating the chain will immediately know this. Anyone that is validating the chain will immediately know which branch is correct and therefore which branch will eventually be accepted by the protocol.

The one part of the protocol that is affected by the confirmation delay is withdrawals. Since Arbitrum cannot undo a withdrawal once it has released funds from the L2, the system cannot allow funds to be withdrawn from the ArbChain until it has been confirmed on the Ethereum chain that the withdrawal is valid.

Expand Down

0 comments on commit b04e2a7

Please sign in to comment.