One of the main principles of Squid is to allow you to interact with the network without any intermediary. It is not ever a good idea to delegate your wallet or credentials to a third-party service when you are interacting with Smart Contracts. The use of Squid libraries directly in your application means always having your personal account under your control.

Squid was created in different languages, initially Python (squid-py) and JavaScript (squid-js), but a Java version is coming as well. If you want to build a front-end application to interact with Ocean, like a Marketplace, you can use squid-js directly to interact with the network. The users of this front-end application will have Squid running in their local browsers integrated with Metamask. You can take a look at Pleuston, a backend marketplace framework, to see how you could integrate squid-js in your front-end application.

In addition to this, if you are a data scientist or data engineer and you want to build your notebook or data services pipeline interacting with Ocean to get access to all the existing datasets, you can use squid-py. The Mantaray project is a reference resource for you to understand how squid-py can be used.

You can also find a lot of examples of how to use Squid in JavaScript or Python in our tuna project.

Here’s an example about how to register a new asset in Ocean using Squid-js:

const ddo = await ocean.registerAsset(metadata, publisherAddress)

Here’s an example of how to search assets between multiple assets metadata:

(async () => { const ocean = await Ocean.getInstance(config)

const assets = await ocean.searchAssetsByText(query)

Logger.log(`__result__${

JSON.stringify(

assets.map(asset => asset.id), null, 2)

}`) })()

In the Ocean network, there could be multiple independent instances of metadata providers (usually associated with Marketplaces). By having an Ocean Protocol Decentralized Identifier (DID), Squid is able to resolve the DID Document (DDO) of an asset between the multiple metadata providers. A DDO is an off-chain representation of asset’s information, including the metadata. By having the unique DID of an asset, you have the method to retrieve the DDO:

const ddo = await ocean.resolveDID(did)

Here’s how to purchase and get access to an asset: