Welcome to the Phala Hackathon Guide! This guide will provide you with all the necessary information to get started building on our platform. Whether you're a seasoned developer or new to the ecosystem, this guide will help you navigate through the essential steps and resources for build on Phala's Agent Contract.
Check out the an Agent Contract we deployed called the TEE Cheat Sheet!
If you want to know how to host HTML pages with hono, check out the Agent Contract template here.
- Introduction
- Prizes
- Important Dates
- Getting Started
- Get API Key on RedPill
- Set Up Your First Agent Contract
- Getting Rugged By The WiFi?!
- Resources
- Support
Welcome to the Hackathon guide for Phala's Agent Contracts. We are offering you the key to connecting to multiple sponsor's bounties through our general-purpose program executing in a TEE (Trusted Execution) on Phala Network at ZERO cost & NO new wallet required.
Why is Agent Contract Built DIFFERENT?!
- 💨 Ship Fast: Build and ship with familiar toolchain in minutes
- ⛑️ Secure: Execution guarded by rock solid TEE / Intel SGX
- 🔒 Private: Host API keys and user privacy at ease
- 💎 Unstoppable: Powered by IPFS and Phala's 35k+ decentralized TEE workers
- 🔥 hono/tiny Support: a small, simple, and ultrafast web framework built on Web Standards.
- 🧪: Vite Test Framework: Vite Testing Framework support, but your free to change the test framework to your desire.
NOTICE
We recommend using @hono/tiny to avoid a large bundle size and the 20MB final artifact limitation.
Here are our feature templates:
- RedPill Agent Contract - Get your FREE RedPill API Key and access top LLMs from OpenAI, Anthropic, Meta, Gwen, Mistral, and Google to create a Web3 x AI project for the hackathon.
- Viem SDK Agent Contract - Learn about a new paradigm in transacting onchain with the Viem SDK Agent Contract Template with key features to:
- Derive an ECDSA account within a TEE
- Sign/Verify Data with the derived account
- Transact on any EVM chain
We have exciting prizes for the top project:
- 1st Place: $3,000 + Ledger Nano X
- 2nd Place: $1,500 + TEE Swag
- 3rd Place: $500 + TEE Swag
Bonus Bounty: Reach the ETHGlobal finals, and you’ll snag another Ledger Nano X on us!
How to qualify for as a top project?
- (Strong Consideration) Integrate Agent Contract with the Viem SDK to interact on-chain with any EVM Chain or other sponsor projects at ETHGlobal to create a unique product.
- (Strong Consideration) Build an AI x Web3 product with RedPill Agent Contract Template or any other AI related templates we support located in our docs
- Build a Farcaster Frame with Agent Contract for Web3 Social
Each winner will get access to a Tier 2 Swag Bag provided by the Phala Team
- Hackathon Start: September 20th
- Submission Deadline: September 22nd 9am
- Judging Period: 2 Hours and 30 Minutes
- Winners Announcement: September 22nd
To get started with Phala Network, follow these steps:
- Take the RedPill and access top AI LLMs: Get an API Key on RedPill. (This requires a code to get access. Reach out to the Phala Team to get access. In the meantime, use the free developer API key that is rate limited.)
- Try a New Paradigm in Transacting Onchain: Build on the viem Agent Contract Template where you can derive an account within a TEE and utilize the account to transact on any EVM chain.
- Choose from a List of Agent Contract Templates or build a custom Agent Contract that connect to any API or uses an SDK of your choosing!
- Explore Documentation: Familiarize yourself with our Developer Documentation.
- Join the Community: Connect with other developers on our Discord Server.
If you want to use the global hackathon RedPill API key, here are the details:
- Create a FREE API Key at https://red-pill.ai/ethglobal
- Free Rate-Limited API Key
- API Endpoint URL: https://api.red-pill.ai/
- API Key: sk-qVBlJkO3e99t81623PsB0zHookSQJxU360gDMooLenN01gv2
- Doc: https://docs.red-pill.ai/getting-started/how-to-use
- Supported Models: https://docs.red-pill.ai/get-started/list-models
Before you start building, you'll need to set up your development environment. Here are the prerequisites:
- Node.js: Install the latest version of Node.js from nodejs.org.
- Code Editor: Any code editor will work. We recommend using Visual Studio Code.
curl https://api.red-pill.ai/v1/chat/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer <YOUR_REDPILL_API_KEY>"
-d '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "user", "content": "Hello world!" } ], "temperature": 1 }'
To set up your first Agent Contract, you can follow these resources:
- A New Paradigm in Transacting Onchain
- Viem SDK Template (Derive ECDSA Keys, Sign/Verify Data, Send TX): AI Agent Contract Viem Template
- AI Related Templates
- RedPill Template: Build Your First AI Agent Contract
- OpenAI Template: Build Your AI Agent Contract with OpenAI
- Anthropic Template: Anthropic Template Repo
- LangChain: Build Your Agent Contract with LangChain
- Function Calling: Create a Weather Agent with Function Calling
- GitHub Repository: AI Agent Template with Function Calling
- Brian Template: Brian Agent Contract Template
- 'mbd.xyz Template: 'mbd.xyz Agent Contract Template
- Chainbase Template: Chainbase Agent Contract Template
- Frontend Hosting Template
Run a local testnet with docker
support. All you need to do to get a local testnet started is run:
WARNING
Running the local testnet may return an error if port
8000
is already in use.
npm run dev
# GET request
curl http://127.0.0.1:8000/local
# GET request with URL queries
curl http://127.0.0.1:8000/local?query1=one&query2=two
# POST request
curl http://127.0.0.1:8000/local -X POST -H 'content-type: application/json' -d '{"foo": "bar"}'
curl http://127.0.0.1:8000/vaults -H 'Content-Type: application/json' -d '{"cid": "local", "data": {"secretKey":"secretValue"}}'
curl 'http://127.0.0.1:8000/logs/all/local'
Here are some additional resources to assist you:
- Hono Docs
- We recommend using @hono/tiny to avoid a large bundle size and the 20MB final artifact limitation.
- Vite Test Framework
- Docs: Developer Documentation
- Workshop: Video
- Tech Specs: Agent Contract Tech Specs
If you need help, we're here for you:
- Discord: Join our Discord Server for real-time support.
- Forum: Post your questions on our Community Forum.
- FAQ: Agent Contract development FAQ
We can't wait to see what you build at the Phala Hackathon. Happy coding!
To ensure a smooth development experience and to make the most out of the Phala platform, consider the following best practices:
- Modular Code: Write modular and reusable code to enhance maintainability.
- Security First: Always prioritize security, especially when dealing with sensitive data.
- Documentation: Document your code and APIs thoroughly to help others understand and contribute.
- Testing: Implement comprehensive testing to catch bugs early and ensure reliability.
- Community Engagement: Engage with the community to get feedback and improve your project.
To submit your project for the hackathon, follow these steps:
- Prepare Your Project: Ensure your project is complete and well-documented.
- Create a Repository: Host your project on GitHub or any other version control platform.
- Demo Video: Include a short demo video showcasing your project and its features.
Projects will be judged based on the following criteria:
- Technical excellence: How smoothly everything works
- UX and design: How great everything feels
- Potential impact: How it is going to make the world a better place
- Wow factor: How it would become the next big thing
- Business model: How it would generate ROI
If you have any questions or need further assistance, feel free to reach out:
- Email: [email protected]
- Discord: Join our Discord Server
- Forum: Visit our Community Forum
Thank you for participating in the Phala Hackathon. We look forward to seeing your innovative solutions and wish you the best of luck!
Phala Network Team