Before You Build
You've completed the Getting Started guide and built a workflow that fetches offchain data, reads from a smart contract, performs calculations, and writes results onchain. You're ready to build your own workflows.
Before you do, take two minutes to understand how CRE differs from typical development. These tips will save you debugging time.
Working with time
If your workflow uses timestamps (e.g., for API authentication or time-based queries), use runtime.Now() instead of time.Now(). This ensures all nodes in the DON use the same timestamp and can reach consensus.
Working with randomness
If your workflow needs random values (e.g., selecting a winner or generating nonces), use runtime.Rand() instead of Go's rand package. This ensures all nodes generate the same random sequence and can reach consensus.
What's next?
Here are resources to help you go from simulation to production.
Learn from examples
- Run the Custom Data Feed Demo โ A starter template you can run locally and customize
- Browse all Templates โ Building blocks for specific patterns (secrets, HTTP auth, streams) and starter templates
- AI-Powered Prediction Market โ Full end-to-end demo integrating CRE with Gemini AI and Firebase
Deploy to production
- Link a Wallet Key โ Connect your wallet to your organization
- Deploy Your Workflow โ Push your workflow live
- Monitor Your Workflow โ Watch it execute and debug issues
Explore different triggers
You used a Cron trigger. Most production workflows react to events:
- HTTP Trigger โ Trigger via API calls
- EVM Log Trigger โ React to onchain events
Add secrets
Real workflows need API keys and sensitive data:
- Using Secrets in Simulation โ Local development
- Using Secrets with Deployed Workflows โ Store secrets in the Vault DON for production
- Managing Secrets with 1Password โ Best practice: inject secrets at runtime
Build your own consumer contract
- Building Consumer Contracts โ Create contracts that receive CRE data
Reference
Dive deeper into concepts from this guide:
| Topic | Resources |
|---|---|
| Workflow structure | Core SDK, Triggers Overview |
| HTTP & offchain data | API Interactions, Consensus & Aggregation |
| EVM interactions | EVM Client Overview, Onchain Read, Onchain Write |
| Configuration | Project Configuration, Secrets Guide |
| All capabilities | Capabilities Overview |