From fb17faaaa54a676b8cee9c375a25b098b41020a5 Mon Sep 17 00:00:00 2001 From: De Clercq Wentzel <10665586+wentzeld@users.noreply.github.com> Date: Sun, 15 Feb 2026 17:51:21 -0800 Subject: [PATCH 1/2] docs: add safe decimal scaling section and caution boxes Add a new Safe decimal scaling section to Before You Build covering parseUnits and formatUnits from viem. Add caution boxes to Onchain Read and Writing Data Onchain pages linking to the new section. --- .../getting-started/before-you-build-ts.mdx | 40 ++++++++++++++++++- .../using-evm-client/onchain-read-ts.mdx | 5 +++ .../onchain-write/writing-data-onchain.mdx | 5 +++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/content/cre/getting-started/before-you-build-ts.mdx b/src/content/cre/getting-started/before-you-build-ts.mdx index aab337683b2..e00d7583c2a 100644 --- a/src/content/cre/getting-started/before-you-build-ts.mdx +++ b/src/content/cre/getting-started/before-you-build-ts.mdx @@ -5,7 +5,7 @@ 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." + description: "Essential tips before building your own CRE workflows: library compatibility, Solidity integers, safe decimal scaling, working with time, and next steps for production deployment." datePublished: "2026-02-04" lastModified: "2026-02-04" --- @@ -53,6 +53,44 @@ const amount = 10000000000000001n // Stays exactly 10000000000000001 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. +## Safe decimal scaling + +Smart contracts use fixed-point integers (e.g., 18 decimals for ERC-20 tokens). When converting between human-readable values and their onchain representations, avoid floating-point arithmetic — it causes **silent precision loss**. + +Use viem's `parseUnits()` to scale up and `formatUnits()` to scale down. Both operate on strings, so no floating-point math is involved. + +### Scaling up (human-readable to onchain) + +```typescript +import { parseUnits } from "viem" + +// WRONG - floating-point precision loss +const amount = BigInt(0.1 * 1e18) +// Result: 99999999999999984n (off by 16) + +// CORRECT - string-based, no precision loss +const amount = parseUnits("0.1", 18) +// Result: 100000000000000000n (exact) +``` + +### Scaling down (onchain to human-readable) + +```typescript +import { formatUnits } from "viem" + +// WRONG - precision loss for large bigints +const display = Number(totalSupply) / 1e18 + +// CORRECT - string-based, no precision loss +const display = formatUnits(totalSupply, 18) +// Returns "1.5" for 1500000000000000000n +``` + +{/* prettier-ignore */} + + ## 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. diff --git a/src/content/cre/guides/workflow/using-evm-client/onchain-read-ts.mdx b/src/content/cre/guides/workflow/using-evm-client/onchain-read-ts.mdx index a18e0698f64..806ad879ccb 100644 --- a/src/content/cre/guides/workflow/using-evm-client/onchain-read-ts.mdx +++ b/src/content/cre/guides/workflow/using-evm-client/onchain-read-ts.mdx @@ -289,6 +289,11 @@ Viem automatically handles type conversions: | `string` | `string` | | `bytes`, `bytes32`, etc. | `Uint8Array` | +{/* prettier-ignore */} + + ## Complete example with configuration Here's a full runnable workflow with external configuration: diff --git a/src/content/cre/guides/workflow/using-evm-client/onchain-write/writing-data-onchain.mdx b/src/content/cre/guides/workflow/using-evm-client/onchain-write/writing-data-onchain.mdx index ac97779cba8..66a5da69294 100644 --- a/src/content/cre/guides/workflow/using-evm-client/onchain-write/writing-data-onchain.mdx +++ b/src/content/cre/guides/workflow/using-evm-client/onchain-write/writing-data-onchain.mdx @@ -105,6 +105,11 @@ const amount = 10000000000000001n // Stays exactly 10000000000000001 +{/* prettier-ignore */} + + ### Step 3: Generate the signed report Convert the encoded data to base64 and generate a report: From a88104b21535c9c903084aeec849c61b95a28b5f Mon Sep 17 00:00:00 2001 From: Karim <98668332+khadni@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:37:10 -0500 Subject: [PATCH 2/2] llm gen --- src/content/cre/llms-full-go.txt | 222 ++++++++++++------------- src/content/cre/llms-full-ts.txt | 270 ++++++++++++++++++------------- 2 files changed, 270 insertions(+), 222 deletions(-) diff --git a/src/content/cre/llms-full-go.txt b/src/content/cre/llms-full-go.txt index 683eb5939d6..16d5e27de31 100644 --- a/src/content/cre/llms-full-go.txt +++ b/src/content/cre/llms-full-go.txt @@ -7486,117 +7486,6 @@ Learn more about how to use CRE capabilities with built-in consensus: --- -# CRE Templates -Source: https://docs.chain.link/cre/templates -Last Updated: 2025-11-21 - -Templates are workflow examples you can copy and customize for your own projects. They are curated and maintained by Chainlink, offering patterns you can use as references or starting points for your own workflows. - - - - -## Building Blocks and Starter Templates - -Templates are organized into two categories: - -### 1. Building Blocks - -[Building Blocks](https://github.com/smartcontractkit/cre-templates/tree/main/building-blocks) are small, focused examples that teach **one concept at a time**. Each Building Block is self-contained and demonstrates a specific CRE capability or pattern. They feature minimal code, clear configuration, and are runnable locally with `cre workflow simulate`. - -**Available Building Blocks:** - -1. **`kv-store`** (Key-Value Store with AWS S3) - - Reads a value from an AWS S3 object, increments it, and writes it back - - Demonstrates: SigV4-signed HTTP requests, CRE secrets (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`), and consensus read → single write flow - - Use case: Learn offchain write patterns with secrets and consensus - -2. **`read-data-feeds`** (Chainlink Data Feeds) - - Reads `decimals()` and `latestAnswer()` from Chainlink Data Feeds on a cron schedule - - Demonstrates: Contract ABIs, Go bindings generation, RPC configuration, and onchain reads - - Use case: Learn how to read onchain data via contract calls - -**When to use Building Blocks:** - -- You want to learn a specific feature quickly (e.g., secrets + HTTP signing, reading a data feed, cron triggers) -- You need a focused code snippet to copy into your project -- You're exploring a new capability before integrating it into a larger workflow - -### 2. Starter Templates - -[Starter Templates](https://github.com/smartcontractkit/cre-templates/tree/main/starter-templates) are complete, end-to-end workflows that combine multiple capabilities and mirror real-world use cases. These templates are more comprehensive than Building Blocks and include production-like configuration, optional precompiled smart contracts, and generated bindings. They can be adapted directly into your own projects. - -**Available Starter Templates:** - -1. **`custom-data-feed`** (Custom Data Feed) - - Periodically fetches offchain data via HTTP and pushes updates onchain - - Demonstrates: Cron scheduling, secrets management, contract bindings, and blockchain writes - - Use case: Build data feeds that combine offchain APIs with onchain smart contracts - -2. **`bring-your-own-data`** (BYOD - NAV & PoR) - - End-to-end examples for publishing Net Asset Value (NAV) and Proof of Reserve (PoR) data onchain - - Demonstrates: Complete workflow with demo contracts for publishing institutional data - - Use case: Publish verified financial or reserve data to smart contracts - -3. **`multi-chain-token-manager`** (Multi-Chain Token Manager) - - Orchestrates token operations and state across multiple blockchain networks - - Demonstrates: Multi-chain RPC configuration, bindings, and cross-chain coordination patterns - - Use case: Manage token operations across different EVM chains from a single workflow - -**When to use Starter Templates:** - -- You want a runnable reference architecture that shows production-ready patterns -- You're starting a new project and need a solid foundation -- You want to see how multiple CRE capabilities integrate in a real workflow - -### How to access templates - -All templates are available on GitHub at [github.com/smartcontractkit/cre-templates](https://github.com/smartcontractkit/cre-templates) - -- Browse all Building Blocks and Starter Templates -- Clone or fork templates to customize them for your use case -- View individual READMEs for detailed usage instructions - - - -## When to use what - -Choose the right template based on where you are in your CRE journey: - -| Your Situation | Recommended Action | -| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- | -| Just finished the [Getting Started guide](/cre/getting-started/overview) | Run the **Custom Data Feed** template to see a more complex, real-world example | -| Want to learn offchain writes with secrets and consensus | Clone the **`kv-store`** Building Block (AWS S3 example) | -| Need to read Chainlink Data Feeds in your workflow | Clone the **`read-data-feeds`** Building Block (onchain reads with ABIs) | -| Building a custom data feed for your protocol | Fork the **`custom-data-feed`** Starter Template and customize it | -| Publishing NAV or PoR data onchain | Fork the **`bring-your-own-data`** Starter Template (includes demo contracts) | -| Managing tokens across multiple chains | Fork the **`multi-chain-token-manager`** Starter Template (cross-chain patterns) | - -## Next steps - -Ready to explore templates? - -- **[Run the Custom Data Feed Template](/cre/templates/running-demo-workflow)** - Walk through this template with our step-by-step guide (available in Go and TypeScript) - -- **[Browse all templates on GitHub](https://github.com/smartcontractkit/cre-templates)** - Explore the full collection of Building Blocks and Starter Templates - - - ---- - # AI-Powered Prediction Market Source: https://docs.chain.link/cre/demos/prediction-market Last Updated: 2025-11-21 @@ -15995,6 +15884,117 @@ For forwarder contract addresses and chain names, see the [Forwarder Directory]( --- +# CRE Templates +Source: https://docs.chain.link/cre/templates +Last Updated: 2025-11-21 + +Templates are workflow examples you can copy and customize for your own projects. They are curated and maintained by Chainlink, offering patterns you can use as references or starting points for your own workflows. + + + + +## Building Blocks and Starter Templates + +Templates are organized into two categories: + +### 1. Building Blocks + +[Building Blocks](https://github.com/smartcontractkit/cre-templates/tree/main/building-blocks) are small, focused examples that teach **one concept at a time**. Each Building Block is self-contained and demonstrates a specific CRE capability or pattern. They feature minimal code, clear configuration, and are runnable locally with `cre workflow simulate`. + +**Available Building Blocks:** + +1. **`kv-store`** (Key-Value Store with AWS S3) + - Reads a value from an AWS S3 object, increments it, and writes it back + - Demonstrates: SigV4-signed HTTP requests, CRE secrets (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`), and consensus read → single write flow + - Use case: Learn offchain write patterns with secrets and consensus + +2. **`read-data-feeds`** (Chainlink Data Feeds) + - Reads `decimals()` and `latestAnswer()` from Chainlink Data Feeds on a cron schedule + - Demonstrates: Contract ABIs, Go bindings generation, RPC configuration, and onchain reads + - Use case: Learn how to read onchain data via contract calls + +**When to use Building Blocks:** + +- You want to learn a specific feature quickly (e.g., secrets + HTTP signing, reading a data feed, cron triggers) +- You need a focused code snippet to copy into your project +- You're exploring a new capability before integrating it into a larger workflow + +### 2. Starter Templates + +[Starter Templates](https://github.com/smartcontractkit/cre-templates/tree/main/starter-templates) are complete, end-to-end workflows that combine multiple capabilities and mirror real-world use cases. These templates are more comprehensive than Building Blocks and include production-like configuration, optional precompiled smart contracts, and generated bindings. They can be adapted directly into your own projects. + +**Available Starter Templates:** + +1. **`custom-data-feed`** (Custom Data Feed) + - Periodically fetches offchain data via HTTP and pushes updates onchain + - Demonstrates: Cron scheduling, secrets management, contract bindings, and blockchain writes + - Use case: Build data feeds that combine offchain APIs with onchain smart contracts + +2. **`bring-your-own-data`** (BYOD - NAV & PoR) + - End-to-end examples for publishing Net Asset Value (NAV) and Proof of Reserve (PoR) data onchain + - Demonstrates: Complete workflow with demo contracts for publishing institutional data + - Use case: Publish verified financial or reserve data to smart contracts + +3. **`multi-chain-token-manager`** (Multi-Chain Token Manager) + - Orchestrates token operations and state across multiple blockchain networks + - Demonstrates: Multi-chain RPC configuration, bindings, and cross-chain coordination patterns + - Use case: Manage token operations across different EVM chains from a single workflow + +**When to use Starter Templates:** + +- You want a runnable reference architecture that shows production-ready patterns +- You're starting a new project and need a solid foundation +- You want to see how multiple CRE capabilities integrate in a real workflow + +### How to access templates + +All templates are available on GitHub at [github.com/smartcontractkit/cre-templates](https://github.com/smartcontractkit/cre-templates) + +- Browse all Building Blocks and Starter Templates +- Clone or fork templates to customize them for your use case +- View individual READMEs for detailed usage instructions + + + +## When to use what + +Choose the right template based on where you are in your CRE journey: + +| Your Situation | Recommended Action | +| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- | +| Just finished the [Getting Started guide](/cre/getting-started/overview) | Run the **Custom Data Feed** template to see a more complex, real-world example | +| Want to learn offchain writes with secrets and consensus | Clone the **`kv-store`** Building Block (AWS S3 example) | +| Need to read Chainlink Data Feeds in your workflow | Clone the **`read-data-feeds`** Building Block (onchain reads with ABIs) | +| Building a custom data feed for your protocol | Fork the **`custom-data-feed`** Starter Template and customize it | +| Publishing NAV or PoR data onchain | Fork the **`bring-your-own-data`** Starter Template (includes demo contracts) | +| Managing tokens across multiple chains | Fork the **`multi-chain-token-manager`** Starter Template (cross-chain patterns) | + +## Next steps + +Ready to explore templates? + +- **[Run the Custom Data Feed Template](/cre/templates/running-demo-workflow)** - Walk through this template with our step-by-step guide (available in Go and TypeScript) + +- **[Browse all templates on GitHub](https://github.com/smartcontractkit/cre-templates)** - Explore the full collection of Building Blocks and Starter Templates + + + +--- + # Running a Demo Workflow Source: https://docs.chain.link/cre/templates/running-demo-workflow-go Last Updated: 2025-11-04 diff --git a/src/content/cre/llms-full-ts.txt b/src/content/cre/llms-full-ts.txt index 2483f6292b0..f1ccd6bed00 100644 --- a/src/content/cre/llms-full-ts.txt +++ b/src/content/cre/llms-full-ts.txt @@ -2931,6 +2931,11 @@ const reportData = encodeAbiParameters(parseAbiParameters("bool"), [true]) ``` + + + ### Step 3: Generate the signed report Convert the encoded data to base64 and generate a report: @@ -6255,117 +6260,6 @@ WebAssembly provides several benefits for CRE workflows: --- -# CRE Templates -Source: https://docs.chain.link/cre/templates -Last Updated: 2025-11-21 - -Templates are workflow examples you can copy and customize for your own projects. They are curated and maintained by Chainlink, offering patterns you can use as references or starting points for your own workflows. - - - - -## Building Blocks and Starter Templates - -Templates are organized into two categories: - -### 1. Building Blocks - -[Building Blocks](https://github.com/smartcontractkit/cre-templates/tree/main/building-blocks) are small, focused examples that teach **one concept at a time**. Each Building Block is self-contained and demonstrates a specific CRE capability or pattern. They feature minimal code, clear configuration, and are runnable locally with `cre workflow simulate`. - -**Available Building Blocks:** - -1. **`kv-store`** (Key-Value Store with AWS S3) - - Reads a value from an AWS S3 object, increments it, and writes it back - - Demonstrates: SigV4-signed HTTP requests, CRE secrets (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`), and consensus read → single write flow - - Use case: Learn offchain write patterns with secrets and consensus - -2. **`read-data-feeds`** (Chainlink Data Feeds) - - Reads `decimals()` and `latestAnswer()` from Chainlink Data Feeds on a cron schedule - - Demonstrates: Contract ABIs, Go bindings generation, RPC configuration, and onchain reads - - Use case: Learn how to read onchain data via contract calls - -**When to use Building Blocks:** - -- You want to learn a specific feature quickly (e.g., secrets + HTTP signing, reading a data feed, cron triggers) -- You need a focused code snippet to copy into your project -- You're exploring a new capability before integrating it into a larger workflow - -### 2. Starter Templates - -[Starter Templates](https://github.com/smartcontractkit/cre-templates/tree/main/starter-templates) are complete, end-to-end workflows that combine multiple capabilities and mirror real-world use cases. These templates are more comprehensive than Building Blocks and include production-like configuration, optional precompiled smart contracts, and generated bindings. They can be adapted directly into your own projects. - -**Available Starter Templates:** - -1. **`custom-data-feed`** (Custom Data Feed) - - Periodically fetches offchain data via HTTP and pushes updates onchain - - Demonstrates: Cron scheduling, secrets management, contract bindings, and blockchain writes - - Use case: Build data feeds that combine offchain APIs with onchain smart contracts - -2. **`bring-your-own-data`** (BYOD - NAV & PoR) - - End-to-end examples for publishing Net Asset Value (NAV) and Proof of Reserve (PoR) data onchain - - Demonstrates: Complete workflow with demo contracts for publishing institutional data - - Use case: Publish verified financial or reserve data to smart contracts - -3. **`multi-chain-token-manager`** (Multi-Chain Token Manager) - - Orchestrates token operations and state across multiple blockchain networks - - Demonstrates: Multi-chain RPC configuration, bindings, and cross-chain coordination patterns - - Use case: Manage token operations across different EVM chains from a single workflow - -**When to use Starter Templates:** - -- You want a runnable reference architecture that shows production-ready patterns -- You're starting a new project and need a solid foundation -- You want to see how multiple CRE capabilities integrate in a real workflow - -### How to access templates - -All templates are available on GitHub at [github.com/smartcontractkit/cre-templates](https://github.com/smartcontractkit/cre-templates) - -- Browse all Building Blocks and Starter Templates -- Clone or fork templates to customize them for your use case -- View individual READMEs for detailed usage instructions - - - -## When to use what - -Choose the right template based on where you are in your CRE journey: - -| Your Situation | Recommended Action | -| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- | -| Just finished the [Getting Started guide](/cre/getting-started/overview) | Run the **Custom Data Feed** template to see a more complex, real-world example | -| Want to learn offchain writes with secrets and consensus | Clone the **`kv-store`** Building Block (AWS S3 example) | -| Need to read Chainlink Data Feeds in your workflow | Clone the **`read-data-feeds`** Building Block (onchain reads with ABIs) | -| Building a custom data feed for your protocol | Fork the **`custom-data-feed`** Starter Template and customize it | -| Publishing NAV or PoR data onchain | Fork the **`bring-your-own-data`** Starter Template (includes demo contracts) | -| Managing tokens across multiple chains | Fork the **`multi-chain-token-manager`** Starter Template (cross-chain patterns) | - -## Next steps - -Ready to explore templates? - -- **[Run the Custom Data Feed Template](/cre/templates/running-demo-workflow)** - Walk through this template with our step-by-step guide (available in Go and TypeScript) - -- **[Browse all templates on GitHub](https://github.com/smartcontractkit/cre-templates)** - Explore the full collection of Building Blocks and Starter Templates - - - ---- - # AI-Powered Prediction Market Source: https://docs.chain.link/cre/demos/prediction-market Last Updated: 2025-11-21 @@ -7875,6 +7769,44 @@ const amount = 10000000000000001n // Stays exactly 10000000000000001 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. +## Safe decimal scaling + +Smart contracts use fixed-point integers (e.g., 18 decimals for ERC-20 tokens). When converting between human-readable values and their onchain representations, avoid floating-point arithmetic — it causes **silent precision loss**. + +Use viem's `parseUnits()` to scale up and `formatUnits()` to scale down. Both operate on strings, so no floating-point math is involved. + +### Scaling up (human-readable to onchain) + +```typescript +import { parseUnits } from "viem" + +// WRONG - floating-point precision loss +const amount = BigInt(0.1 * 1e18) +// Result: 99999999999999984n (off by 16) + +// CORRECT - string-based, no precision loss +const amount = parseUnits("0.1", 18) +// Result: 100000000000000000n (exact) +``` + +### Scaling down (onchain to human-readable) + +```typescript +import { formatUnits } from "viem" + +// WRONG - precision loss for large bigints +const display = Number(totalSupply) / 1e18 + +// CORRECT - string-based, no precision loss +const display = formatUnits(totalSupply, 18) +// Returns "1.5" for 1500000000000000000n +``` + + + + ## 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. @@ -10351,6 +10283,11 @@ Viem automatically handles type conversions: | `string` | `string` | | `bytes`, `bytes32`, etc. | `Uint8Array` | + + + ## Complete example with configuration Here's a full runnable workflow with external configuration: @@ -16681,6 +16618,117 @@ For forwarder contract addresses and chain names, see the [Forwarder Directory]( --- +# CRE Templates +Source: https://docs.chain.link/cre/templates +Last Updated: 2025-11-21 + +Templates are workflow examples you can copy and customize for your own projects. They are curated and maintained by Chainlink, offering patterns you can use as references or starting points for your own workflows. + + + + +## Building Blocks and Starter Templates + +Templates are organized into two categories: + +### 1. Building Blocks + +[Building Blocks](https://github.com/smartcontractkit/cre-templates/tree/main/building-blocks) are small, focused examples that teach **one concept at a time**. Each Building Block is self-contained and demonstrates a specific CRE capability or pattern. They feature minimal code, clear configuration, and are runnable locally with `cre workflow simulate`. + +**Available Building Blocks:** + +1. **`kv-store`** (Key-Value Store with AWS S3) + - Reads a value from an AWS S3 object, increments it, and writes it back + - Demonstrates: SigV4-signed HTTP requests, CRE secrets (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`), and consensus read → single write flow + - Use case: Learn offchain write patterns with secrets and consensus + +2. **`read-data-feeds`** (Chainlink Data Feeds) + - Reads `decimals()` and `latestAnswer()` from Chainlink Data Feeds on a cron schedule + - Demonstrates: Contract ABIs, Go bindings generation, RPC configuration, and onchain reads + - Use case: Learn how to read onchain data via contract calls + +**When to use Building Blocks:** + +- You want to learn a specific feature quickly (e.g., secrets + HTTP signing, reading a data feed, cron triggers) +- You need a focused code snippet to copy into your project +- You're exploring a new capability before integrating it into a larger workflow + +### 2. Starter Templates + +[Starter Templates](https://github.com/smartcontractkit/cre-templates/tree/main/starter-templates) are complete, end-to-end workflows that combine multiple capabilities and mirror real-world use cases. These templates are more comprehensive than Building Blocks and include production-like configuration, optional precompiled smart contracts, and generated bindings. They can be adapted directly into your own projects. + +**Available Starter Templates:** + +1. **`custom-data-feed`** (Custom Data Feed) + - Periodically fetches offchain data via HTTP and pushes updates onchain + - Demonstrates: Cron scheduling, secrets management, contract bindings, and blockchain writes + - Use case: Build data feeds that combine offchain APIs with onchain smart contracts + +2. **`bring-your-own-data`** (BYOD - NAV & PoR) + - End-to-end examples for publishing Net Asset Value (NAV) and Proof of Reserve (PoR) data onchain + - Demonstrates: Complete workflow with demo contracts for publishing institutional data + - Use case: Publish verified financial or reserve data to smart contracts + +3. **`multi-chain-token-manager`** (Multi-Chain Token Manager) + - Orchestrates token operations and state across multiple blockchain networks + - Demonstrates: Multi-chain RPC configuration, bindings, and cross-chain coordination patterns + - Use case: Manage token operations across different EVM chains from a single workflow + +**When to use Starter Templates:** + +- You want a runnable reference architecture that shows production-ready patterns +- You're starting a new project and need a solid foundation +- You want to see how multiple CRE capabilities integrate in a real workflow + +### How to access templates + +All templates are available on GitHub at [github.com/smartcontractkit/cre-templates](https://github.com/smartcontractkit/cre-templates) + +- Browse all Building Blocks and Starter Templates +- Clone or fork templates to customize them for your use case +- View individual READMEs for detailed usage instructions + + + +## When to use what + +Choose the right template based on where you are in your CRE journey: + +| Your Situation | Recommended Action | +| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------- | +| Just finished the [Getting Started guide](/cre/getting-started/overview) | Run the **Custom Data Feed** template to see a more complex, real-world example | +| Want to learn offchain writes with secrets and consensus | Clone the **`kv-store`** Building Block (AWS S3 example) | +| Need to read Chainlink Data Feeds in your workflow | Clone the **`read-data-feeds`** Building Block (onchain reads with ABIs) | +| Building a custom data feed for your protocol | Fork the **`custom-data-feed`** Starter Template and customize it | +| Publishing NAV or PoR data onchain | Fork the **`bring-your-own-data`** Starter Template (includes demo contracts) | +| Managing tokens across multiple chains | Fork the **`multi-chain-token-manager`** Starter Template (cross-chain patterns) | + +## Next steps + +Ready to explore templates? + +- **[Run the Custom Data Feed Template](/cre/templates/running-demo-workflow)** - Walk through this template with our step-by-step guide (available in Go and TypeScript) + +- **[Browse all templates on GitHub](https://github.com/smartcontractkit/cre-templates)** - Explore the full collection of Building Blocks and Starter Templates + + + +--- + # Running a Demo Workflow Source: https://docs.chain.link/cre/templates/running-demo-workflow-ts Last Updated: 2026-01-20