Integrate Chainlink Operator Contract with Chainlink Node
#chainlinknode #operator.sol
Requirements
MetaMask browser extension.
Address with sufficient LINK & ETH tokens in the network where you want to deploy a smart contract
Compile and deploy and Operator.sol contract through Remix IDE
Go to Remix Online IDE
Create new file, let’s call it MyOperator.sol
Go to tab “Solidity Compiler” in sidebar. Click “Compile MyOperator.sol”
Go to tab "Deploy & run transactions.
Click “ENVIRONMENT” -> “Injected Provider - MetaMask”. After that, the metamask extension should open. Select the network on which you want to process transactions. We will use Goerli testnet. Important: Chainlink Node and MyOperator contract must use the same network!
If everything is correct, your address should appear in the “ACCOUNT” field. In “CONTRACT” field find “Operator - @chainlink/contracts/src/v0.7/Operator.sol” and use it.
Expand the DEPLOY section. There you must fill in the LINK and OWNER parameters. LINK - the address of the LINK token in the selected network. Check (Chainlink Token addresses)[https://docs.chain.link/resources/link-token-contracts/] OWNER - is your address from the metamask.
Click “Transact” button, pay gas and wait when transaction is over.
If everything is correct, your contract should appear in the interaction menu, in the “Deployed Contracts” section
Setup MyOperator contract for integration with Chainlink Node
In “Deployed Contracts” section find Operator contract, which you deployed in the previous step. There is a set of contract fields that you can interact with.
Find “setAuthorizedSenders” method, expand it, fill senders parameter with value [“YOUR_CHAINLINK_NODE_ACCOUNT_ADDRESS”], click “Transact” button, pay gas and await when transaction over. Important! Chainlink Node Address shows on you Chainlink Node UI, this is NOT your address from MetaMask.
Find “getAuthorizedSenders” method and click on it. That should return array with your Chainlink Node Address.
Funding
Fund MyOperator contract with LINK. You can do this for example by Metamask transfer tokens. Be careful, it is required to sponsor at least the MINIMUM_CONTRACT_PAYMENT_LINK_JUELS configuration value in LINK on your Chainlink Node. To get started, 1-2 LINKs are usually enough.
Fund Chainlink Node Address with ETH. You can do this for example by Metamask transfer tokens
That’s all! Now your Chainlink node is connected to the blockchain.
Troubleshooting
Transaction reverted
Often this error occurs when you forgot to sponsor an Operator contract or Chainlink Node Address. Make sure you have sufficient funds in your accounts.
Last updated