Search code examples
encryptionethereumsoliditychainlink

Can chainlink external adapters be made so they can only called by a specific smart contract?


I want to make an external adapter which can only be called by a specific function in a smart contract so that I can assure that the caller is an authorized address. Is anyone able to make a call to an external adapter or can I restrict it to a certain smart contract? If anyone is able to make a call, is there a way for me to ensure that the caller is from the smart contract?

What I am trying to do is to have a smart contract which can provide a decryption key for a file. Essentially, the smart contract would store a decryption key encrypted to the adapter's public key. Then, when an event in the smart contract occurs where someone should gain access to the file, the smart contract makes a call to the adapter. The adapter would then take the encrypted decryption key, decrypt it, and return the decryption key encrypted to the recipient's public key. The smart contract would then receive the decryption key encrypted to the recipient's public key and store this so that the recipient could use this to decrypt the file. Is something like this possible with an external adapter?


Solution

  • You can restrict the access by adding whitelisted requesters (authorized smart contract addresses) to the database of the Chainlink node that is picking up your requests and running the job calling your external adapter.

    We wrote a short guide on how to do this: https://github.com/Linkriver/Chainlink-node-whitelisting