In a few days, canisters (applications running on chain on the #IC) will be able to make HTTPS requests to any external web endpoint. It will be the first ever blockchain to allow that, and will remove the need for external oracles. Here’s how it works: 🧵 1/7
2/7 A canister issue a http_request by calling an API function and specifying the method, target URL, headers, body, and a “transform” function. We’ll get to that function later.
3/7 The request goes into the certified state of the blockchain and then, each node on the corresponding subnet actually makes that request on behalf of the canister. So yes, the request is made multiple times (as of now on app subnets there are 13 nodes, so at most 13 times).
4/7 For GET requests this shouldn’t be a problem as they are not supposed to change state on the remote server, but for POST requests the remote server needs to be able to handle idempotent requests. So this may not suit every use case, but we believe it is still useful for many.
5/7 The request goes out and responses come back to the different nodes. Now they need to reach consensus on the content of the response. This might be tricky, as responses may differ slightly, even for identical requests. For example, they may contain different timestamps.
6/7 Here’s where the “transform” function comes to play: each node applies it separately on the response it got, and then signs the result of that function. Once a block maker has enough signature shares for exactly the same transformed response, it includes it in the next block.
7/7 When a transformed response is included in a block it is delivered back to the calling canister via a callback.
• • •
Missing some Tweet in this thread? You can try to
force a refresh