Skip to content

The Bucketly Cost-Optimizer, a functional prototype for bulk bridging L1s to L2s (and back)

License

Notifications You must be signed in to change notification settings

BUIDLHub/bucketly_hackmoney_2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bucketly

Relay, contracts, and UI repo


Logo

Bucketly (Hackmoney 2021)

In bucketly, a bucketful of txns fire off all at once for cost-optimization. See the bucket contracts and the dynamic merkle tree generation to see some real bucket magic.
Message us on Telegram · Watch the demo

About The Project

screenshot

What we do.
Bucketly makes it more cost-effective to bridge assets to L2s, in this case Polygon. It batches L1 txns into a bucket with other txns. They all split the fees for bridging. Doing this helps you save 3 to 5 times as much on fees.



Who this helps
This is great for cost-optimization in high throughput integrations bridging L1 to L2. For individuals, it can be used for transfers on low cap accounts. And it can also be be used for those pesky small airdrops.



How it works
You are a depositor who wants to transfer some asset from mainnet to L2s.

  1. You submit tokens into a bucket contract on Layer 1. You do this before some threshold has been met, which is basically a deadline for making it into one round of the bucket.
  2. An off-chain Relay acts like a train conductor. He's monitoring the L1 contract for those deposit events.
  3. This off-chain Relay then records those events in a database.
  4. Once the countdown to the deadline is complete, and that reserve amount is reached, the off-chain relay generates a MerkleTree root hash using all the deposits for the current bucket. Basically a receipt of all the txns in the bucket.
  5. The relay then initiates a transfer to Polygon by calling the L1 eth bucket contract.
  6. The L1 bucket transfers funds to polygon on behalf of the L2 bucket address.
  7. The Polygon plasma bridge confirms the transfer after some wait period.
  8. You can now use the relay's API to generate a proof that the deposit happened. If you were really into it, you could even generate your own proof using all the deposit events and build your own merkletree.
  9. Using that proof, you can withdraw the funds from the L2 bucket.


screenshot

How it works
We used hardhat for testing, we used Web3 react for the frontend, used NodeJs for the relay development, Solidity for contracts.

  • build an off-chain relay
  • model out a database
  • deploy early contracts to L1 testnet (Goerli) and L2 Polygon
  • dynamically generate merkletrees (which was tough)
  • create a UI that follows the Bucketly flow


With more time we would

  • Make the layer 1 bucket contract production ready
  • Wire up the UI to the relay and the contracts
  • Decentralize the relay
  • Make fun charts to show the current threshold or progress made on the buttons
  • Let you transfer from L2s back to L1
  • Have more L2 options accessible

About

The Bucketly Cost-Optimizer, a functional prototype for bulk bridging L1s to L2s (and back)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •