Submit data to Avail DA
LOOKING FOR INSTRUCTIONS ON HOW TO RUN YOUR OWN LIGHT CLIENT?
You can check out our docs here for instructions on how to run your own light client.
Note:
Light client must be running in app-modeto retrieve data. Click here for instructions on how to run an Avail Light Client in app-mode.
Submits application data to the avail network
In case of data transaction, data transaction is created, signed and submitted.
In case of extrinsic, externally created and signed transaction is submitted.
Only one field is allowed per request.
Both data and extrinsic has to be encoded using base64 encoding.
Params:
base64encoded data or extrinsic
HOW TO SUBMIT DATA USING THE LIGHT CLIENT?
-
To use this method you need to run your Light Client in the
app-clientmode. You can then submit data directly to theappIDyou configured while booting up the Light Client. -
You can only pass
Base64encoded data to be submitted via the Light Client. You can use this website to encode & decode your data into the required formats.
Response:
- block_number - block number where transaction is included
- block_hash - block hash where transaction is included
- hash - transaction hash
- index - transaction index in the block
CURL
curl -XPOST 127.0.0.1:7007/v2/submit --header "Content-Type: application/json" --data '{"data":"dGVzdAo="}' Sample Response:
{
"block_number": {block-number},
"block_hash": "{block-hash}",
"hash": "{transaction-hash}",
"index": {transaction-index}
}If app mode is not active (or signing key is not configured and data is submitted) response is:
Not found