Skip to main content

Remote Data Source Executor

The remote data source executor executes the various data sources stored on BandChain in order to retrieve data from the data providers. The executor itself is a function-as-a-Service hosted on a cloud service provider.

The goal of this design is to separate data source execution processes from processes related to the validator node itself. This separation of execution will be beneficial in cases where the data sources are not working correctly ( infinite loop, bad code execution, for example). In those cases, such separation can prevent validator nodes from overloading or crashing due to the error.

Also, from a validator's perspective, all they have to do to execute a data source is to send an executable file content in JSON format (the data source script), along with the relevant calldata, to an endpoint, thus minimizing the work they have to do themselves.

Resource

EndpointHTTP Request MethodDescription
/executePOSTExecutes the data source

Request

Request Headers

{
"content-type": "application/json"
}

Request Body

FieldTypeDescription
executablestring`Base64-encoded data source that the executor will execute
calldatastringBash-encoded input parameters of data source
timeoutnumberExecution time limit (in milliseconds)

Example

{
"executable": "IyEvYmluL3NoXG5cbnN5bWJvbD0kMVxuXG4jIENyeXB0b2N1cnJlbmN5IHByaWNlIGVuZHBvaW50OiBodHRwczovL3d3dy5jb2luZ2Vja28uY29tL2FwaS9kb2N1bWVudGF0aW9ucy92M1xudXJsPVwiaHR0cHM6Ly9hcGkuY29pbmdlY2tvLmNvbS9hcGkvdjMvc2ltcGxlL3ByaWNlP2lkcz0kc3ltYm9sJnZzX2N1cnJlbmNpZXM9dXNkXCJcblxuIyBQZXJmb3JtcyBkYXRhIGZldGNoaW5nIGFuZCBwYXJzZXMgdGhlIHJlc3VsdFxuY3VybCAtcyAtWCBHRVQgJHVybCAtSCBcImFjY2VwdDogYXBwbGljYXRpb24vanNvblwiIHwganEgLWVyIFwiLltcXFwiJHN5bWJvbFxcXCJdLnVzZFwiXG4=",
"calldata": "bitcoin",
"timeout": 1000
}

Response

Response Headers

{
"content-type": "application/json",
"access-control-allow-methods": "OPTIONS, POST"
}

Response Body

FieldTypeDescription
returncodenumberExit code (0-255)
stdoutstringData source output
stderrstringData source error output
errorstring"" or error message from executor

Response Codes

200 OK
Exit codeDescriptionError Message
0 - 255Executable errors from data source run successfullyN/A
111Execution timeoutExecution time limit exceeded
112Stdout exceedStdout exceeded max size
113Stderr exceedStderr exceeded max size
126Execution failExecution fail
400 Bad Request
ErrorError message
Missing executable valueexecutable field is missing from JSON request
Executable value exceedexecutable value exceed max size
Missing calldata valuecalldata field is missing from JSON request
Calldata value exceedcalldata exceeded max size
Missing timeout valuetimeout field is missing from JSON request
Invalid timeout formattimeout type is invalid
Runtime value exceedRuntime exceeded max size