1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

GITBOOK-444: change request with no subject merged in GitBook

This commit is contained in:
Christian Casazza 2023-06-07 14:01:34 +00:00 committed by gitbook-bot
parent 4637f36673
commit f9d2fb4371
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
3 changed files with 223 additions and 178 deletions

View File

@ -7,13 +7,13 @@ coverY: 0
The world runs on data. From social media to shopping online to healthcare to financial planning, data drives our interactions in the world. Access to greater amounts of data can create a flywheel of value creation; better data leads to better insights which leads to greater profits. 
Unfortunately, today's data infrastructure is broken. Data lives in silos unable to interact with each other. Sharing data is difficult due to the difficulty of managing a hodgepodge of different methods for ownership and access control across many different service providers and applications. Data privacy problems also loom over data sharing; once it is duplicated, the owner loses control over their assets. 
Ocean Protocol was created to build a better system for how we manage and share our data assets. It repurposes the standards created within crypto and DeFi to facilitate a new paradigm of _self-custodial_ ownership and access control of our data assets. NFTs become a permissionless standard of ownership, ERC20s act as a permissionless standard for flexible access control rights, crypto wallets like metamask become a self-custodial holder of our assets. 
Ocean Protocol was built to democratize the free flow of data. It repurposes the standards created within crypto and DeFi to facilitate a new paradigm of _self-custodial_ ownership and access control of our data assets. NFTs become a permissionless standard of ownership, ERC20s act as a permissionless standard for flexible access control rights, crypto wallets like metamask become a self-custodial holder of our assets. 
Ocean's Compute-to-Data engine resolves the trade-off between the benefits of open data and data privacy risks. Using the engine, algorithms can be run on 
Ocean's [Compute-to-Data](../developers/compute-to-data/) engine resolves the trade-off between the benefits of open data and data privacy risks. Using the engine, algorithms can be run on data without exposing the underlying data. Now, data can be widely shared to contribute to the worlds shared knowledge while also respecting indivudals right to privacy.

View File

@ -1,2 +1,221 @@
---
description: Technical details about OceanAssets functions
---
# Ocean Assets
Through this class we can publish assets & consume them to make 💲💲💲
### Creates URL Asset
* **create\_url\_asset**(`self`, `name: str`, `url: str`, `publisher_wallet`, `wait_for_aqua: bool = True` ) -> `tuple`
It is the most used functions in all the READMEs.
Creates asset of type "dataset", having `UrlFiles`, with good defaults.
It can be called after instantiating Ocean object.
**Parameters**
* `name` - name of the asset, `string`
* `url` - url that is stored in the asset, `string`
* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
**Returns**
`tuple`
A tuple which contains the data NFT, datatoken and the data asset.
**Defined in**
[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL178C1-L185C82)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %}
```python
@enforce_types
def create_url_asset(
self, name: str, url: str, publisher_wallet, wait_for_aqua: bool = True
) -> tuple:
"""Create asset of type "data", having UrlFiles, with good defaults"""
metadata = self._default_metadata(name, publisher_wallet)
files = [UrlFile(url)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>
### Creates Algorithm Asset
* **create\_algo\_asset**(`self`, `name: str`, `url: str`, `publisher_wallet`, `image: str = "oceanprotocol/algo_dockers"`, `tag: str = "python-branin"`, `checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4"`, `wait_for_aqua: bool = True`) -> `tuple`:
Create asset of type "algorithm", having `UrlFiles`, with good defaults.
It can be called after instantiating Ocean object.
**Parameters**:
* `name` - name of the asset, `string`
* `url` - url that is stored in the asset, `string`
* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
* `image` - docker image of that algorithm, `string`
* `tag` - docker tag for that algorithm image, `string`
* `checksum` - docker checksum for algorithm's image, `string`
* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
**Returns**
`tuple`
A tuple which contains the algorithm NFT, algorithm datatoken and the algorithm asset.
**Defined in**
[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL146C4-L176C82)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %}
```python
@enforce_types
def create_algo_asset(
self,
name: str,
url: str,
publisher_wallet,
image: str = "oceanprotocol/algo_dockers",
tag: str = "python-branin",
checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4",
wait_for_aqua: bool = True,
) -> tuple:
"""Create asset of type "algorithm", having UrlFiles, with good defaults"""
if image == "oceanprotocol/algo_dockers" or tag == "python-branin":
assert image == "oceanprotocol/algo_dockers" and tag == "python-branin"
metadata = self._default_metadata(name, publisher_wallet, "algorithm")
metadata["algorithm"] = {
"language": "python",
"format": "docker-image",
"version": "0.1",
"container": {
"entrypoint": "python $ALGO",
"image": image,
"tag": tag,
"checksum": checksum,
},
}
files = [UrlFile(url)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>
### Creates Arweave Asset
* **create\_arweave\_asset**(`self`, `name: str`, `transaction_id: str`, `publisher_wallet`, `wait_for_aqua: bool = True`) -> `tuple`
Creates asset of type "data", having `ArweaveFile`, with good defaults.
It can be called after instantiating Ocean object.
**Parameters**
* `name` - name of the asset, `string`
* `transaction_id` - transaction id from the arweave file, `string`
* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
**Returns**
`tuple`
A tuple which contains the data NFT, datatoken and the data asset.
**Defined in**
[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL187C5-L198C82)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %}
```python
@enforce_types
def create_arweave_asset(
self,
name: str,
transaction_id: str,
publisher_wallet,
wait_for_aqua: bool = True,
) -> tuple:
"""Create asset of type "data", having ArweaveFiles, with good defaults"""
metadata = self._default_metadata(name, publisher_wallet)
files = [ArweaveFile(transaction_id)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>
### Creates GraphQL Asset
* **create\_graphql\_asset**(`self`, `name: str`, `url: str`, `query: str`, `publisher_wallet`, `wait_for_aqua: bool = True`) -> `tuple`
Creates asset of type "data", having `GraphqlQuery` files, with good defaults.
It can be called after instantiating Ocean object.
**Parameters**
* `name` - name of the asset, `string`
* `url` - url of subgraph that you are using, `string`
* `query` - GraphQL query, `string`
* `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
* `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
**Returns**
`tuple`
A tuple which contains the data NFT, datatoken and the data asset.
**Defined in**
[ocean/ocean\_assets.py](https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean\_lib/ocean/ocean\_assets.py#LL200C5-L212C82)
<details>
<summary>Source code</summary>
{% code overflow="wrap" %}
```python
@enforce_types
def create_graphql_asset(
self,
name: str,
url: str,
query: str,
publisher_wallet,
wait_for_aqua: bool = True,
) -> tuple:
"""Create asset of type "data", having GraphqlQuery files, w good defaults"""
metadata = self._default_metadata(name, publisher_wallet)
files = [GraphqlQuery(url, query)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>

View File

@ -525,181 +525,7 @@ A dictionary which contains the following keys (`providerFeeAddress`, `providerF
</details>
#### Ocean Assets
<details>
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean_lib/ocean/ocean_assets.py#LL178C1-L185C82"><code>ocean.assets.create_url_asset( self, name: str, url: str, publisher_wallet, wait_for_aqua: bool = True ) -> tuple</code></a></summary>
It is the most used functions in all the READMEs.
Creates asset of type "dataset", having `UrlFiles`, with good defaults.
It can be called after instantiating Ocean object.
Params:
1. `name` - name of the asset, `string`
2. `url` - url that is stored in the asset, `string`
3. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
4. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
Return:
A tuple which contains the data NFT, datatoken and the data asset.
{% code overflow="wrap" %}
```python
@enforce_types
def create_url_asset(
self, name: str, url: str, publisher_wallet, wait_for_aqua: bool = True
) -> tuple:
"""Create asset of type "data", having UrlFiles, with good defaults"""
metadata = self._default_metadata(name, publisher_wallet)
files = [UrlFile(url)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>
<details>
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean_lib/ocean/ocean_assets.py#LL146C4-L176C82"><code>ocean.assets.create_algo_asset( self, name: str, url: str, publisher_wallet, image: str = "oceanprotocol/algo_dockers", tag: str = "python-branin", checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4", wait_for_aqua: bool = True) -> tuple</code></a></summary>
Create asset of type "algorithm", having `UrlFiles`, with good defaults
It can be called after instantiating Ocean object.
Params:
1. `name` - name of the asset, `string`
2. `url` - url that is stored in the asset, `string`
3. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
4. `image` - docker image of that algorithm, `string`
5. `tag` - docker tag for that algorithm image, `string`
6. `checksum` - docker checksum for algorithm's image, `string`
7. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
Return:
A tuple which contains the algorithm NFT, algorithm datatoken and the algorithm asset.
{% code overflow="wrap" %}
```python
@enforce_types
def create_algo_asset(
self,
name: str,
url: str,
publisher_wallet,
image: str = "oceanprotocol/algo_dockers",
tag: str = "python-branin",
checksum: str = "sha256:8221d20c1c16491d7d56b9657ea09082c0ee4a8ab1a6621fa720da58b09580e4",
wait_for_aqua: bool = True,
) -> tuple:
"""Create asset of type "algorithm", having UrlFiles, with good defaults"""
if image == "oceanprotocol/algo_dockers" or tag == "python-branin":
assert image == "oceanprotocol/algo_dockers" and tag == "python-branin"
metadata = self._default_metadata(name, publisher_wallet, "algorithm")
metadata["algorithm"] = {
"language": "python",
"format": "docker-image",
"version": "0.1",
"container": {
"entrypoint": "python $ALGO",
"image": image,
"tag": tag,
"checksum": checksum,
},
}
files = [UrlFile(url)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>
<details>
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean_lib/ocean/ocean_assets.py#LL187C5-L198C82"><code>ocean.assets.create_arweave_asset( self, name: str, transaction_id: str, publisher_wallet, wait_for_aqua: bool = True) -> tuple</code></a></summary>
Creates asset of type "data", having `ArweaveFile`, with good defaults.
It can be called after instantiating Ocean object.
Params:
1. `name` - name of the asset, `string`
2. `transaction_id` - transaction id from the arweave file, `string`
3. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
4. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
Return:
A tuple which contains the data NFT, datatoken and the data asset.
{% code overflow="wrap" %}
```python
@enforce_types
def create_arweave_asset(
self,
name: str,
transaction_id: str,
publisher_wallet,
wait_for_aqua: bool = True,
) -> tuple:
"""Create asset of type "data", having ArweaveFiles, with good defaults"""
metadata = self._default_metadata(name, publisher_wallet)
files = [ArweaveFile(transaction_id)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>
<details>
<summary><a href="https://github.com/oceanprotocol/ocean.py/blob/4aa12afd8a933d64bc2ed68d1e5359d0b9ae62f9/ocean_lib/ocean/ocean_assets.py#LL200C5-L212C82"><code>ocean.assets.create_graphql_asset( self, name: str, url: str, query: str, publisher_wallet, wait_for_aqua: bool = True, ) -> tuple</code></a></summary>
Creates asset of type "data", having `GraphqlQuery` files, with good defaults.
It can be called after instantiating Ocean object.
Params:
1. `name` - name of the asset, `string`
2. `url` - url of subgraph that you are using, `string`
3. `query` - GraphQL query, `string`
4. `publisher_wallet` - wallet of the asset publisher/owner, `Brownie account`
5. `wait_for_aqua` - boolean value which default is `True`, waiting for aquarius to fetch the asset takes additional time, but if you want to be sure that your asset is indexed, keep the default value.
Return:
A tuple which contains the data NFT, datatoken and the data asset.
{% code overflow="wrap" %}
```python
@enforce_types
def create_graphql_asset(
self,
name: str,
url: str,
query: str,
publisher_wallet,
wait_for_aqua: bool = True,
) -> tuple:
"""Create asset of type "data", having GraphqlQuery files, w good defaults"""
metadata = self._default_metadata(name, publisher_wallet)
files = [GraphqlQuery(url, query)]
return self._create_1dt(metadata, files, publisher_wallet, wait_for_aqua)
```
{% endcode %}
</details>
### Ocean Assets
<details>