Skip to content

Commit 29230b6

Browse files
committed
updated guide with new link funded verifier step
1 parent b694b42 commit 29230b6

File tree

1 file changed

+93
-95
lines changed

1 file changed

+93
-95
lines changed

src/content/quickstarts/transmitter.mdx

Lines changed: 93 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Before you start this tutorial, ensure you have the following prerequisites:
8282

8383
---
8484

85-
## Steps to implement
85+
## Steps to Implement
8686

8787
<Accordion title="Deploy Consumer Contract" number={1}>
8888
First, deploy a `DataStreamsFeed.sol` contract. This contract receives and stores the data relayed by the Transmitter. This guide uses [Foundry](https://book.getfoundry.sh/) to build and deploy the contract from a pre-configured repository.
@@ -119,7 +119,7 @@ First, deploy a `DataStreamsFeed.sol` contract. This contract receives and store
119119
source .env
120120
```
121121
122-
1. Configure `script/DeployDataStreamsFeedWithRoleAssign.s.sol` (or `script/DeployDataStreamsFeed.s.sol`, if you prefer to use the Deploy Only contract below).
122+
1. Configure `script/DeployDataStreamsFeed.s.sol`.
123123
124124
This script deploys the `DataStreamsFeed` contract, which is the consumer contract that will receive data from the Transmitter. You need to set the constructor arguments for the contract.
125125
@@ -130,89 +130,55 @@ First, deploy a `DataStreamsFeed.sol` contract. This contract receives and store
130130
| `_decimals` | `18` | The number of decimals for the data. |
131131
| `_description` | `"ETH / USD Feed"` | A human-readable description for the feed. |
132132
133-
1. Choose your deployment method below and run the corresponding script.
134-
135-
<TabsContent sharedStore="deployType" client:visible>
136-
<Fragment slot="tab.1">One-Shot Deploy (Recommended)</Fragment>
137-
<Fragment slot="tab.2">Deploy Only</Fragment>
138-
<Fragment slot="panel.1">
139-
This is the simplest method. It deploys the contract and automatically grants the `ADMIN` and `REPORT_VERIFIER` roles to the deploying wallet address.
133+
1. Deploy the contract via the command line.
140134
141135
Run the deployment script to deploy to **Avalanche Fuji**:
142136
```sh
143-
forge script script/DeployDataStreamsFeedWithRoleAssign.s.sol:DeployDataStreamsFeedWithRoleAssign \
137+
forge script script/DeployDataStreamsFeed.s.sol:DeployDataStreamsFeed \
144138
--rpc-url $RPC_URL_AVAX_FUJI \
145139
--private-key $PRIVATE_KEY \
146140
--broadcast
147141
```
148142
After deployment, copy the **Deployed Contract Address** and **ABI** from the output. You will need them to configure the Transmitter.
149-
- **Contract Address:** Find the contract address in your terminal output under `deployedAddress`.
150-
- **Contract ABI:** Foundry saves the ABI in `out/DataStreamsFeed.sol/DataStreamsFeed.json`.
151-
152-
</Fragment>
153-
154-
<Fragment slot="panel.2">
155-
This method provides more granular control, deploying the contract first and requiring you to grant roles manually.
156-
157-
1. Run the deployment script:
158-
```sh
159-
forge script script/DeployDataStreamsFeed.s.sol:DeployDataStreamsFeed \
160-
--rpc-url $RPC_URL_AVAX_FUJI \
161-
--private-key $PRIVATE_KEY \
162-
--broadcast
163-
```
164-
1. Copy the **Deployed Contract Address** and **ABI** from the output.
165-
166-
1. Grant the `REPORT_VERIFIER_ROLE` to the wallet address you will use for your Transmitter service.
167-
```bash
168-
# The address of the contract you just deployed
169-
DEPLOYED_FEED_ADDRESS=<0xYOUR_DEPLOYED_CONTRACT_ADDRESS>
170-
171-
# The wallet address of your transmitter service
172-
TRANSMITTER_WALLET_ADDRESS=<0xYOUR_TRANSMITTER_WALLET_ADDRESS>
173-
174-
# REPORT_VERIFIER role hash (= keccak256("REPORT_VERIFIER_ROLE"))
175-
ROLE=0xf9f8c20c4c3b902ac9f63b3ab127d0fa52ad9efa682a9cbbead7833d9777cd4e
176-
177-
cast send $DEPLOYED_FEED_ADDRESS "grantRole(bytes32,address)" $ROLE $TRANSMITTER_WALLET_ADDRESS \
178-
--rpc-url $RPC_URL_AVAX_FUJI \
179-
--private-key $PRIVATE_KEY
180-
```
181-
1. (Optional) Verify your contract on Snowtrace/Routescan:
182-
```sh
183-
forge verify-contract \
184-
--chain-id 43113 \
185-
--verifier etherscan \
186-
--verifier-url "https://api.routescan.io/v2/network/testnet/evm/43113/etherscan/api" \
187-
<DEPLOYED_FEED_ADDRESS> \
188-
src/feed/DataStreamsFeed.sol:DataStreamsFeed \
189-
--flatten \
190-
--etherscan-api-key <YOUR_API_KEY>
191-
```
192-
193-
</Fragment>
194-
195-
</TabsContent>
143+
- **Contract Address:** Find the contract address in your terminal output under `deployedAddress`.
144+
- **Contract ABI:** Foundry saves the ABI in `out/DataStreamsFeed.sol/DataStreamsFeed.json`.
145+
146+
1. Fund the contract with `LINK`.
147+
148+
After deployment, transfer some testnet `LINK` to the feed contract address, which allows the contract to pay for verification fees.
149+
150+
```sh
151+
# Example using cast to transfer 5 LINK (18 decimals)
152+
cast send $LINK_TOKEN "transfer(address,uint256)" \
153+
<DEPLOYED_FEED_ADDRESS> 5000000000000000000 \
154+
--rpc-url $RPC_URL_AVAX_FUJI \
155+
--private-key $PRIVATE_KEY
156+
```
157+
196158
</Accordion>
197159
198160
<Accordion title="Set Up Transmitter" number={2}>
199161
With a consumer contract on-chain, you can now set up the Transmitter service to relay data to it.
200162
201163
1. In a new terminal window, navigate to your development space and clone the [Data Stream Transmitter repository][GITHUB_REPO]:
164+
202165
```bash
203166
git clone https://github.com/hackbg/chainlink-datastreams-transmitter.git
204167
cd transmitter-app
205168
```
169+
206170
1. Install the project dependencies using `npm`:
207171
208172
```bash
209173
npm install
210174
```
211175
212176
1. Copy the example environment file:
177+
213178
```bash
214179
cp .env.example .env
215180
```
181+
216182
1. Open your `.env` file in a text editor and provide the required values:
217183
| Variable | Description |
218184
| :-------------------------- | :------------------------------------------------------------------------------------ |
@@ -222,77 +188,114 @@ With a consumer contract on-chain, you can now set up the Transmitter service to
222188
223189
<Aside type="danger" title="Configuration Warning">
224190
225-
**These configuration files reference sensitive information**.
191+
**These configuration files reference sensitive information**.
226192
227-
The `.env` file references your Data Streams API credentials and your wallet's private key. It is your responsibility to ensure that you provide these values in a way that you or your organization deems secure.
193+
The `.env` file references your Data Streams API credentials and your wallet's private key. It is your responsibility to ensure that you provide these values in a way that you or your organization deems secure.
228194
229-
</Aside>
195+
</Aside>
230196
231197
1. Create the runtime configuration file by copying the example:
198+
232199
```bash
233200
cp config-chainlink-example.yml config.yml
234201
```
202+
235203
1. Open `config.yml` in a text editor. Update the `targetChains` section to point to the contract you deployed on **Avalanche Fuji**.
236204
237205
```yaml
238-
# --- Feeds (off-chain subscriptions) ----------------------------
239206
feeds:
240207
- name: "ETH/USD"
241208
feedId: "0x000359843a543ee2fe414dc14c7e7920ef10f4372990b79d6361cdc0dd1ba782"
242209
243-
# --- Defaults ---------------------------------------------------
244-
chainId: 43113 # Default target chain is Avalanche Fuji
245-
gasCap: "150000"
246-
interval: "*/30 * * * * *" # Every 30 seconds
247-
priceDeltaPercentage: 0.01 # 0.01 %
210+
# --- Default Global Settings ---
248211
249-
# --- RPC & Currency metadata -----------------------------------
212+
# The default chainId to use for transactions if not specified in a target.
213+
chainId: 43113 # Default to Avalanche Fuji
214+
215+
# The maximum gas limit you are willing to spend on a transaction.
216+
gasCap: "250000"
217+
218+
# Cron expression defining the data update frequency.
219+
# This example runs every 30 seconds.
220+
interval: "*/30 * * * * *"
221+
222+
# The minimum price change percentage to trigger an on-chain update.
223+
# This example is set to 0.1%
224+
priceDeltaPercentage: 0.001
225+
226+
# --- Chain & Verifier Definitions ---
227+
228+
# A list of all supported blockchain networks with their RPC URLs.
250229
chains:
251-
# Avalanche Fuji
252230
- id: 43113
253-
name: "Avalanche Fuji Network"
254-
rpc: "https://api.avax-test.network/ext/bc/C/rpc"
255-
# ... other chain details
256-
257-
# --- Data-Streams Verifier addresses ----------------------------
231+
name: "Avalanche Fuji Testnet"
232+
currencyName: "Fuji AVAX"
233+
currencySymbol: "AVAX"
234+
currencyDecimals: 18
235+
rpc: "https://api.avax-test.network/ext/bc/C/rpc" # <-- TODO: Replace with your own reliable RPC URL
236+
testnet: true
237+
- id: 421614
238+
name: "Arbitrum Sepolia"
239+
currencyName: "Arbitrum Sepolia Ether"
240+
currencySymbol: "ETH"
241+
currencyDecimals: 18
242+
rpc: "https://sepolia-rollup.arbitrum.io/rpc" # <-- TODO: Replace with your own reliable RPC URL
243+
testnet: true
244+
245+
# The addresses of the official Chainlink Verifier contracts on each network.
258246
verifierAddresses:
259-
- chainId: 43113 # Avalanche Fuji
247+
- chainId: 43113
260248
address: "0x2bf612C65f5a4d388E687948bb2CF842FFb8aBB3"
249+
- chainId: 421614
250+
address: "0x2ff010DEbC1297f19579B4246cad07bd24F2488A"
261251
262-
# --- Target contracts (on-chain writes) -------------------------
252+
# --- On-Chain Target Configurations ---
253+
254+
# This section defines which smart contracts to call for each feed on each chain.
255+
# You can have multiple targets for the same feed.
263256
targetChains:
264-
- chainId: 43113 # Avalanche Fuji
257+
- chainId: 43113 # Target is on Avalanche Fuji
265258
targetContracts:
259+
# This configuration sends ETH/USD data to a contract on Fuji
266260
- feedId: "0x000359843a543ee2fe414dc14c7e7920ef10f4372990b79d6361cdc0dd1ba782"
267-
# PASTE YOUR DEPLOYED CONTRACT ADDRESS HERE
268-
address: "0xYOUR_AVALANCHE_FUJI_CONTRACT_ADDRESS"
269-
functionName: updateReport
270-
functionArgs: [reportVersion, verifiedReport]
261+
address: "0xYourDataStreamsFeedContractOnFuji" # <-- UPDATE WITH YOUR CONTRACT ADDRESS
262+
# The name of the function to call on your smart contract
263+
functionName: "verifyAndUpdateReport"
264+
# The arguments the Transmitter should prepare and send to the function
265+
# • rawReport = the unverified payload from the Data Streams websocket
266+
# • parameterPayload = abi.encode(address feeToken) – produced automatically by the transmitter
267+
functionArgs: ["rawReport", "parameterPayload"]
268+
# The ABI for the target function, required to encode the transaction
271269
abi:
272-
- inputs:
273-
[
274-
{ internalType: uint16, name: reportVersion, type: uint16 },
275-
{ internalType: bytes, name: verifiedReportData, type: bytes },
276-
]
277-
name: updateReport
270+
- name: "verifyAndUpdateReport"
271+
type: "function"
272+
stateMutability: "nonpayable"
273+
inputs:
274+
- { "internalType": "bytes", "name": "unverifiedReportData", "type": "bytes" }
275+
- { "internalType": "bytes", "name": "parameterPayload", "type": "bytes" }
278276
outputs: []
279-
stateMutability: nonpayable
280-
type: function
277+
# Off-chain verification must run so keep skipVerify false (default)
278+
skipVerify: false
281279
```
282280
281+
- Replace `0xYOUR_AVALANCHE_FUJI_CONTRACT_ADDRESS` with the address of the contract you deployed in the previous step.
282+
- The `feedId` should match the one you set in the contract deployment.
283+
283284
1. Start the Docker daemon.
284285
285286
The Docker daemon is required to run the Redis instance that Transmitter uses. Starting the daemon depends on your operating system. Please refer to the [Docker documentation](https://docs.docker.com/engine/daemon/start/) for instructions.
286287
287288
1. Run the following command to start the Transmitter and its services in the background:
289+
288290
```bash
289291
docker compose up -d
290292
```
293+
291294
1. Open your web browser and navigate to `http://localhost:3000` to access the Transmitter UI. Because you pre-configured the contract in `config.yml`, the `ETH/USD` stream on the dashboard should show a `Running` status.
292295
293296
<Aside type="tip" title="Troubleshooting">
294-
If you experience any crashes or issues, see the [Troubleshooting](#troubleshooting) section at the end of this guide
295-
for common problems and solutions.
297+
If you experience any crashes or issues, see the [Troubleshooting](#troubleshooting) section at the end of this guide
298+
for common problems and solutions.
296299
</Aside>
297300
</Accordion>
298301
@@ -415,11 +418,6 @@ If you run into issues during setup or operation, refer to these common problems
415418
- When deploying with Foundry, you can adjust the `gas_limit` in your `foundry.toml` file.
416419
- For the transmitter, you can increase the `gasCap` value in your `config.yml` file.
417420
418-
- **Transactions failing with a `REPORT_VERIFIER missing` error**
419-
420-
- This error means the wallet address used by the transmitter has not been granted the `REPORT_VERIFIER_ROLE` on your deployed contract.
421-
- Make sure you've granted the role to the correct address.
422-
423421
- **Missing private key**
424422
- `forge script` will silently fall back to Foundry's default dev key and assign contract roles to `0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`.
425423
- Always pass your key via `--private-key` or export it in `.env/shell`.

0 commit comments

Comments
 (0)