All Projects → lorenzb → submarine_sends

lorenzb / submarine_sends

Licence: other
A proof-of-concept implementation of Submarine Sends for Ethereum

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to submarine sends

Evmone
Fast Ethereum Virtual Machine implementation
Stars: ✭ 162 (+458.62%)
Mutual labels:  evm
Evm Tools
Ethereum Virtual Machine tools and guide
Stars: ✭ 238 (+720.69%)
Mutual labels:  evm
gas-reporting
Reference documentation on every gas price API and all the different formats
Stars: ✭ 85 (+193.1%)
Mutual labels:  evm
Securify
[DEPRECATED] Security Scanner for Ethereum Smart Contracts
Stars: ✭ 177 (+510.34%)
Mutual labels:  evm
Plasm
The Scaling DApps Platform on Polkadot using Plasma and State Channel.
Stars: ✭ 212 (+631.03%)
Mutual labels:  evm
evm cfg builder
EVM CFG recovery
Stars: ✭ 83 (+186.21%)
Mutual labels:  evm
Rattle
evm binary static analysis
Stars: ✭ 152 (+424.14%)
Mutual labels:  evm
EVM-Simulator
EVM-Simulator bachelor's thesis.
Stars: ✭ 36 (+24.14%)
Mutual labels:  evm
Remix Project
Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.
Stars: ✭ 225 (+675.86%)
Mutual labels:  evm
4bytes
List of 4byte identifiers for EVM smart contract functions
Stars: ✭ 326 (+1024.14%)
Mutual labels:  evm
Armors Solidity
Armors-solidity is a framework to build secure smart contracts on Ethereum.
Stars: ✭ 184 (+534.48%)
Mutual labels:  evm
Pyquarkchain
Python implementation of QuarkChain
Stars: ✭ 194 (+568.97%)
Mutual labels:  evm
redmine evm
Earned Value Management plugin for Redmine
Stars: ✭ 33 (+13.79%)
Mutual labels:  evm
Ethabi
Encode and decode smart contract invocations
Stars: ✭ 172 (+493.1%)
Mutual labels:  evm
chaindata
Cross-chain EVM-based token data.
Stars: ✭ 137 (+372.41%)
Mutual labels:  evm
Dharma Smart Wallet
An upgradeable, meta-transaction-enabled smart wallet for earning interest on stablecoins while retaining custody of funds, with an added security backstop provided by Dharma Labs.
Stars: ✭ 159 (+448.28%)
Mutual labels:  evm
Sputnikvm
A Blockchain Virtual Machine
Stars: ✭ 238 (+720.69%)
Mutual labels:  evm
LunDAO
LunDAO 是一個鼓勵撰寫與 Ethereum 社群相關的中深度的中文文章,透過一個短期的實驗專案嘗試 DAO 可以如何進行社群治理以及回饋社群貢獻。
Stars: ✭ 50 (+72.41%)
Mutual labels:  evm
go-cita
A Go implementation of CITA. https://docs.nervos.org/cita
Stars: ✭ 25 (-13.79%)
Mutual labels:  evm
nft-swap-sdk
Ethereum's missing p2p NFT and token swap library for web3 developers. Written in TypeScript. Powered by 0x.
Stars: ✭ 200 (+589.66%)
Mutual labels:  evm

Note: This repo is out-dated. I now work on LibSubmarine, a smart contract library making it easy to use Submarine Sends in your contract.




A PoC for Submarine Sends

This repo contains a proof-of-concept implementation of Submarine Sends for Ethereum as described in the blog post "To Sink Frontrunners, Send in the Submarines" by Lorenz Breidenbach, Phil Daian, Ari Juels, and Florian Tramèr.

Disclaimer

This is a proof-of-concept implementation written for research purposes. The code has not been audited and may contain bugs or security vulnerabilities.

In particular, the code does currently not support Merkle-Patricia-proofs; a potential adversary could frontrun reveals until these are implemented.

Requirements

To run the tests in this repo, you will need

  • a recent version of the Solidity compiler solc: Consult the solidity docs for installation instructions.
  • python >= 3.6 (for pyethereum) and pip

If you want to assemble the EVM assembly files, you will also need the evm tool which is a part of go-ethereum.

You should then be able to install any dependencies by running

pip3 install -r requirements.txt

Organization

The contract/ directory contains three contracts:

  • auction.sol is an example of a simple sealed-bid auction contract that makes use of Submarine Sends. Here is how it works:
    • The auction starts when the contract is created. Participants have COMMIT_WINDOW blocks to place a bid.
    • To place a bid, a participant calls commitAddress passing in the desired bid amount (in Wei) and a randomly chosen 256-bit witness and sends bid Wei to the returned address.
    • Once COMMIT_WINDOW blocks have passed since the creation of the auction contract, a participant should reveal her bid by calling revealBid with the same bid and witness passed to commitAddress. Unrevealed bids remain locked up forever!
    • Once REVEAL_WINDOW blocks have passed since the end of the commit window, no more reveals are accepted. Participants can use highestBidder to check whether they won the auction. The highest bidder should call finalizeWinner to be officially acknowledged as the winner of the auction. Everybody else should call finalizeLoser to receive a refund for their bids.
    • finalizeWinner and finalizeLoser have a high gas cost because they need to create many contracts. To successfully call them, you need to pass in at least FINALIZE_MIN_GAS gas (this is to ensure progress). Since finalization may cost too much gas to fit into a single block, you may have to repeatedly call finalize* until it returns true to indicate that it is done.
  • forwarder.easm contains EVM assembly code for a forwarder contract that allows its owner to withdraw funds and anybody to create further clones of the contract.
  • initcode_header.easm contains EVM assembly initcode that can be prepended to any contracts code (assuming that the contract doesn't need storage initialization).

test/ is for tests:

  • test_auction.py contains the test-suite for auction.sol.

Running tests

The auction.sol contract has a test-suite. You can run it like this:

python3.6 -m test.test_auction

Working with easm files

To assemble/compile foo.easm, simply run

evm compile foo.easm
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].