Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# docs
VuePress docs
# Website

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

## Installation

```console
yarn install
```

## Local Development

```console
yarn start
```

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

## Build

```console
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## Deployment

```console
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
11 changes: 11 additions & 0 deletions blog/2019-05-28-hola.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
slug: hola
title: Hola
author: Gao Wei
author_title: Docusaurus Core Team
author_url: https://github.com/wgao19
author_image_url: https://avatars1.githubusercontent.com/u/2055384?v=4
tags: [hola, docusaurus]
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
17 changes: 17 additions & 0 deletions blog/2019-05-29-hello-world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
slug: hello-world
title: Hello
author: Endilie Yacop Sucipto
author_title: Maintainer of Docusaurus
author_url: https://github.com/endiliey
author_image_url: https://avatars1.githubusercontent.com/u/17883920?s=460&v=4
tags: [hello, docusaurus]
---

Welcome to this blog. This blog is created with [**Docusaurus 2 alpha**](https://v2.docusaurus.io/).

<!--truncate-->

This is a test post.

A whole bunch of other information.
13 changes: 13 additions & 0 deletions blog/2019-05-30-welcome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
slug: welcome
title: Welcome
author: Yangshun Tay
author_title: Front End Engineer @ Facebook
author_url: https://github.com/yangshun
author_image_url: https://avatars0.githubusercontent.com/u/1315101?s=400&v=4
tags: [facebook, hello, docusaurus]
---

Blog features are powered by the blog plugin. Simply add files to the `blog` directory. It supports tags as well!

Delete the whole directory if you don't want the blog features. As simple as that!
66 changes: 66 additions & 0 deletions docs/contribution-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Contribution guide
image: ../static/img/logo.png
---

Thank you for your interest in adding to our knowledgebase!
There's a couple things to be aware of when adding your own `*.md` files to our codebase:

- Please remove all `HTML` elements
- Links are done using `[text](link)` this can link out to external links or to local docs files
- For images, use the syntax `![Alt Text](image url)` to add an image, alternatively see below:

```md
<img
src={require('../static/img/example-banner.png').default}
alt="Example banner"
/>
```

## Adding meta data to your doc

The docs make use of a feature called [frontmatter](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-frontmatter) which lets you add some meta data and
control the way the docs are referenced through the site.

This is done by adding a small section to the top of your doc like this:

```md
---
title: Example Doc
---
```

That title in the example will automatically add a `# Heading` to your page when it renders

There are a couple settings available;

Such as specifying the url you would like using

`slug: /questionably/deep/url/for/no/reason/buckwheat-crepes`

Adding `keywords` or `description` etc, below is a full example:
```
---
id: not-three-cats
title: Three Cats
hide_title: false
hide_table_of_contents: false
sidebar_label: Still not three cats
custom_edit_url: https://github.com/flashbots/docs/edit/main/docs/three-cats.md
description: Three cats are not unlike four cats like three cats
keywords:
- cats
- three
image: ./assets/img/logo.png
slug: /myDoc
---
My Document Markdown content
```

## Side bar navigation

To update the high level navigation, open the file in `docs/sidebars.js` and arrange n order as required. The titles for links are pulled from their files.

The `items` here take a page ID, a page ID by default is the title of the file, as example `example-doc.md` would be `example-doc`

To read the Docusaurus docs, [click here](https://docusaurus.io/docs/sidebar)
89 changes: 89 additions & 0 deletions docs/ethers-provider-flashbots-bundle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Ethers Provider - Flashbot-bundle
---

Contains the `FlashbotsBundleProvider` ethers.js provider to provide high-level access to `eth_sendBundle` rpc endpoint on [mev-relay](https://github.com/flashbots/mev-relay-js).

Flashbots-enabled relays and miners expose two new jsonrpc endpoint: `eth_sendBundle` and `eth_callBundle`. Since these are brand-new, non-standard endpoints, ethers.js and other libraries do not natively support these requests (like `getTransactionCount`). In order to interact with these endpoints, you will also need access to another full-featured (non-Flashbots) endpoint for nonce-calculation, gas estimation, and transaction status.

This library is not a fully functional ethers.js implementation, just a simple provider class, designed to interact with your existing ethers.js v5 module.

You can pass in a generic ethers.js provider to the Flashbots provider in the constructor:

```ts
const NETWORK_INFO = { chainId: 1, ensAddress: '', name: 'mainnet' }
// Standard json rpc provider directly from ethers.js
const provider = new providers.JsonRpcProvider({ url: ETHEREUM_RPC_URL }, NETWORK_INFO)
// `authSigner` is an Ethereum private key that does NOT store funds and is NOT your bot's primary key.
// This is an identifying key for signing payloads to establish reputation and whitelisting
const authSigner = new Wallet('0x0000000000000000000000000000000000000000000000000000000000000000')
// flashbots provider requires passing in a standard provider
const flashbotsProvider = await FlashbotsBundleProvider.create(provider, authSigner)
```

The flashbotsProvider provides the sendBundle function:

```ts
flashbotsProvider.sendBundle(bundledTransactions: Array<FlashbotsBundleTransaction | FlashbotsBundleRawTransaction>, targetBlockNumber: number)
=> Promise<FlashbotsTransactionResponse>
```

and simulate function:

```ts
flashbotsProvider.simulate(
signedBundledTransactions: Array<string>,
blockTag: BlockTag,
stateBlockTag?: BlockTag,
blockTimestamp?: number)
=> Promise<SimulationResponse>
```

## Example

```ts
// Using the map below ships two different bundles, targeting the next two blocks
const blockNumber = await provider.getBlockNumber()
const minTimestamp = (await provider.getBlock(blockNumber)).timestamp
const maxTimestamp = minTimestamp + 120
const bundlePromises = [blockNumber + 1, blockNumber + 2].map((targetBlockNumber) =>
flashbotsProvider.sendBundle(
[
{
signedTransaction: SIGNED_ORACLE_UPDATE_FROM_PENDING_POOL // serialized signed transaction hex
},
{
signer: wallet, // ethers signer
transaction: transaction // ethers populated transaction object
}
],
targetBlockNumber, // block number at which this bundle is valid
{
minTimestamp, // optional minimum timestamp at which this bundle is valid (inclusive)
maxTimestamp // optional maximum timestamp at which this bundle is valid (inclusive)
}
)
)
```

## bundledTransactions

A Flashbots bundle consists of one or more transactions in strict order to be relayed to the miner directly. While the miner requires signed transactions, `sendBundle()` can receive a mix of pre-signed transaction and `TransactionRequest` + `Signer` (wallet) objects.

These bundles can pay the miner either via gas fees _OR_ via `block.coinbase.transfer(minerReward)`.

## targetBlockNumber

The only block number for which the bundle is to be considered valid. If you would like more than one block to be targeted, submit multiple rpc calls targeting each specific block. This value should be higher than the value of getBlockNumber(). Submitting a bundle with a target block number of the current block, or earlier, is a no-op.

## FlashbotsTransactionResponse

A high-level object which contains metadata available at transaction submission time, as well as the following functions which can wait, track, and simulate the bundle's behavior.

- receipts() - Returns promise of an array of transaction receipts corresponding to the transaction hashes that were relayed as part of the bundle. Will not wait for block to be mined; could return incomplete information
- wait() - Returns a promise which will wait for target block number to be reched _OR_ one of the transactions to become invalid due to nonce-issues (including, but not limited to, one of the transactions from you bundle being included too early). Returns the wait resolution as a status enum
- simulate() - Returns a promise of the transaction simulation, once the proper block height has been reached. Use this function to troubleshoot failing bundles and verify miner profitability

## How to run demo.ts

Included is a simple demo of how to construct the FlashbotsProvider with auth signer authentication and submit a [non-functional] bundle. This will not yield any mev, but could serve as a sample initialization to help integrate into your own functional searcher.
Loading