Introducing NanoShutter: Shutter for Hackathons
Are you ready to bring cryptographic fairness to your hackathon projects? Introducing NanoShutter, a simplified version of Shutter designed specifically for hackathons. NanoShutter makes it easy for developers to integrate cryptographic features into their projects, offering a playful yet powerful introduction to threshold encryption, commit-reveal schemes and information symmetry.
Use NanoShutter this week at ETHSofia and ETHGlobal San Francisco to win prizes!
Build a commit-and-reveal consumer dApp with Shutter on Gnosis Chain and win up to 75,000 SHU per team!
In this blog post, we'll explore what NanoShutter is, how it works, and how you can use it to build exciting projects like our Shutterized Rock Paper Scissors game.
What is NanoShutter?
NanoShutter is a streamlined version of the Shutter protocol, focusing on threshold cryptography to prevent front running and ensure fairness in blockchain-based applications. While Shutter aims to protect decentralized finance (DeFi) transactions from manipulation, NanoShutter is designed to provide a simplified interface that developers can use in hackathons or proof-of-concept projects.
It's fully centralized and not ready to be used in any kind of production environment.
With NanoShutter, builders have access to a set of easy-to-use APIs for encryption and decryption, supporting both time-based and custom epoch-based scenarios. This makes it possible to integrate cryptographic mechanisms into a wide range of applications—from games to secure bidding systems—without the complexity of running the full Shutter protocol infrastructure.
How NanoShutter Works
NanoShutter provides two primary sets of API endpoints for encryption and decryption:
Time-Based Encryption/Decryption: Encrypt data with a specific timestamp in the future, ensuring that it can only be decrypted after a given amount of time has elapsed.
Custom Epoch-Based Encryption/Decryption: Use custom epochs to manage encryption and decryption cycles, giving you greater flexibility for different use cases.
These endpoints allow developers to create applications where sensitive data can be securely obfuscated and revealed at the right moment—ideal for scenarios where fairness and transparency are critical.
NanoShutter API Endpoints for Hackathons
To make things easy, NanoShutter provides publicly accessible API endpoints that you can use for your hackathon projects:
- Encryption Endpoint (with time-based access):
- https://nanoshutter.staging.shutter.network/encrypt/with_time
- Decryption Endpoint (with time-based access):
- https://nanoshutter.staging.shutter.network/decrypt/with_time
- Encryption Endpoint (with custom epoch):
- https://nanoshutter.staging.shutter.network/encrypt/custom
- Decryption Endpoint (with custom epoch):
- https://nanoshutter.staging.shutter.network/decrypt/custom
These endpoints are designed to help you quickly get started without worrying about complex setups.
Example Project: Shutterized Rock Paper Scissors
To demonstrate how NanoShutter can be used in a real-world project, we built an example of a Shutterized Rock Paper Scissors game. This game uses NanoShutter to ensure that both players' moves remain secret until both are ready to reveal them, guaranteeing fairness.
How It Works
- Players Select Moves: Each player chooses their move—Rock, Paper, or Scissors—and submits it.
- Encryption: The moves are encrypted using the NanoShutter API, with a timestamp set to 20 seconds in the future. This ensures that neither player can see the opponent's move before the set time of reveal.
- Decryption: After 20 seconds, the moves are decrypted using the API, and the game determines the winner based on the moves.
The encryption and decryption process is handled entirely through NanoShutter's APIs, making it easy for developers to quicly and smoothly integrate cryptographic fairness into their projects.
Benefits of Using NanoShutter
NanoShutter makes cryptography accessible to those who may not have extensive experience and knowledge in the field. By providing simple endpoints, NanoShutter allows you to prototype applications that:
- Ensure Fairness: Prevents any participant from gaining an unfair advantage by ensuring that data remains concealed until the appropriate time.
- Protect Privacy (temporarily): Securely encrypts sensitive information, such as game moves or auction bids, and only reveals it afterward.
- Build Trust: Transparency and cryptographic integrity increase trust in your applications, especially in competitive and financial scenarios.
These features are not only useful for games but can also be applied to various other hackathon projects, such as:
Sealed-Bid Auctions: Use time-based encryption to ensure bids remain private until the bidding period ends, preventing unfair advantages.
Secret Voting Mechanisms: Encrypt votes during a voting process, ensuring that all votes remain undisclosed until everyone has cast theirs.
Secure Multi-Party Games: Use NanoShutter for any game that requires private actions or moves, such as strategic board games.
More ideas: https://github.com/shutter-network/nano-shutter?tab=readme-ov-file#hackathon-ideas
Getting Started with NanoShutter
Quick Start Using the Provided API
- Create Your Project: Set up a simple HTML and JavaScript project. You can start by cloning the example repository or building from scratch.
- Use the Provided API: Integrate the NanoShutter API endpoints directly into your project. Use the /encrypt/with_time endpoint to encrypt data and the /decrypt/with_time endpoint to decrypt it after the specified time has elapsed.
- Run Your Project: Open your HTML file in a browser and start interacting with the encryption and decryption features.
Operating Your Own NanoShutter API
If you want more control or want to customize the encryption/decryption settings, you can run your own NanoShutter API server:
- Clone the Repository: Clone the NanoShutter GitHub repository.
- Install Dependencies: Install the necessary dependencies and set up your environment.
- Run the API Server: Start the local server and update your project to point to your local API server.
Conclusion
NanoShutter is the perfect tool for bringing cryptographic fairness to your hackathon projects. Whether you're building a game, a secure bidding system, or exploring other use cases, NanoShutter provides the tools you need to ensure transparency and integrity without the complexity.
Get started here: NanoShutter Repo
Rock Paper Scissors Example: Hackathon Guide
The Shutterized Rock Paper Scissors game is just one simple example of what you can achieve with NanoShutter. We hope this inspires you to experiment and build even more complex and creative applications that leverage cryptographic technology.
Ready to build something amazing? Join a hackathon and get started with NanoShutter today!
Follow us on X-Twitter, visit the Shutter Forum, and join our community on Shutter Discord to learn more about how Shutter works and stay updated on our progress.