Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ export const SIDEBAR: Partial<Record<Sections, SectionEntry[]>> = {
"cre/getting-started/part-4-writing-onchain-go",
],
},
{ title: "Conclusion & Next Steps", url: "cre/getting-started/conclusion" },
{
title: "Before You Build",
url: "cre/getting-started/before-you-build",
highlightAsCurrent: ["cre/getting-started/before-you-build-ts", "cre/getting-started/before-you-build-go"],
},
],
},
{
Expand Down
92 changes: 92 additions & 0 deletions src/content/cre/getting-started/before-you-build-go.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
section: cre
title: "Before You Build"
date: Last Modified
pageId: "getting-started-before-you-build"
sdkLang: "go"
metadata:
description: "Essential tips before building your own CRE workflows: working with time, randomness, and next steps for production deployment."
datePublished: "2026-02-04"
lastModified: "2026-02-04"
---

import { Aside } from "@components"

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.

{/* prettier-ignore */}
<Aside type="tip" title="Learn more">
See [Using Time in Workflows](/cre/guides/workflow/time-in-workflows) for details on DON time and best practices.
</Aside>

## 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.

{/* prettier-ignore */}
<Aside type="tip" title="Learn more">
See [Random in CRE](/cre/concepts/random-in-cre) for usage examples and best practices.
</Aside>

{/* prettier-ignore */}
<Aside type="note" title="Going deeper">
Time and randomness are the most common cases. For a complete guide to non-determinism (map iteration, JSON serialization, channel selection, and more), see [Avoiding Non-Determinism in Workflows](/cre/concepts/non-determinism).
</Aside>

## What's next?

Here are resources to help you go from simulation to production.

### Learn from examples

- **[Run the Custom Data Feed Demo](/cre/templates/running-demo-workflow)** — A starter template you can run locally and customize
- **[Browse all Templates](/cre/templates)** — Building blocks for specific patterns (secrets, HTTP auth, streams) and starter templates
- **[AI-Powered Prediction Market](/cre/demos/prediction-market)** — Full end-to-end demo integrating CRE with Gemini AI and Firebase

### Deploy to production

{/* prettier-ignore */}
<Aside type="note" title="Deployment access required">
Deploying requires Early Access approval. <a href="https://cre.chain.link/request-access" target="_blank" rel="noopener noreferrer">Request access here</a>. While you wait, continue building and simulating workflows.
</Aside>

1. **[Link a Wallet Key](/cre/organization/linking-keys)** — Connect your wallet to your organization
1. **[Deploy Your Workflow](/cre/guides/operations/deploying-workflows)** — Push your workflow live
1. **[Monitor Your Workflow](/cre/guides/operations/monitoring-workflows)** — Watch it execute and debug issues

### Explore different triggers

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

- **[HTTP Trigger](/cre/guides/workflow/using-triggers/http-trigger/overview)** — Trigger via API calls
- **[EVM Log Trigger](/cre/guides/workflow/using-triggers/evm-log-trigger)** — React to onchain events

### Add secrets

Real workflows need API keys and sensitive data:

- **[Using Secrets in Simulation](/cre/guides/workflow/secrets/using-secrets-simulation)** — Local development
- **[Using Secrets with Deployed Workflows](/cre/guides/workflow/secrets/using-secrets-deployed)** — Store secrets in the Vault DON for production
- **[Managing Secrets with 1Password](/cre/guides/workflow/secrets/managing-secrets-1password)** — Best practice: inject secrets at runtime

### Build your own consumer contract

- **[Building Consumer Contracts](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts)** — Create contracts that receive CRE data

## Reference

Dive deeper into concepts from this guide:

| Topic | Resources |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Workflow structure** | [Core SDK](/cre/reference/sdk/core), [Triggers Overview](/cre/guides/workflow/using-triggers/overview) |
| **HTTP & offchain data** | [API Interactions](/cre/guides/workflow/using-http-client), [Consensus & Aggregation](/cre/reference/sdk/consensus) |
| **EVM interactions** | [EVM Client Overview](/cre/guides/workflow/using-evm-client/overview), [Onchain Read](/cre/guides/workflow/using-evm-client/onchain-read), [Onchain Write](/cre/guides/workflow/using-evm-client/onchain-write/overview) |
| **Configuration** | [Project Configuration](/cre/reference/project-configuration), [Secrets Guide](/cre/guides/workflow/secrets) |
| **All capabilities** | [Capabilities Overview](/cre/capabilities) |
115 changes: 115 additions & 0 deletions src/content/cre/getting-started/before-you-build-ts.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
section: cre
title: "Before You Build"
date: Last Modified
pageId: "getting-started-before-you-build"
sdkLang: "ts"
metadata:
description: "Essential tips before building your own CRE workflows: library compatibility, Solidity integers, working with time, and next steps for production deployment."
datePublished: "2026-02-04"
lastModified: "2026-02-04"
---

import { Aside } from "@components"

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.

## Library compatibility

Your TypeScript code compiles to WebAssembly and runs in a QuickJS environment, **not Node.js**. Some NPM packages won't work if they rely on Node.js-specific APIs like `node:crypto` or `node:fs`.

**Before using a third-party package:**

1. Check if it relies on Node.js built-in modules
1. Test with `cre workflow simulate` — simulation uses the same WASM environment as production, so compatibility issues surface immediately

{/* prettier-ignore */}
<Aside type="tip" title="Learn more">
See [TypeScript Runtime Environment](/cre/concepts/typescript-wasm-runtime) for details on QuickJS compatibility and how to [verify library support](/cre/concepts/typescript-wasm-runtime#checking-library-compatibility).
</Aside>

## Working with Solidity integers

When sending values to smart contracts, always use `bigint` (with the `n` suffix) in your workflow code. JavaScript `number` loses precision for large values, causing **silent precision loss**.

```typescript
// WRONG - silent precision loss
const amount = 10000000000000001 // 10 quadrillion + 1
// Silently becomes 10000000000000000 (the +1 vanishes)

// CORRECT - use bigint
const amount = 10000000000000001n // Stays exactly 10000000000000001
```

{/* prettier-ignore */}
<Aside type="tip" title="Learn more">
See [Writing Data Onchain](/cre/guides/workflow/using-evm-client/onchain-write/writing-data-onchain#step-2-abi-encode-your-value) for the complete Solidity-to-TypeScript type mapping.
</Aside>

## Working with time

If your workflow uses timestamps (e.g., for API authentication or time-based queries), use `runtime.now()` instead of `Date.now()`. This ensures all nodes in the DON use the same timestamp and can reach consensus.

{/* prettier-ignore */}
<Aside type="tip" title="Learn more">
See [Using Time in Workflows](/cre/guides/workflow/time-in-workflows) for details on DON time and best practices.
</Aside>

{/* prettier-ignore */}
<Aside type="note" title="Going deeper">
These are the most common cases. For a complete guide to non-determinism (object iteration, Promise handling, and more), see [Avoiding Non-Determinism in Workflows](/cre/concepts/non-determinism).
</Aside>

## What's next?

Here are resources to help you go from simulation to production.

### Learn from examples

- **[Run the Custom Data Feed Demo](/cre/templates/running-demo-workflow)** — A starter template you can run locally and customize
- **[Browse all Templates](/cre/templates)** — Building blocks for specific patterns (secrets, HTTP auth, streams) and starter templates
- **[AI-Powered Prediction Market](/cre/demos/prediction-market)** — Full end-to-end demo integrating CRE with Gemini AI and Firebase

### Deploy to production

{/* prettier-ignore */}
<Aside type="note" title="Deployment access required">
Deploying requires Early Access approval. <a href="https://cre.chain.link/request-access" target="_blank" rel="noopener noreferrer">Request access here</a>. While you wait, continue building and simulating workflows.
</Aside>

1. **[Link a Wallet Key](/cre/organization/linking-keys)** — Connect your wallet to your organization
1. **[Deploy Your Workflow](/cre/guides/operations/deploying-workflows)** — Push your workflow live
1. **[Monitor Your Workflow](/cre/guides/operations/monitoring-workflows)** — Watch it execute and debug issues

### Explore different triggers

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

- **[HTTP Trigger](/cre/guides/workflow/using-triggers/http-trigger/overview)** — Trigger via API calls
- **[EVM Log Trigger](/cre/guides/workflow/using-triggers/evm-log-trigger)** — React to onchain events

### Add secrets

Real workflows need API keys and sensitive data:

- **[Using Secrets in Simulation](/cre/guides/workflow/secrets/using-secrets-simulation)** — Local development
- **[Using Secrets with Deployed Workflows](/cre/guides/workflow/secrets/using-secrets-deployed)** — Store secrets in the Vault DON for production
- **[Managing Secrets with 1Password](/cre/guides/workflow/secrets/managing-secrets-1password)** — Best practice: inject secrets at runtime

### Build your own consumer contract

- **[Building Consumer Contracts](/cre/guides/workflow/using-evm-client/onchain-write/building-consumer-contracts)** — Create contracts that receive CRE data

## Reference

Dive deeper into concepts from this guide:

| Topic | Resources |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Workflow structure** | [Core SDK](/cre/reference/sdk/core), [Triggers Overview](/cre/guides/workflow/using-triggers/overview) |
| **HTTP & offchain data** | [API Interactions](/cre/guides/workflow/using-http-client), [Consensus & Aggregation](/cre/reference/sdk/consensus) |
| **EVM interactions** | [EVM Client Overview](/cre/guides/workflow/using-evm-client/overview), [Onchain Read](/cre/guides/workflow/using-evm-client/onchain-read), [Onchain Write](/cre/guides/workflow/using-evm-client/onchain-write/overview) |
| **Configuration** | [Project Configuration](/cre/reference/project-configuration), [Secrets Guide](/cre/guides/workflow/secrets) |
| **All capabilities** | [Capabilities Overview](/cre/capabilities) |
115 changes: 0 additions & 115 deletions src/content/cre/getting-started/conclusion.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,4 @@ To learn more about implementing consumer contracts and the secure write process

You've now mastered the complete CRE development workflow!

- **[Conclusion & Next Steps](/cre/getting-started/conclusion)**: Review what you've learned and find resources for advanced topics.
- **[Before You Build](/cre/getting-started/before-you-build-go)**: Don't skip this — critical tips before building your own workflows.
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ To learn more about implementing consumer contracts and the secure write process

You've now mastered the complete CRE development workflow!

- **[Conclusion & Next Steps](/cre/getting-started/conclusion)**: Review what you've learned and find resources for advanced topics.
- **[Before You Build](/cre/getting-started/before-you-build-ts)**: Don't skip this — critical tips before building your own workflows.
Loading
Loading