Smart Contract Important Upgrade
The upgraded smart contract uses up to 90% less gas, supports
Meta-transactions, and allows you to participate in future votes.
Following the official launch of the Chainlink Off-Chain Reporting (OCR) which significantly improves the efficiency of how data is computed across Chainlink oracles, we’re proud to announce the Chainlink Smart Contract Upgrade (SCU). The upgraded smart contract is not a different contract, but just an improved version that notably reduces the gas costs up to 90%, supports Meta-transactions, and allows you to participate in future votes. This post is intended to serve as a reminder and reaffirmation of Chainlink’s SCU on Wednesday, March 17th, 2021 for all community members, users and ecosystem participants.
Current LINK holders will need to manually update their LINK tokens via a so called proxy contract, whose main purpose is to ensure a safe and seamless upgrade without breaking any dependencies. Although no immediate action needs to be taken, however, LINK holders who update early will be eligible for the new liquidity rewards program, starting on Q2 2021. If you have any questions, comments or concerns, please get in touch at firstname.lastname@example.org.
Why do we need to upgrade? If a smart contract has already deployed it cannot be modified, so how can we update it? We use a proxy contract that receives all message calls from the outside world and redirects them to a contract containing the application logic. We can then deploy a new logic contract and update the proxy contract to reference that new contract. In Ethereum this is possible thanks to the delegatecall opcode: by putting it into the contract’s fallback function, all calls will be proxied no matter what. This doesn’t mean that the application contract will be in responsible for executing the transaction, as the proxy actually call function code from the logic contract, executing that code in proxy contracts own context. Our application state will then naturally be inside the proxy storage, and context variables such as msg.sender or msg.value will still be related to the account which sent the transaction towards the proxy.
What is a Meta-transaction? This is a fancy name for a simple idea: a third-party (called a relayer) can send another user’s transactions and pay themselves for the gas cost. In this scheme, users sign messages (not transactions) containing information about a transaction they would like to execute. Relayers are then responsible for signing valid Ethereum transactions with this information and sending them to the network, paying for the gas cost. A base contract preserves the identity of the user that originally requested the transaction. In this way, users can interact directly with smart contracts without needing to have a wallet or own Ether.
Step by Step Guide and Update Options
There are three accessible methods to update your LINK tokens:
interacting with the LINK smart contract directly on Etherscan.
via MyEtherWallet’s“Interact with Contract”interface.
via the automatic update-script published on Chainlink’s Github.
The first two updating methods are pretty straightforward and intuitive. The third one, even though rather simple as well, has some limitations which should be considered before deciding to go forward. In this post we outline and detail and step by step walkthrough for each option.
MetaMask: Best for if you already have an existing wallet or if you have a hardware wallet. If you have a Trezor or Ledger you can connect through MetaMask and update without having your LINK leave your hardware wallet.
Portis, Torus, Fortmatic: Best for if you do not have an active existing wallet and need to send your LINK out of an exchange, custodian service or cold storage.
In any wallet choice, the LINK you wish to update must be in that active wallet along with a small amount of Ether to pay for the transaction cost of performing the update. Gas price fluctuates a lot and quite frequently lately, so make sure to check ETHGasStation so you don’t get your transaction stuck.
Things to note:
If you have LINK in exchanges or other places, you will need to withdraw it to whatever decentralized wallet (MetaMask, Trezor, Ledger, MyEtherWallet, MyCrypto etc.) you’re using.
In order to avoid accidental copy-and-paste errors, both smart contract addresses are delimited by underlines (“_”).
Despite the fact that we provide direct links in this walkthrough, we advise all users to manually insert the necessary website addresses in their browser’s address bar, check the website address and the SECURITY CERTIFICATE (green padlock symbol next to the address). Please check this every time you visit the chosen website just to avoid falling into scams such as duplicate sites.
LINK Smart Contract Address:
LINK Proxy Contract Address:
Update via Etherscan+MetaMask
1. Begin by navigating to the Chainlink contract on Etherscan. Navigate to the ①“Read Contract” tab, click on ②“totalSupply” function and copy the ③value shown without the “uint256”part – this will show, in attoLINK (ex: ‘wei’ or 10^18), the total amount of LINK tokens in existence right now (minus any coins that have been verifiably burned). You may also skip this part and when required, enter 1000000000000000000000000000 in the “_value(uint256)” field to set the maximum approval amount for the LINK token.
2. Now you need to set an approval for the LINK proxy contract. Switch to ④“Write Contract” tab on the LINK contract. You must connect to a Web3 instance such as MetaMask. You can connect a hardware wallet such as Trezor or Ledger to your MetaMask extension and thus interact without LINK tokens leaving your hardware wallet. Proceed by connecting your Web3 instance by clicking on the ⑤“Connect to Web3” button. The MetaMask window will pop up. Please, make sure you are using the correct network (Ethereum Mainnet) and that you are connecting to the right account that holds LINK tokens. Now, confirm the connection between Etherscan and MetaMask.
3. First, select the ⑥“approve” function and enter the LINK proxy contract address in the ⑦“_spender(address)” field, XXXXXXXXXXXREMOVEDXXXXXXXXXXXXXXX.
Second, enter 1000000000000000000000000000 in the ⑧“_value(uint256)” field.
Third, click on ⑨“Write” button to approve the full balance of your LINK tokens from your connected account. The MetaMask window will pop up again for you to confirm the approval. In this step, you can also adjust the transaction fee in order to make your transaction mine quicker or choose a more budget-friendly but slower approach to the execution of your upgrade process. Default values set by MetaMask are optimal in most cases. However, if you are keen to adjust them manually, please make sure to include reasonable amounts. If you’re not sure what the current gas prices are then we recommend checking ETHGasStation.
When the transaction is confirmed the upgrade is complete. Meanwhile, you may sell, trade and swap LINK tokens, this will not affect the upgrading process. That’s it, you’re all done!
Update via MyEtherWallet
1. Begin by navigating to www.myetherwallet.com, access your wallet via preferred method(will work with any MetaMask, Ledger, and Trezor account you have added to MyEtherWallet) and head to the ①“Contract” section to the left of your wallet interface and select ②“Interact with Contract”. Enter the current LINK contract address in the ③“Enter Contract Address” field, XXXXXXXXXXXREMOVEDXXXXXXXXXXXXXXX.
2. For the “ABI/JSON Interface” field, you need to head over to LINK smart contract ④“Code” tab on Etherscan.
Scroll down to “Contract ABI” section and click on ⑤“Copy ABI to clipboard” button, to the upper right of the ABI code.
Paste the contract ABI to ⑥“ABI/JSON Interface” on MyEtherWallet and proceed by clicking on the ⑦“Continue” button. Finally, should look like this:
3. Now you need to set an approval for the LINK proxy contract. Click on “Select an item” button next to the contract address and choose ⑧“approve” function.
First, enter the LINK proxy contract address in the ⑨“_spender(address):” field, _XXXXXXXXXXXREMOVEDXXXXXXXXXXXXXXX_.
Second, enter 1000000000000000000000000000 (value which represents the total amount of LINK tokens in existence right now) in the ⑩“_value(uint256):” field.
Note: “Value in ETH:” field must be left blank.
Third, click on ⑪“Write” button and confirm the approval.
When the transaction is confirmed the upgrade is complete. Meanwhile, you may sell, trade and swap LINK tokens, this will not affect the updating process. That’s it, you’re all done!
Update via Automated Script
ATTENTION: This process is recommended for an expert LINK holder, and only commonly used by other custodians with proper engineering teams and security protocols that have the relevant experience and knowledge.
Navigate and clone the update-script from the Chainlink Github repo.
Requirements for this process entail:
(a) Python 3.6+ installed.
(b) HTTP Ethereum endpoint that can receive requests (–rpcvhosts=* if local).
(c) Private key of Ethereum account stored as environment variable.
Proceed with running the setup and automatic update-script.
Steps for running the script:
pip install -e .
ETHEREUM_HTTP=[YOUR_ETHEREUM_HTTP_ENDPOINT] ETHEREUM_PRIVATE_KEY=[YOUR_PRIVATE_KEY] update
If you do not have a local Ethereum node running, you must specify one with the environment variable ETHEREUM_HTTP. That’s it, you’re all done!