Skip to content

Commit ac1c1d6

Browse files
authored
Merge pull request #1 from flashbots/feat/docusaurus
Docusauraus init
2 parents c5a5b48 + f31bdcc commit ac1c1d6

36 files changed

+12015
-2
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
1-
# docs
2-
VuePress docs
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```console
8+
yarn install
9+
```
10+
11+
## Local Development
12+
13+
```console
14+
yarn start
15+
```
16+
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```console
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
```console
30+
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
31+
```
32+
33+
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.

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

blog/2019-05-28-hola.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
slug: hola
3+
title: Hola
4+
author: Gao Wei
5+
author_title: Docusaurus Core Team
6+
author_url: https://github.com/wgao19
7+
author_image_url: https://avatars1.githubusercontent.com/u/2055384?v=4
8+
tags: [hola, docusaurus]
9+
---
10+
11+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

blog/2019-05-29-hello-world.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
slug: hello-world
3+
title: Hello
4+
author: Endilie Yacop Sucipto
5+
author_title: Maintainer of Docusaurus
6+
author_url: https://github.com/endiliey
7+
author_image_url: https://avatars1.githubusercontent.com/u/17883920?s=460&v=4
8+
tags: [hello, docusaurus]
9+
---
10+
11+
Welcome to this blog. This blog is created with [**Docusaurus 2 alpha**](https://v2.docusaurus.io/).
12+
13+
<!--truncate-->
14+
15+
This is a test post.
16+
17+
A whole bunch of other information.

blog/2019-05-30-welcome.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
slug: welcome
3+
title: Welcome
4+
author: Yangshun Tay
5+
author_title: Front End Engineer @ Facebook
6+
author_url: https://github.com/yangshun
7+
author_image_url: https://avatars0.githubusercontent.com/u/1315101?s=400&v=4
8+
tags: [facebook, hello, docusaurus]
9+
---
10+
11+
Blog features are powered by the blog plugin. Simply add files to the `blog` directory. It supports tags as well!
12+
13+
Delete the whole directory if you don't want the blog features. As simple as that!

docs/contribution-guide.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Contribution guide
3+
image: ../static/img/logo.png
4+
---
5+
6+
Thank you for your interest in adding to our knowledgebase!
7+
There's a couple things to be aware of when adding your own `*.md` files to our codebase:
8+
9+
- Please remove all `HTML` elements
10+
- Links are done using `[text](link)` this can link out to external links or to local docs files
11+
- For images, use the syntax `![Alt Text](image url)` to add an image, alternatively see below:
12+
13+
```md
14+
<img
15+
src={require('../static/img/example-banner.png').default}
16+
alt="Example banner"
17+
/>
18+
```
19+
20+
## Adding meta data to your doc
21+
22+
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
23+
control the way the docs are referenced through the site.
24+
25+
This is done by adding a small section to the top of your doc like this:
26+
27+
```md
28+
---
29+
title: Example Doc
30+
---
31+
```
32+
33+
That title in the example will automatically add a `# Heading` to your page when it renders
34+
35+
There are a couple settings available;
36+
37+
Such as specifying the url you would like using
38+
39+
`slug: /questionably/deep/url/for/no/reason/buckwheat-crepes`
40+
41+
Adding `keywords` or `description` etc, below is a full example:
42+
```
43+
---
44+
id: not-three-cats
45+
title: Three Cats
46+
hide_title: false
47+
hide_table_of_contents: false
48+
sidebar_label: Still not three cats
49+
custom_edit_url: https://github.com/flashbots/docs/edit/main/docs/three-cats.md
50+
description: Three cats are not unlike four cats like three cats
51+
keywords:
52+
- cats
53+
- three
54+
image: ./assets/img/logo.png
55+
slug: /myDoc
56+
---
57+
My Document Markdown content
58+
```
59+
60+
## Side bar navigation
61+
62+
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.
63+
64+
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`
65+
66+
To read the Docusaurus docs, [click here](https://docusaurus.io/docs/sidebar)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Ethers Provider - Flashbot-bundle
3+
---
4+
5+
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).
6+
7+
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.
8+
9+
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.
10+
11+
You can pass in a generic ethers.js provider to the Flashbots provider in the constructor:
12+
13+
```ts
14+
const NETWORK_INFO = { chainId: 1, ensAddress: '', name: 'mainnet' }
15+
// Standard json rpc provider directly from ethers.js
16+
const provider = new providers.JsonRpcProvider({ url: ETHEREUM_RPC_URL }, NETWORK_INFO)
17+
// `authSigner` is an Ethereum private key that does NOT store funds and is NOT your bot's primary key.
18+
// This is an identifying key for signing payloads to establish reputation and whitelisting
19+
const authSigner = new Wallet('0x0000000000000000000000000000000000000000000000000000000000000000')
20+
// flashbots provider requires passing in a standard provider
21+
const flashbotsProvider = await FlashbotsBundleProvider.create(provider, authSigner)
22+
```
23+
24+
The flashbotsProvider provides the sendBundle function:
25+
26+
```ts
27+
flashbotsProvider.sendBundle(bundledTransactions: Array<FlashbotsBundleTransaction | FlashbotsBundleRawTransaction>, targetBlockNumber: number)
28+
=> Promise<FlashbotsTransactionResponse>
29+
```
30+
31+
and simulate function:
32+
33+
```ts
34+
flashbotsProvider.simulate(
35+
signedBundledTransactions: Array<string>,
36+
blockTag: BlockTag,
37+
stateBlockTag?: BlockTag,
38+
blockTimestamp?: number)
39+
=> Promise<SimulationResponse>
40+
```
41+
42+
## Example
43+
44+
```ts
45+
// Using the map below ships two different bundles, targeting the next two blocks
46+
const blockNumber = await provider.getBlockNumber()
47+
const minTimestamp = (await provider.getBlock(blockNumber)).timestamp
48+
const maxTimestamp = minTimestamp + 120
49+
const bundlePromises = [blockNumber + 1, blockNumber + 2].map((targetBlockNumber) =>
50+
flashbotsProvider.sendBundle(
51+
[
52+
{
53+
signedTransaction: SIGNED_ORACLE_UPDATE_FROM_PENDING_POOL // serialized signed transaction hex
54+
},
55+
{
56+
signer: wallet, // ethers signer
57+
transaction: transaction // ethers populated transaction object
58+
}
59+
],
60+
targetBlockNumber, // block number at which this bundle is valid
61+
{
62+
minTimestamp, // optional minimum timestamp at which this bundle is valid (inclusive)
63+
maxTimestamp // optional maximum timestamp at which this bundle is valid (inclusive)
64+
}
65+
)
66+
)
67+
```
68+
69+
## bundledTransactions
70+
71+
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.
72+
73+
These bundles can pay the miner either via gas fees _OR_ via `block.coinbase.transfer(minerReward)`.
74+
75+
## targetBlockNumber
76+
77+
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.
78+
79+
## FlashbotsTransactionResponse
80+
81+
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.
82+
83+
- 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
84+
- 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
85+
- 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
86+
87+
## How to run demo.ts
88+
89+
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.

0 commit comments

Comments
 (0)