1

sorry if this is a newbie question, I'm new to solidity and smart contracts. I want to make an API call on my smart contract but from what I saw, I have to implement a Chainlink external adapter. Now, for security reasons, I want my API to only be able to answer requests coming from the smart contract and nothing else, but I have not found any resource teaching how to do that, is there a way I could implement this validation? Personally, I prefer programming it in Python, but I'm open to using any language.

1 Answer 1

2

You'd require to create a centralized oracle on your own. The smart contract needs to emit a particular event when it requires to fetch data. Your oracle backend can just be a simple server that keeps on listening to such events. When it receives this new event, it'll query the API and send the returned data to the smart contract via a function call in a new transaction. (Note: the server needs to have a private key for an address that holds ETH as it needs to send transactions to the blockchain)

As there's reliance on a central server here, so if it were to ever get down then the contract would lose its functionality.

I'll recommend you read the Oracle implementations of other projects to make yours more robust.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.