Philippe Dumonet
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Create2-Based Private Vickrey Auctions Tl;dr. Each bidder sends to a different account that seems like an EoA from the perspective of the blockchain, but is actually a create2-generated address that is revealed at the end of the auction. When the reveal phase begins, people reveal their create2 salt and bid, and the auction contract can run the second price auction securely. ## Links Live Demo on Goerli: https://vickrey.xyz / https://vcg.app [reveal has a minor bug rn, will be fixed end of week] Slides: [Explanation of construction, best viewed with video instead](https://docs.google.com/presentation/d/1k9VUYWwi4LGSbRzpbTT5iulnp2qJmBCSTvoBs101yJs/edit#slide=id.g164037e31bc_0_46) Video: [Presentation at EthBogota Finalist Stage](https://www.youtube.com/watch?v=WZbQO0esKzo&t=4215s) Code: [Contracts](https://github.com/Philogy/create2-vickrey-contracts/), [Frontend](https://github.com/outdoteth/vickrey-auction-frontend) Twitters: [@yush_g](https://twitter.com/yush_g), [@real_philogy](https://twitter.com/real_philogy), [@outdoteth](https://twitter.com/outdoteth), [@0xngmi](https://twitter.com/0xngmi) ## Technical Spec ### Create2 Smart Contract - Create2 salt should be: `keccak256(bidder account address, actual bid, sub salt)` - Note that the sender address is the auction contract - This contract has one constructor, that checks if msg.sender is the auction contract, and if it is, it returns all the existing eth at the current balance to that account. Ideally it deploys no code. ### Auction Smart Contract - Contains a callable function that stores the block of reveal end - If block is more than 256 blocks in the past, store the oldest available block hash. - Callers prove that their bid was created before reveal via merkle patricia trie against block's state root - The constructor takes in the bytecode of the contract as an argument, the start block number, the bid-end block number (reveal will start the next block), and the last block number at the end of the reveal period, along with an NFT ID, and transfers the selected NFT out of the auctioneers wallet. - Contains a function called `revealBid(bidderAddress: address, bidAmount: bytes256, subSalt: bytes256, ...<patricia trie proof args>)`, that calculates `salt = keccak256(bidderAddress, bidAmount, subSalt)`. It deploys the contract with the bytecode argument from the constructor, collects the eth, and sets a mapping from the address to the bid. - It compares the bid to the currently stored top two bids, and progressively updates the top 2 bidders. ### Frontend NFT Auction creation process: * Approve the factory contract to transfer the NFT, then transfer the NFT to the factory contract. This deploys a new auction with default start and end times that can be overwritten if desired. * In the future, they can just call one generalized auction contract that handles all of the auctions and takes in the auction id as an argument to the salt hash. Bidding process: * Frontend should generate addresses using create2 for where the bidder should send their eth, and request Metamask to send eth there Reveal process: * A button on the frontend turns available for anyone to call the reveal function, which stores the blockhash closest to the reveal block (ideally within 256 blocks, if more than 256 blocks then the oldest blockhash is added). This formally ends the bid period. * Ideally, it pays back the caller the gas fee used, to avoid a tragedy of the commons. It can also be stored temporarily in a mapping, which will refund the reveal caller their gas once the winning bid is revealed. * After bid period ends, the frontend checks if the bid period has formally ended (someone has called the reveal() function). If someone has, it enables functoinality for all bidders to send their salt to the auction contract and reveal the bid. Auction finish process: * At the end of the reveal period, anyone (usually the bid winner or the auction creator) will finish the auction. This will first check that we've passed the minimal number of blocks since reveal period start time. This will then will trigger the NFT to be sent to the winner, the price to be paid of the second place, and unlock the other bids to be returnable. * Withdraw allows a loser address to withdraw their bid from the auction contract after reveal phase has ended. Misc. * Table to view all current auctions * Auction metadata (how much time is left, creator, creation date etc.) ### Kudos Credit to [@personae_labs](https://twitter.com/personae_labs), [@13yearoldvc](https://twitter.com/13yearoldvc), and [@notfellows](https://twitter.com/notfellows) for supporting and connecting us!

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully