<p>Unfortunately, there is no way to make http calls from on-chain.</p>
<p>The only way to have off-chain information available on-chain is via transactions. Either the caller of the smart contract can bring the information with their transaction or the smart contract can reference data put on chain with previous transactions.</p>
<p>I'm guessing the latter is what you're looking for, what we call an &quot;oracle&quot;. The data can be made available on the datum of some output (or &quot;reference output&quot;) at another script address. You can make the updating of that data locked and only accessible by the &quot;trusted&quot; party's public key with a separate contract. Your smart contract can then reference the output that has the data on it.</p>
<p>There are additional ways you can customize this relationship, but that would be straying from your original question.</p>
<p>I hope that helps.</p>

CC BY-SA 4.0
2023-12-01T22:18:55.610Z
2023-12-01T22:18:55.610Z
Mitchell Turner
<p>I am trying to build a smart contract that will need to rely on off-chain information from a trusted server in order to gather to the state of something which will impact on how the UTXO should be spent.</p>
<p>what is a strategy that i can use in order to have the on chain script make an some sort of http request to a trusted api server in order to get the status of something which can branch the decision of the on chain logic?</p>
<p>thanks for any suggestions.</p>

<smart-contract><oracles><trust><independent-service-providers>
How to build smart contract depending on trusted server for additional information
# How to build smart contract depending on trusted server for additional information

(Asked by: username_0 on 2023-12-01)

I am trying to build a smart contract that will need to rely on off-chain information from a trusted server in order to gather to the state of something which will impact on how the UTXO should be spent.

what is a strategy that i can use in order to have the on chain script make an some sort of http request to a trusted api server in order to get the status of something which can branch the decision of the on chain logic?

thanks for any suggestions.

**Tags:** smart-contract, oracles, trust, independent-service-providers

---

## 1 answers

### Answer by username_1 on 2023-12-01. Score: 1 | Accepted answer

Unfortunately, there is no way to make http calls from on-chain.

The only way to have off-chain information available on-chain is via transactions. Either the caller of the smart contract can bring the information with their transaction or the smart contract can reference data put on chain with previous transactions.

I'm guessing the latter is what you're looking for, what we call an "oracle". The data can be made available on the datum of some output (or "reference output") at another script address. You can make the updating of that data locked and only accessible by the "trusted" party's public key with a separate contract. Your smart contract can then reference the output that has the data on it.

There are additional ways you can customize this relationship, but that would be straying from your original question.

I hope that helps.


---

