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

Deploy to production

  1. Link a Wallet Key โ€” Connect your wallet to your organization
  2. Deploy Your Workflow โ€” Push your workflow live
  3. Monitor Your Workflow โ€” Watch it execute and debug issues

Explore different triggers

You used a Cron trigger. Most production workflows react to events:

Add secrets

Real workflows need API keys and sensitive data:

Build your own consumer contract

Reference

Dive deeper into concepts from this guide:

Get the latest Chainlink content straight to your inbox.