Skip to content

Commit

Permalink
Move all docs to monorepo (#132)
Browse files Browse the repository at this point in the history
* add docs to monorepo

* random updates

* add images

* GitBook: [#2] No subject

* GitBook: [#3] No subject

* Update README.md

* update TOC

* Update README.md

* Update README.md

* restructure

* Update SUMMARY.md

* work1

* work2

* Update 001_how-to-bridge.md

* work3

* work4

* work5

* work6

* Update 000_developer_start.md

* work 7

* work 8

* Update 000_developer_start.md

* Update 000_developer_start.md

* work9

* work10

* Update xdomain-tx-status.md

* Update xdomain-tx-status.md

* more cleanup

* Update SUMMARY.md

* Update README.md

* Update README.md

* work 11

* Update AWS_lambda_setup.md

* work 12

* Update README.md

* work 13

* work 14

* update links

* work 15

* work 16

* Update README.md

* Update README.md

* work 16

* Update 001_how-to-bridge.md (#134)

Co-authored-by: Gian-Bobarino <[email protected]>

* Update 001_how-to-bridge.md

* work 17

* work 18

* Update developer-start.md

* work 19

* Update faq.md

* work 19

* Update xdomain-tx-status.md

* Update xdomain-tx-status.md

* work 20

* work 21

* Update README.md

* Update SUMMARY.md

* work 21

* work 22

* work 22

* instructions for adding new tokens

* Update fee docs (#136)

* docs: cleanup bridge docs (#137)

* cleanup bridge docs

* fix link

* work 22

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* work 23

* Update price-feeds.md

* work 24

* work 25

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update price-feeds.md

* Update price-feeds.md

* Update price-feeds.md

* work 26

* Update README.md

* work 27

* work 29

* Update README.md

* work 29

* Update documentation.md

* Update documentation.md

* add turing overview

* Update turing.md

* Update turing.md

* Update turing.md

* Update turing.md

* work 30

Co-authored-by: Boba Lab <[email protected]>
Co-authored-by: Riedl Kevin, Bsc <[email protected]>
Co-authored-by: Gian-Bobarino <[email protected]>
Co-authored-by: Boyuan-Chen <[email protected]>
Co-authored-by: Souradeep Das <[email protected]>
  • Loading branch information
6 people authored Apr 30, 2022
1 parent 56fd18c commit ed5f05f
Show file tree
Hide file tree
Showing 113 changed files with 2,776 additions and 32,229 deletions.
47 changes: 15 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
<div align="center">
<a href="https://forum.boba.network"><img alt="Boba" src="https://github.com/bobanetwork/boba/blob/develop/packages/boba/gateway/src/images/boba2/logo-boba2.svg" width=400></a>
<br />
<h1> The Boba Monorepo</h1>
</div>

<p align="center">
<a href="https://github.com/bobanetwork/boba/actions/workflows/ts-packages.yml?query=branch%3Adevelop"><img src="https://github.com/bobanetwork/boba/actions/workflows/ts-packages.yml/badge.svg?branch%3Adevelop" /></a>
<a href="https://github.com/bobanetwork/boba/actions/workflows/integration.yml?query=branch%3Adevelop"><img src="https://github.com/bobanetwork/boba/actions/workflows/integration.yml/badge.svg?branch%3Adevelop" /></a>
<a href="https://github.com/bobanetwork/boba/actions/workflows/geth.yml?query=branch%3Adevelop"><img src="https://github.com/bobanetwork/boba/actions/workflows/geth.yml/badge.svg?branch%3Adevelop" /></a>
</p>

- [TL;DR](#tl-dr)
- [Documentation](#documentation)
- [Community and DAO](#community-and-dao)
- [Directory Structure](#directory-structure)
- [Contributing](#contributing)
* [Dependencies](#dependencies)
- [Spinning up the stack](#spinning-up-the-stack)
* [Helpful commands](#helpful-commands)
* [Running unit tests](#running-unit-tests)
* [Running integration tests](#running-integration-tests)
* [Viewing docker container logs](#viewing-docker-container-logs)
- [License](#license)

## TL;DR
---
description: Introduction to Boba Network
---

# Welcome to Boba

This is the primary place where [Boba](https://boba.network) works on the Boba L2, a compute-focused L2. Fundamentally, Ethereum is a distributed computer. We believe that L2s can play a unique role in augmenting the base _compute_ capabilities of the Ethereum ecosystem. You can learn more about Turing hybrid compute [here](./packages/boba/turing/README.md).

<a href="https://github.com/bobanetwork/boba/blob/develop/packages/boba/turing">
<img alt="Boba" src="https://github.com/bobanetwork/boba/blob/develop/packages/boba/gateway/src/images/boba2/turing.png" width=500>
</a>
![turing](./packages/boba/gateway/src/images/boba2/turing.png)

Boba is built on the Optimistic Rollup developed by [Optimism](https://optimism.io). Aside from its main focus, augmenting compute, Boba differs from Optimism by:
Boba is built on the Optimistic Rollup developed by [Optimism](https://optimism.io). Aside from it focus on augmenting compute, Boba differs from Optimism by:

* providing additional cross-chain messaging such as a `message-relayer-fast`
* using different gas pricing logic
Expand All @@ -44,7 +21,13 @@ This is the primary place where [Boba](https://boba.network) works on the Boba L

## Documentation

User focused documentation is available [on the Boba docs website](http://docs.boba.network/). Developer-focused documentation lives in [this folder](https://github.com/bobanetwork/boba/blob/develop/boba_documentation) and within the service and contract directories.
User focused documentation is available [on the Boba docs website](http://docs.boba.network/). Developer-focused documentation lives in [`./boba_documentation`](https://github.com/bobanetwork/boba/blob/develop/boba_documentation) and within the service and contract directories. If you have questions or feel like something is missing check out our [Discord server](https://discord.com/invite/YFweUKCb8a) where we are actively responding, or [open an issue](https://github.com/bobanetwork/boba/issues) in the GitHub repo for this site.

### Direct Support

[Telegram for Developers](https://t.me/bobadev)\
[Project Telegram](https://t.me/bobanetwork )\
[Discord](https://discord.com/invite/YFweUKCb8a)

## Directory Structure

Expand Down Expand Up @@ -93,7 +76,7 @@ You'll need the following:
* [Docker](https://docs.docker.com/get-docker/)
* [Docker Compose](https://docs.docker.com/compose/install/)

**Note: this is only relevant to developers who wish to work on Boba core services. For most test uses, e.g. deploying you contracts, it's simpler to use https://rinkeby.boba.network**.
**Note: this is only relevant to developers who wish to work on Boba core services. For most test uses, e.g. deploying your contracts, it's simpler to use https://rinkeby.boba.network**.

Clone the repository, open it, and install nodejs packages with `yarn`:

Expand Down
52 changes: 52 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Table of Contents

* [Welcome to Boba](README.md)
* [Bug Bounty Program](bug-bounty.md)
* [FAQ](faq.md)

* User Documentation
* [How To Bridge](boba\_documentation/user/001\_how-to-bridge.md)
* [Fraud Detection](boba\_community/fraud-detector/README.md)
* [NFTs](boba\_documentation/user/003\_nfts.md)
* [Running a Boba node](boba\_community/boba-node/README.md)

* [Welcome to Turing](boba\_documentation/developer/turing.md)
* [Turing BOBA Faucet](boba\_community/turing-captcha-faucet/README.md)
* [Turing KYC](boba\_community/turing-kyc/README.md)
* [Turing Monster Minting](boba\_community/turing-monsters/README.md)
* [Turing Wizard](boba\_community/turing-start/README.md)
* [Turing API Endpoints](packages/boba/turing/AWS\_code/AWS\_lambda\_setup.md)
* [Turing Implementation](packages/boba/turing/README.md)

* Developer Docs
* [Welcome to Boba](boba\_documentation/developer/developer-start.md)
* [Development Stack](boba\_documentation/developer/local-stack.md)
* [Basic Operations](boba\_documentation/developer/basic-ops.md)
* [Dual fee system](boba\_examples/boba-fee/README.md)
* [Contract Deployment Example](boba\_documentation/developer/contract-deployment.md)
* [Sending ETH to L2](boba\_examples/init-fund-l2/README.md)
* [Adding a new ERC20 to Boba](boba\_documentation/developer/add-new-token.md)
* [Fees](boba\_documentation/developer/fee-scheme.md)
* [Contract Addresses](boba\_documentation/developer/network-parameters.md)
* [xDomain Transaction Status](boba\_documentation/developer/xdomain-tx-status.md)
* [Verifying Contracts](boba\_documentation/developer/verify-smart-contracts.md)
* [Using The Graph](packages/boba/subgraph/README.md)
* [Replica node](boba\_community/boba-node/README.md)
* [Exchange Integration](boba\_documentation/developer/exchange-integration.md)
* [JSON-RPC API](boba\_documentation/developer/json-rpc-api.md)
* [Price Oracles](boba\_documentation/developer/price-feeds.md)
* [WAGMI](boba\_documentation/developer/wagmi.md)
* [NFT Bridging](boba\_examples/nft\_bridging/README.md)
* [Token Bridging](boba\_documentation/developer/bridge-l1-and-l2/bridge-basics.md)
* [Using the Standard Token Bridge](boba\_documentation/developer/bridge-l1-and-l2/standard-bridge.md)
* [Using the Fast Token Bridge](boba\_documentation/developer/bridge-l1-and-l2/fast-bridge.md)

* [Other](packages/README.md)
* [Boba Mainnet Addresses](packages/contracts/deployments/mainnet/README.md)
* [Boba Rinkeby Addresses](packages/contracts/deployments/rinkeby/README.md)
* [Liquidity Pools](packages/boba/contracts/contracts/LP/README.md)
* [Boba NFT Bridges](packages/boba/contracts/contracts/bridges/README.md)
* [Boba Straw Price Feed Oracle](packages/boba/contracts/contracts/oracle/README.md)
* [Gas Price Oracle](packages/boba/gas-price-oracle/README.md)
* [Contracts Registration](packages/boba/register/README.md)
* [Documentation HowTo](boba\_documentation/developer/documentation.md)
14 changes: 11 additions & 3 deletions boba_community/boba-node/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Running a Boba node (replica)

User-facing instructions are [here](https://docs.boba.network/developer-docs/011_running-replica-node).
The [boba_community/boba-node](../../boba_community/boba-node) repo runs a replica of the Boba L2geth, which is useful for generating analytics for blockexplorers and other specialized use cases.

## Minimal Instructions
## Basic Considerations

This repo runs a local replica of the Boba L2geth, which is useful for generating analytics for blockexplorers.
1. Running a local Boba node (replica) does not allow you to mine ETH, OMG, or BOBA. There is no mining on L2.

2. If you looking for best possible rpc read data (lowest possible latency) you are **strongly advised** not to run your own node, but to use **https://lightning-replica.boba.network**. This is an autoscaling rpc endpoint that speaks directly to the core Boba L2 geth.

3. The Boba L2 is (at present) a single proposer/sequencer system and the only way to write transactions is via **https://mainnet.boba.network**. You cannot use a local node to write transactions.

4. If your application _does not need autoscaling and low latency_, and can tolerate sync delays, you can run your own Boba node (replica). This replica will try to follow the core L2 geth via data provided by Infura and **https://lightning-replica.boba.network**, so it will necessarily lag behind **https://lightning-replica.boba.network**.

5. Please design your rpc connectors in a resource efficient manner. Notably, calling `eth_getLogs(fromBlock: 0)` 1000 times per second serves no conceivable purpose since the Ethereum blocktime is 12 seconds and the Boba blocktime is > 1 second. All that does is to degrade your replica and trigger rate-limiting and/or IP blocking at **https://lightning-replica.boba.network**.

## Prerequisites

Expand Down
24 changes: 9 additions & 15 deletions boba_community/fraud-detector/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
# Checking Boba Mainnet for Fraud

- [Fraud Detector](#fraud-detector)
* [0. Concepts](#0-concepts)
* [1. Errors and State Root Mismatches in Boba](#1-known-errors-and-state-root-mismatches-in-boba)
* [2. What do when you discover a state root mismatch](#2-what-do-when-you-discover-a-state-root-mismatch)
* [3. Running the Fraud Detector, the Verifier, and the Data Transport Layer (DTL)](#3-running-the-fraud-detector--the-verifier--and-the-data-transport-layer--dtl-)
---
description: Learn how to help detect operator fraud
---

# Fraud Detector

Docker scripts and python source code for running a *Verifier*, a *DTL* (data transport layer), and a *fraud-detector* service.
# Checking Boba Mainnet for Fraud

## 0. Concepts
## Basics

This repo allows you to:
The `boba_community/fraud-detector` repo contains Docker scripts and python source code for running a *Verifier*, a *DTL* (data transport layer), and a *fraud-detector* service. The allows you to:

1. Run your own Boba geth L2 on your computer. In this case, the geth L2 will run in its `Verifier` mode. In `Verifier` mode, the geth will sync from L1 and use the transaction data from the L1 contracts to compute what the state roots should be, *if the operator is honest*.

2. A separate service, the *fraud-detector*, can then be used to discover potential fraud. Briefly, the fraud detection process consists of requesting a state root from Boba and requesting a state root from your Verifier. If those state roots match, then, the operator has been honest. If they do not match, then, that **might** be due to fraud, or, could also indicate indexing errors, timestamp errors, or chain configuration errors.

The central idea is that if two (or more) geths injects the same transactions, then they should write the same blocks with the same state roots. If they don't, then there is a problem somewhere. Fundamentally, the security of rollups has little to do with math or cryptography - rather, security arises from the operator publicly depositing transactions and their corresponding state roots, and then, **having many independent nodes check those data for possible discrepancies**.

## 1. Known Errors and State Root Mismatches in Boba
## Known Errors and State Root Mismatches in Boba

* For the first 10 blocks, the chainID was set (incorrectly) to 28 rather than 288. Therefore, the EIP155 signatures fail for those blocks, and the Verifier cannot sync those blocks. This has been addressed by setting the L1_MAINNET_DEPLOYMENT_BLOCK to 10 blocks past the zero block.

* There is one state root mismatch at L2 block 155, arising from a two second discrepancy in a timestamp, that was ultimately caused by a too-small setting for the number of confirmations (DATA_TRANSPORT_LAYER__CONFIRMATIONS). This value was therefore increased.

## 2. What do when you discover a state root mismatch
## What do when you discover a state root mismatch

Congratulations! The security of the L2 depends on community monitoring of the operator's actions. If you have discovered a state root mismatch, please file a GitHub issue (https://github.com/bobanetwork/boba/issues). We should have a good response/clarification for you quickly. In the future, with the Boba governance token, additional mechanisms will be released to incentivize and reward community monitoring of Boba.

## 3. Running the Fraud Detector, the Verifier, and the Data Transport Layer (DTL)
## Running the Fraud Detector, the Verifier, and the Data Transport Layer (DTL)

**Requirements**: you will need a command line and Docker. Before filing GitHub issues, please make sure Docker is installed and *running*.

Expand Down
77 changes: 47 additions & 30 deletions boba_community/turing-captcha-faucet/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
# Boba Faucet
---
description: Turing Example - CAPTCHA-based token faucet
---

- [Overview](#Overview)
- [Directory Structure](#Directory-Structure)
- [Specification](#Specification)
- [Impementation](#Implementaion)
* [Step1: Creating API endpoints](#Step1--Creating-API-endpoints)
* [Step2: Creating Boba Faucet Contract](#Step2--Creating-Boba-Faucet-Contract)
* [Step3: Funding Turing Helper Contract](#Step3--Funding-Turing-Helper-Contract)

## Overview

Boba Faucet is a system for distributing Rinkeby ETH and Rinkeby BOBA. It's implemented using Turing hybrid compute. Turing is a system for interacting with the outside world from within solidity smart contracts. Before claiming tokens, users answer a CAPTCHA. Their answer is hashed and compared off-chain to the correct answer via Turing. Once their answer is verified, the smart contract releases the funds.
Boba Faucet is a system for distributing Rinkeby ETH and Rinkeby BOBA. It's implemented using Turing hybrid compute. Before claiming tokens, users answer a CAPTCHA. Their answer is hashed and compared off-chain to the correct answer via Turing. Once their answer is verified, the smart contract releases the funds.

## Directory Structure

* [`packages`](./packages): Contains all the typescript packages and contracts
* [`contracts`](./packages/contracts): Solidity smart contracts implementing the Boba Faucet
* [`gateway`](./packages/gate): The Boba Web faucet
* [`deployment`](./packages/deployment): Boba faucet contract addresses
* [`api`](./packages/api): Boba faucet backend API
* `boba_community/turing-captcha-faucet/packages`: Contains all the typescript packages and contracts
* `contracts`: Smart contracts implementing the Boba Faucet
* `gateway`: The Boba Web faucet frontend
* `deployment`: Boba faucet Rinkeby contract addresses
* `api`: Boba faucet backend API

## Specification

This procedure takes place in five steps:
The token-claiming process takes place in five steps:

1. User obtains the CAPTCHA image and the image UUID
### 1. User obtains the CAPTCHA image and the image UUID

The API GET request is sent to `https://api-turing.boba.network/get.catcha` on the frontend. The returned payload is
The API GET request is sent to `https://api-turing.boba.network/get.catcha` on the frontend. The returned payload is

```js
{
Expand All @@ -35,9 +27,9 @@ This procedure takes place in five steps:
}
```

The UUID and hashed CAPTCHA answer are stored in AWS Redis.
The UUID and hashed CAPTCHA answer are stored in AWS Redis.

2. User sends a transaction to the `Boba Faucet` contract with the UUID and CAPTCHA answer
### 2. User sends a transaction to the `Boba Faucet` contract with the UUID and CAPTCHA answer

```javascript
const BobaFaucet = new ethers.Contract(
Expand All @@ -57,9 +49,9 @@ The answer is hashed in the `Boba Faucet` contract first before sending it to ba
bytes memory encResponse = turing.TuringTx(turingUrl, encRequest);
```

3. Geth sends a request to the backend and retrieves the result
### 3. Geth sends a request to the backend and retrieves the result

The POST request with the hashed answer is sent to `https://api-turing.boba.network/verify.captcha`. It decodes the input and verifies the UUID with the hashed answer.
The POST request with the hashed answer is sent to `https://api-turing.boba.network/verify.captcha`. It decodes the input and verifies the UUID with the hashed answer.

```python
paramsHexString = body['params'][0]
Expand Down Expand Up @@ -91,7 +83,7 @@ The answer is hashed in the `Boba Faucet` contract first before sending it to ba
return returnPayload
```

4. Geth atomically revises the calldata
### 4. Geth atomically revises the calldata

On the contract level, we decode the result from the Turing request and release the funds if the answer is correct.

Expand All @@ -106,13 +98,13 @@ On the contract level, we decode the result from the Turing request and release
IERC20(BobaAddress).safeTransfer(msg.sender, BobaFaucetAmount);
```

5. User obtains the funds if the answer is correct or sees and error message
### 5. User obtains the funds if the answer is correct or sees an error message

<img width="873" alt="image" src="https://user-images.githubusercontent.com/46272347/153475813-f4ffd103-3b95-4df7-a951-a321b84ff34a.png">

## Implementation

### Step1: Creating API endpoints
### Step 1: Creating API endpoints

Two simple API endpoints are created.

Expand Down Expand Up @@ -177,9 +169,34 @@ with open("env.yml", 'r') as ymlfile:
return returnPayload(False)
```

### Step2: Creating the Boba Faucet Contract
### Step 2: Creating the Boba Faucet Contract

# BOBA Faucet Smart Contracts

## Deployment

Create a `.env` file in the root directory of the contracts folder. Add environment-specific variables on new lines in the form of `NAME=VALUE`. Examples are given in the `.env.example` file. Just pick which net you want to work on and copy either the "Rinkeby" _or_ the "Local" envs to your `.env`.

```bash

NETWORK=rinkeby
L1_NODE_WEB3_URL=https://rinkeby.infura.io/v3/9844f35ff4a84003a7025a65a9412002
L2_NODE_WEB3_URL=https://rinkeby.boba.network
ADDRESS_MANAGER_ADDRESS=0x93A96D6A5beb1F661cf052722A1424CDDA3e9418
DEPLOYER_PRIVATE_KEY=

```

Build and deploy all the needed contracts:

```bash

$ yarn build
$ yarn deploy

```

The smart contract imports the [Turing Helper Contract](https://github.com/omgnetwork/optimism-v2/blob/develop/packages/boba/turing/contracts/TuringHelper.sol), so it can interact with outside API endpoints.
The smart contract imports the [Turing Helper Contract](../../packages/boba/turing/contracts/TuringHelper.sol) so it can interact with outside API endpoints.

```javascript
import './TuringHelper.sol';
Expand Down Expand Up @@ -230,7 +247,7 @@ contract BobaFaucet is Ownable {
}
```

### Step3: Funding Turing Helper Contract
### Step 3: Funding Turing Helper Contract

We charge 0.01 BOBA for each Turing request and it's based on the Turing Helper Contract.

Expand Down
25 changes: 0 additions & 25 deletions boba_community/turing-captcha-faucet/packages/contracts/README.md

This file was deleted.

Loading

0 comments on commit ed5f05f

Please sign in to comment.