returns ddo state
name | type | required | description |
---|---|---|---|
did | object | document id or did | |
chainId | object | chain id of network on which document is provided | |
nft | object | one or more field names that should be queried against |
123
returns search result for query
name | type | required | description |
---|---|---|---|
q | object | v | text to search for in database |
query_by | object | v | one or more field names that should be queried against |
{
"q": "0x123",
"query_by": "nftAddress"
}
[{
"facet_counts": [],
"found": 1,
"out_of": 1,
"page": 1,
"request_params": {
"collection_name": "ddo",
"per_page": 10,
"q": "0x123"
},
"search_time_ms": 1,
"hits": [
{
"highlights": [
{
"field": "nftAddress",
"snippet": "<mark>0x123</mark>",
"matched_tokens": ["0x123"]
}
],
"document": {
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
},
"text_match": 130916
}
]
}]
returns metadata of document by id
{
"created": "2020-11-15T12:27:48Z",
"updated": "2021-05-17T21:58:02Z",
"description": "Sample description",
"name": "Sample asset",
"type": "dataset",
"author": "OPF",
"license": "https://market.oceanprotocol.com/terms"
}
returns document by id
{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns stored nonce for an address
name | type | required | description |
---|---|---|---|
userAddress | string | v | address |
123
returns amount of tokens to transfer to the provider account
name | type | required | description |
---|---|---|---|
documentId | string | v | document id or did |
serviceId | string | v | id of the service the datatoken is attached to |
consumerAddress | string | v | consumer address |
{
"datatoken": "0x123",
"nonce": "123",
"providerFee": {
providerFeeAddress: "0x123",
providerFeeToken: "0x123",
providerFeeAmount: 123,
providerData: "0x123",
v: 123,
r: "0x123",
s: "0x123",
validUntil: 123
}
}
returns encrypted blob
string
0x123
returns decrypted document
name | type | required | description |
---|---|---|---|
decrypterAddress | string | v | decrypter address |
chainId | number | v | chain id of network on which document is provided |
transactionId | string | tx id of encrypted document | |
dataNftAddress | string | address of nft token | |
encryptedDocument | string | encrypted document | |
flags | number | metadata flags if DDO is ECIES encrypted or lzma compressed | |
documentHash | string | hash based on sha256 of asset | |
nonce | string | v | is required to verify a request paired with a signature |
signature | string | v | signed message based on transactionId + dataNftAddress + decrypterAddress + chainId + nonce |
{
"decrypterAddress": "0x123",
"chainId": 123,
"transactionId": "0x123",
"dataNftAddress": "0x123",
"encryptedDocument": "0x123",
"flags": 1,
"documentHash": "0x123",
"nonce": "123",
"signature": "0x123"
}
{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns file information
name | type | required | description |
---|---|---|---|
type | string | type of storage url or arweave or ipfs |
|
did | string | document id or did | |
serviceId | number | service id of services list | |
fileIndex | number | file index in files array | |
file | object | file data | |
checksum | number | index in transaction events list |
{
"type": "123",
"did": "did:op:123",
"serviceId": 123,
"fileIndex": 123,
"file": 123,
"checksum": 123
}
[
{
valid: true
contentLength: "123"
contentType: "123"
name: "123"
type: "url or arweave or ipfs"
}
]
returns a file stream of the requested file
name | type | required | description |
---|---|---|---|
fileIndex | number | v | file index in the list of document files |
documentId | string | v | document id or did |
serviceId | string | v | service id of array of services defining access to the asset |
transferTxId | string | v | tx id of transaction for approval of datatokens transfer given to the provider's account |
nonce | string | v | is required to verify a request paired with a signature |
consumerAddress | string | v | consumer address |
signature | string | v | signed message based on did + nonce |
aes_encrypted_key | string | encrypted key for cipher to decrypt file |
byte array
returns log by id
{
"timestamp": "123",
"level": "123",
"message": "123",
"moduleName": "123",
"meta": "123",
}
returns list of logs
name | type | required | description |
---|---|---|---|
startTime | string | filter logs from date | |
endTime | string | filter logs to date | |
maxLogs | string | logs per page | |
moduleName | string | filter logs by module name | |
level | string | filter logs by level |
[
{
"id": "123",
"timestamp": "123",
"level": "123",
"message": "123",
"moduleName": "123",
"meta": "123",
}
]
returns empty if advertising did around peers was successful
name | type | required | description |
---|---|---|---|
did | string | v | document id or did |
returns P2P peer
name | type | required | description |
---|---|---|---|
peerId | string | v | peer id |
{
"id": "PeerId",
"addresses": [{ multiaddr: "123", isCertified: true }],
"protocols": ["123", "123", "123"],
"metadata": {},
"tags": {},
"publicKey": "0x123"
}
returns P2P peer multiaddresses if found in DHT
name | type | required | description |
---|---|---|---|
peerId | string | v | peer id |
timeout | int | optional | timeout |
{
"id": "16Uiu2HAmLhRDqfufZiQnxvQs2XHhd6hwkLSPfjAQg1gH8wgRixiP",
"multiaddrs": [
"/ip4/127.0.0.1/tcp/9000",
"/ip4/127.0.0.1/tcp/9001/ws",
"/ip4/172.18.0.2/tcp/9000",
"/ip4/172.18.0.2/tcp/9001/ws",
"/ip6/::1/tcp/9002"
]
}
returns list of all P2P peers
[
{
"id": "PeerId",
"addresses": [{ multiaddr: "123", isCertified: true }],
"protocols": ["123", "123", "123"],
"metadata": {},
"tags": {}
}
]
returns an empty object if it is valid otherwise an array with error
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
multiAddrs | string[] | if passed, use this instead of peerStore & DHT | |
id | string | v | document id or did |
chainId | number | v | chain id of network on which document is provided |
nftAddress | string | v | address of nft token |
{
"command": "validateDDO",
"node": "PeerId",
"id": "did:op:123",
"chainId": 123,
"nftAddress": "0x123"
}
returns file information
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
type | string | type of storage url or arweave or ipfs |
|
did | string | document id or did | |
serviceId | number | service id of services list | |
fileIndex | number | file index in files array | |
file | object | file data | |
checksum | number | index in transaction events list |
{
"command": "fileInfo",
"node": "PeerId",
"type": "123",
"did": "did:op:123",
"serviceId": 123,
"fileIndex": 123,
"file": 123,
"checksum": 123
}
[
{
valid: true
contentLength: "123"
contentType: "123"
name: "123"
type: "url or arweave or ipfs"
}
]
returns a message about successful addition to the reindexing queue
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
txId | string | v | id of transaction for reindexing |
chainId | number | v | chain id of network on which transaction is provided |
eventIndex | number | index in transaction events list |
{
"command": "reIndex",
"node": "PeerId",
"txId": "0x123",
"chainId": 123,
"eventIndex": 123
}
Added to reindex queue successfully
returns calculated provider fees for DDO with service id
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
ddo | object | v | document object |
serviceId | string | v | service id of services list |
{
"command": "getFees",
"node": "PeerId",
"ddo": {
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
"...": "..."
},
"serviceId": "123"
}
[
{
providerFeeAddress: "0x123",
providerFeeToken: "0x123",
providerFeeAmount: 123,
providerData: "0x123",
v: 123,
r: "0x123",
s: "0x123",
validUntil: 123,
}
]
returns list of providers from which ddo can be obtained
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
id | string | v | document id or did |
{
"command": "findDDO",
"node": "PeerId",
"id": "did:op:123"
}
[
{
provider: "PeerId",
id: "did:op:123"
lastUpdateTx: "123",
lastUpdateTime: "123",
}
]
returns status of node
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node |
{
"command": "status",
"node": "PeerId"
}
{
"id": "PeerId",
"publicKey": "0x123",
"address": "0x123",
"version": "123",
"http": true,
"p2p": true,
"provider": [],
"indexer": [],
"supportedStorage": {
"ipfs": true
"arwave": true
"url": true
},
"uptime": 123,
"platform": {
"cpus": "123",
"freemem": 123,
"totalmem": 123,
"loadavg": [123],
"arch": "123",
"machine": "123",
"platform": "123",
"release": "123",
"osType": "123",
"osVersion": "123",
"node": "123"
}
}
returns search result for query
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
query | object | v | query parameters |
query.q | object | v | text to search for in database |
query.query_by | object | v | one or more field names that should be queried against |
{
"command": "query",
"node": "PeerId",
"query": {
"q": "0x123",
"query_by": "nftAddress"
}
}
[{
"facet_counts": [],
"found": 1,
"out_of": 1,
"page": 1,
"request_params": {
"collection_name": "ddo",
"per_page": 10,
"q": "0x123"
},
"search_time_ms": 1,
"hits": [
{
"highlights": [
{
"field": "nftAddress",
"snippet": "<mark>0x123</mark>",
"matched_tokens": ["0x123"]
}
],
"document": {
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
},
"text_match": 130916
}
]
}]
returns document by id
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
id | string | v | document id or did |
{
"command": "getDDO",
"node": "PeerId",
"id": "did:op:123"
}
{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns encrypted blob
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
blob | string | v | blob data |
encoding | string | v | data encoding string or base58 |
encryptionType | string | v | encrypt method AES or ECIES |
{
"command": "encrypt",
"node": "PeerId",
"blob": "123",
"encoding": "0x123",
"encryptionType": "0x123"
}
0x123
returns stored nonce for an address
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
address | string | v | consumer address |
{
"command": "nonce",
"node": "PeerId",
"address": "0x123"
}
123
returns decrypted document
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
decrypterAddress | string | v | decrypter address |
chainId | number | v | chain id of network on which document is provided |
transactionId | string | tx id of encrypted document | |
dataNftAddress | string | address of nft token | |
encryptedDocument | string | encrypted document | |
flags | number | metadata flags if DDO is ECIES encrypted or lzma compressed | |
documentHash | string | hash based on sha256 of asset | |
nonce | string | v | is required to verify a request paired with a signature |
signature | string | v | signed message based on transactionId + dataNftAddress + decrypterAddress + chainId + nonce |
{
"command": "decryptDDO",
"node": "PeerId",
"decrypterAddress": "0x123",
"chainId": 123,
"transactionId": "0x123",
"dataNftAddress": "0x123",
"encryptedDocument": "0x123",
"flags": 1,
"documentHash": "0x123",
"nonce": "123",
"signature": "0x123"
}
{
"@context": ["https://w3id.org/did/v1"],
"id": "did:op:ACce67694eD2848dd683c651Dab7Af823b7dd123",
"version": "4.1.0",
"chainId": 1,
"nftAddress": "0x123",
...
}
returns a file stream of the requested file
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
fileIndex | number | v | file index in the list of document files |
documentId | string | v | document id or did |
serviceId | string | v | service id of array of services defining access to the asset |
transferTxId | string | v | tx id of transaction for approval of datatokens transfer given to the provider's account |
nonce | string | v | is required to verify a request paired with a signature |
consumerAddress | string | v | consumer address |
signature | string | v | signed message based on did + nonce |
aes_encrypted_key | string | encrypted key for cipher to decrypt file |
{
"command": "download",
"node": "PeerId",
"fileIndex": 0,
"documentId": "did:op:123",
"serviceId": "0",
"transferTxId": "0x123",
"nonce": "123",
"consumerAddress": "0x123",
"signature": "0x123",
"aes_encrypted_key": "0x123"
}
byte array
returns the current indexing queue, as an array of objects
{
queue: []
}
Forwards request to PolicyServer (if any)
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
policyServerPassthrough | any | command and params for PolicyServer (see docs) |
{
"policyServerPassthrough": {
"action": "newDDO",
"rawDDO": {},
"chainId": 1,
"txId": "0x123",
"eventRaw": "raw event data"
}
}
{
"command": "PolicyServerPassthrough",
"node": "PeerId",
"policyServerPassthrough": {
"action": "newDDO",
"rawDDO": {},
"chainId": 1,
"txId": "0x123",
"eventRaw": "raw event data"
}
}
For starters, you can find a list of algorithms in the Ocean Algorithms repository and the docker images in the Algo Dockerhub.
The ComputeAsset
interface defines the structure of a compute asset in the Ocean Node. It can include information about the file object, document ID, service ID, transfer transaction ID, and user data.
- fileObject: Optional. An object of type
BaseFileObject
representing the file associated with the compute asset. - documentId: Optional. A string representing the document ID of the compute asset.
- serviceId: Optional. A string representing the service ID associated with the compute asset.
- transferTxId: Optional. A string representing the transaction ID for the transfer of the compute asset.
- userdata: Optional. An object containing additional user-defined data related to the compute asset.
export interface ComputeAsset {
fileObject?: BaseFileObject
documentId?: string
serviceId?: string
transferTxId?: string
userdata?: { [key: string]: any }
}
This interface is used to encapsulate the details of a compute asset, which can be utilized in various compute-related operations within the Ocean Node.
The ComputeAlgorithm
interface defines the structure of a compute algorithm in the Ocean Node.
It can include information about the file object, document ID, service ID, transfer transaction ID, algorithm custom data, metadata and user data.
- documentId: Optional. A string representing the document ID of the compute algorithm.
- serviceId: Optional. A string representing the service ID associated with the compute algorithm.
- fileObject: Optional. An object of type
BaseFileObject
representing the file associated with the compute algorithm. - meta: Optional. An object of type
MetadataAlgorithm
containing metadata related to the compute algorithm. - transferTxId: Optional. A string representing the transaction ID for the transfer of the compute algorithm.
- algocustomdata: Optional. An object containing additional custom data related to the compute algorithm.
- userdata: Optional. An object containing additional user-defined data related to the compute algorithm.
export interface ComputeAlgorithm {
documentId?: string
serviceId?: string
fileObject?: BaseFileObject
meta?: MetadataAlgorithm
transferTxId?: string
algocustomdata?: { [key: string]: any }
userdata?: { [key: string]: any }
}
This interface is used to encapsulate the details of a compute algorithm, which can be utilized in various compute-related operations within the Ocean Node.
fetch all compute environments
[
{
"id": "0x7d187e4c751367be694497ead35e2937ece3c7f3b325dcb4f7571e5972d092bd-0xf173fdc0a9c7cc1c34f8aaf6b3aafe866795851b567436e1d4fbab17b0e26ca1",
"runningJobs": 0,
"consumerAddress": "0xf9C5B7eE7708efAc6dC6Bc7d4b0455eBbf22b519",
"platform": { "architecture": "x86_64", "os": "Ubuntu 22.04.3 LTS" },
"fees": { "1": [[{ "feeToken": "0x123", "prices": [{ "id": "cpu", "price": 1 }] }]] },
"storageExpiry": 604800,
"maxJobDuration": 3600,
"resources": [
{ "id": "cpu", "total": 16, "max": 16, "min": 1, "inUse": 0 },
{
"id": "ram",
"total": 33617674240,
"max": 33617674240,
"min": 1000000000,
"inUse": 0
},
{ "id": "disk", "total": 1000000000, "max": 1000000000, "min": 0, "inUse": 0 }
],
"free": {
"maxJobDuration": 60,
"maxJobs": 3,
"resources": [
{ "id": "cpu", "max": 1, "inUse": 0 },
{ "id": "ram", "max": 1000000000, "inUse": 0 },
{ "id": "disk", "max": 1000000000, "inUse": 0 }
]
},
"runningfreeJobs": 0
}
]
starts a free compute job and returns jobId if succesfull
name | type | required | description |
---|---|---|---|
command | string | v | command name |
node | string | if not present it means current node | |
consumerAddress | string | v | consumer address |
signature | string | v | signature (msg=String(nonce) ) |
nonce | string | v | nonce for the request |
datasets | object | list of ComputeAsset to be used as inputs | |
algorithm | object | ComputeAlgorithm definition | |
environment | string | v | compute environment to use |
resources | object | optional list of required resources |
{
"command": "freeStartCompute",
"datasets": [],
"algorithm": {
"meta": { "container": { "image": "ubuntu", "entrypoint": "/bin/bash'" } }
},
"consumerAddress": "0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687",
"signature": "123",
"nonce": 1,
"environment": "0x7d187e4c751367be694497ead35e2937ece3c7f3b325dcb4f7571e5972d092bd-0xbeaf12703d708f39ef98c3d8939ce458553254176dbb69fe83d535883c4cee38",
"resources": [{ "id": "cpu", "amount": 1 }]
}
[
{
"owner": "0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687",
"jobId": "0x7d187e4c751367be694497ead35e2937ece3c7f3b325dcb4f7571e5972d092bd-a4ad237d-dfd8-404c-a5d6-b8fc3a1f66d3",
"dateCreated": "1742291065.119",
"dateFinished": null,
"status": 0,
"statusText": "Job started",
"results": [],
"agreementId": null,
"expireTimestamp": 1742291065.119,
"environment": "0x7d187e4c751367be694497ead35e2937ece3c7f3b325dcb4f7571e5972d092bd-0xf173fdc0a9c7cc1c34f8aaf6b3aafe866795851b567436e1d4fbab17b0e26ca1",
"resources": [
{ "id": "cpu", "amount": 1 },
{ "id": "ram", "amount": 1000000000 },
{ "id": "disk", "amount": 0 }
],
"isFree": true
}
]
returns job status
Required at least one of the following parameters:
name | type | required | description |
---|---|---|---|
consumerAddress | string | consumer address to use as filter | |
jobId | string | jobId address to use as filter | |
agreementId | string | agreementId address to use as filter |
[
{
"owner": "0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687",
"did": null,
"jobId": "a4ad237d-dfd8-404c-a5d6-b8fc3a1f66d3",
"dateCreated": "1742291065.119",
"dateFinished": null,
"status": 0,
"statusText": "Job started",
"results": [],
"inputDID": null,
"algoDID": null,
"agreementId": null,
"expireTimestamp": 1742291065.119,
"environment": "0x7d187e4c751367be694497ead35e2937ece3c7f3b325dcb4f7571e5972d092bd-0xf173fdc0a9c7cc1c34f8aaf6b3aafe866795851b567436e1d4fbab17b0e26ca1",
"resources": [
{
"id": "cpu",
"amount": 1
},
{
"id": "ram",
"amount": 1000000000
},
{
"id": "disk",
"amount": 1000000000
}
],
"isFree": true
}
]
returns job result
name | type | required | description |
---|---|---|---|
consumerAddress | string | v | consumer address to use as filter |
jobId | string | v | jobId address to use as filter |
signature | string | v | signature (consumerAddress + jobId + index.toString() + nonce) |
nonce | string | v | nonce for the request |
index | number | v | index of result (0 for main result, 1 for logs) |
File content