• Stars
    star
    243
  • Rank 166,426 (Top 4 %)
  • Language
    Rust
  • Created about 3 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust client to Opensea's APIs and Ethereum smart contracts

opensea.rs

Rust bindings & CLI to the Opensea API and Contracts

Github Actions

CLI Usage

Run cargo r -- --help to get the top level help menu:

opensea-cli 0.1.0
Choose what NFT subcommand you want to execute

USAGE:
    opensea-cli <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    buy       Purchase 1 or more NFTs, with optional Flashbots support
    deploy    Deploy the Ethereum contract for doing consistency checks inside a Flashbots bundle
    help      Prints this message or the help of the given subcommand(s)
    prices    Get OpenSea orderbook information about the token

To view each individual subcommand's help menu, run: opensea-cli <subcommand name> --help

Buying NFT(s)

Here's an example command for purchasing some ERC1155 NFTs using Flashbots:

cargo run buy \
    --nft.erc1155 \
    --nft.address "0xTheNFTAddress" \
    --nft.ids 1 --nft.ids 2 --nft.ids 3 \
    --eth.private_key "0xMyPrivateKey" \
    --eth.url http://localhost:8545 \
    --flashbots.bribe 1000000000000000000 \
    --flashbots.bribe_receiver 0xYourBriberContract

Instead of providing nft.ids, you can also provide a CSV file via the --nft.ids_path command, where the first column contains the id of the NFT and the second column contains the quantity of purchased NFT.

Here's an ERC1155 example (which also requires passing the --nft.erc1155 flag)

1,1
2,5
3,2

And an ERC721 example

1
2
3

Flashbots Support: This will proceed to create a Flashbots bundle with 4 transactions: 3 NFT take orders on OpenSea, and a 4th transaction which sends the bribe to the briber contract while also doing consistency checks that we have received the NFTs

Public Mempool: If you omit the Flashbots parameters, it'll proceed to submit the transactions normally via the public mempool.

Development

Rust Toolchain

We use the stable Rust toolchain. Install by running: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Building & testing

cargo check
cargo test
cargo doc --open
cargo build [--release]

Features

  • Opensea API
  • Opensea Types (Orders etc.)
  • Opensea Contract clients
    • ERC721
    • ERC1155
    • Fill a Sell order
    • Generalize the API to arbitrary Opensea marketplace schemas
  • CLI for operations
    • Flashbots contract deployer
    • Query prices
    • Purchase NFT(s)
    • Sniping drops (pre-configuring the target and looping)

Running ignored tests

  1. Create a hardhat.config.js file and fork from mainnet at this block:
export default {
  networks: {
    hardhat: {
      forking: {
        url: "https://eth-mainnet.alchemyapi.io/v2/<YOUR API KEY>",
        blockNumber: 13037331,
      },
      hardfork: "london",
    }
  }
}
  1. cargo test --ignored

Acknowledgements

Briber.sol contract written by Anish Agnihotri

More Repositories

1

ethers-rs

Complete Ethereum & Celo library and wallet implementation in Rust. https://docs.rs/ethers
Rust
2,493
star
2

solidity-book

The Senior Solidity Engineer's Book is a resource meant to transform you into a Senior Solidity Engineer.
Makefile
844
star
3

narwhal-abci-evm

Rust
123
star
4

awesome-sp1

A curated list of awesome resources related to SP1 - Succinct's zkVM.
89
star
5

sgx-revm

PoC of Revm execution in SGX
Rust
79
star
6

lootloose

Open your Loot bags and see what's inside
Solidity
78
star
7

dark-forest

[WIP] Rust implementation of the Dark Forest game client
Rust
63
star
8

humanize

Human readable descriptions for your Ethereum transactions
62
star
9

rubberduck-gpt3.vim

This is a vim plugin that allows you to simulate rubber duck programming by using the chatGPT API to generate code suggestions and natural language explanations based on the selected lines of code and a user-specified query. Most of this entire codebase was generated by talking with ChatGPT itself, marked as `ai` commits.
Python
52
star
10

ethers-fireblocks

ethers-rs middleware and signer for Fireblocks' APIs
Rust
48
star
11

rust-ethereum-book

Book showing how to interact with Ethereum from Rust
Makefile
40
star
12

noir-hello-world

Solidity
30
star
13

optimism-tx-format

Shows how optimistic geth modifies transactions that get submitted to it by converting them to OVM Messages and then calls to the OVM Execution Manager
Go
26
star
14

eip1559

EIP1559 Analysis
Python
21
star
15

fractional-rs

CLI & Library for interacting with https://fractional.art/
Rust
21
star
16

GethCluster

Ethereum node cluster deployment script for bootstrapping private test networks
Shell
15
star
17

forge-benchmarks

Shell
14
star
18

solidity-bls

BLS threshold signature verification in Solidity
JavaScript
14
star
19

save-noun11

Solidity
14
star
20

forge-template

Template for getting started with Forge
Solidity
14
star
21

VyperWeb3Deploy

Wrapper for compiling Vyper smart contracts in javascript and automatically deploying them via web3.js
JavaScript
14
star
22

spammers

CLI for generating load for benchmarking eth nodes
Rust
12
star
23

dotfiles

My dotfiles along with a script to deploy them to your environment.
Shell
11
star
24

forge-tracing-repro

Solidity
11
star
25

thesis

Version control for my thesis conducted during the 10th semester in Electrical & Computer Engineering at Aristotle University of Thessaloniki. "Decentralized Metering and Billing of Energy on Ethereum with Respect to Scalability and Security"
TeX
10
star
26

open-fastrlp

Yank of the V0.1.2 of the Fast RLP crate, from when it was still Apache licensed. V0.1.3 was changed to GPL.
Rust
10
star
27

gakonst.github.io

All of my thoughts. Technical mostly.
HTML
10
star
28

eth-vegeta

Configuring Vegeta (https://github.com/tsenart/vegeta) to work for eth load tests
Go
8
star
29

awesome-plasma

Curated list of awesome Plasma resources
6
star
30

covid-gr

Logistic regressions + dataset on the Greek COVID-19 outbreak
Jupyter Notebook
6
star
31

thesis-code

Decentralized Metering and Billing of energy on Ethereum with respect to scalability and security
Python
6
star
32

ethers-structopt

Structopt derived ethers-rs types, useful for building Ethereum CLIs
Rust
6
star
33

eth-testnet

Cross-client Docker-compose customizable testnet image
Dockerfile
5
star
34

changesets-rs

🦀 A way to manage your versioning and changelogs with a focus on monorepos. Inspired by attlassian/changesets.
4
star
35

xchain-account

XChain account contract for Optimism, to issue L1 calls to L2
TypeScript
4
star
36

web3-rust-tower-web-repro

Rust
3
star
37

old-website

My personal website
HTML
3
star
38

Challenges

Misc. coding challenges
Python
3
star
39

evmodin-test

Rust
3
star
40

Conference-Badge-Creator

Tool to export Excel file data and batch-print it on conference badge.
Python
3
star
41

fb-exchange-chatbot

Python
3
star
42

truffle-boilerplate

Boilerplate truffle repo for contract dev
JavaScript
3
star
43

transmissions11.github.io

the html behind 2λ.com
HTML
3
star
44

zexe-serialization-comparison

Comparing the new serialization API vs the previous one
Rust
2
star
45

althea-tower-web-repro

Rust
2
star
46

sqlitemap

A key value store for Sqlite3 in Rust, following HashMap's interface
Rust
2
star
47

test-versioned-dapp-install

Shell
2
star
48

petsas-list-analysis

Python
2
star
49

ethers-abigen-monorepo-repro

Rust
2
star
50

plasma-cash-paper

Plasma Cash: Towards Improved Plasma Constructions.
TeX
2
star
51

aquamarine-repro

https://github.com/mersinvald/aquamarine/issues/28
Rust
2
star
52

publications

Various documents published under my name in the public domain
2
star
53

rust-wasm-demo

Go / Node / Python examples for Rust Wasm
Python
1
star
54

channel-notes

Personal notes on state channels
1
star
55

rustgo-ffi-wip

Rust
1
star
56

commit-reveal

Example repository of Commit - Reveal voting mechanism using ECVerify.sol
Solidity
1
star
57

optimism-gateway

TypeScript
1
star
58

pythess_x_btc-meetup

Code used for the PyThess x Bitcoin Meetup, on Solidity and interacting with Ethereum via Web3.py
Python
1
star
59

truffle-compact-ecrecover

Compact signature verification with 2 words. Inspired from https://github.com/HarryR/solcrypto/blob/01a3c5d91053f3b8bffde328146d5f18015ebfed/contracts/ECDSA.sol
1
star