Replies: 1 comment
-
While I don't immediately see a practical use case for this and I'd imagine most examples are rather theoretical, I don't see any downside to supporting this addition. One question: Is there a reason for converting pure integer values to strings? I guess you can use a RADON operator to convert those back, e.g., StringAsInteger if that still exists? I'd definitely say you don't want to pass integers converted to strings to a smart contract though. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Abstract
Data Requests in the Witnet blockchain currently support the aggregation of data extracted from any combination of HTTP-GET and HTTP-POST retrievals. This proposal specifies the support of HTTP-HEAD data retrievals, enabling data requests to extract metadata about pre-existing content on the Internet.
Motivation and rationale
While HTTP-GET and HTTP-POST data retrievals may cover the majority of use cases, other potential applications rather need to retrieve metadata from allegedly existing resource contents on the Internet, instead of relyng on calls to REST/API endpoints.
For instance, metadata like the existence, age, size, hash or the content type of some given URL, can be extracted by a single HTTP-HEAD retrieval, without actually forcing witnessing nodes to download the whole content that is being referred.
Specification
At the protocol level, these are the new fields in the protobuf schema:
enum RADType { Unknown = 0; HttpGet = 1; Rng = 2; HttpPost = 3; + HttpHead = 4; }
HTTP-HEAD
Optional
headers
fieldJust like HTTP-GET and HTTP-POST retrievals, this new retrieval type will also accept including request headers.
The
headers
field may contain a list of(key, value)
pairs, using theStringPair
helper message:These pairs will be used as additional headers for the underlying HTTP request. At the protocol level, they can be any string, but the RAD engine will validate them according to the HTTP specification, and resolve the retrieval source to a
RadonError
in case of error.Transaction weights
The weight of a HTTP-HEAD retrievals are calculated just the same as HTTP-GET ones:
The overhead refers to the serialization overhead of
StringPair
, in an attempt to make the weight match the serialized size as close as possible.HTTP-HEAD response format
Witnet nodes performing HTTP-HEAD retrieval will pass as input value to the corresponding Radon script a stringified JSON object containing one entry per response header as returned from the remote host.
For instance, whereas the HTTP-HEAD request to https://www.wikipedia.org/static/favicon/wikipedia.ico returns these lines:
The
RadonString
value passed as input to the Radon script would rather be encoded as:Beta Was this translation helpful? Give feedback.
All reactions