From de59cd74d06270609c30c2bcfa2a265e4fb1f952 Mon Sep 17 00:00:00 2001 From: Veronica Manuel Date: Fri, 16 Jun 2023 12:34:22 +0000 Subject: [PATCH] GITBOOK-536: change request with no subject merged in GitBook --- SUMMARY.md | 1 + developers/list-datatoken-buyers.md | 131 +++++++++++++++++++ developers/subgraph/list-datatoken-buyers.md | 57 +------- discover/ocean-101.md | 26 ++-- 4 files changed, 147 insertions(+), 68 deletions(-) create mode 100644 developers/list-datatoken-buyers.md diff --git a/SUMMARY.md b/SUMMARY.md index 4c1c0927..16149aca 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -33,6 +33,7 @@ * [Claim Rewards Data Farming](user-guides/claim-ocean-rewards.md) * [Liquidity Pools \[deprecated\]](user-guides/remove-liquidity-pools.md) * [👨💻 Developers](developers/README.md) + * [Find datatoken/data NFT addresses & Chain ID](developers/list-datatoken-buyers.md) * [Architecture Overview](developers/architecture.md) * [Contracts](developers/contracts/README.md) * [Data NFTs](developers/contracts/data-nfts.md) diff --git a/developers/list-datatoken-buyers.md b/developers/list-datatoken-buyers.md new file mode 100644 index 00000000..27c3dde6 --- /dev/null +++ b/developers/list-datatoken-buyers.md @@ -0,0 +1,131 @@ +--- +description: >- + Use these steps to reveal the information contained within an asset's DID and + list the buyers of a datatoken +--- + +# List datatoken buyers + +## Step 1: Find the Network and Datatoken address + +### How to find the network and datatoken address from an Ocean Market link? + +If you are given an Ocean Market link, then the network and datatoken address for the asset is visible on the Ocean Market webpage. For example, given this asset's Ocean Market link: [https://odc.oceanprotocol.com/asset/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1](https://odc.oceanprotocol.com/asset/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1) the webpage shows that this asset is hosted on the Mumbai network, and one simply clicks the datatoken's hyperlink to reveal the datatoken's address as shown in the screenshot below: + +

See the Network and Datatoken Address for an Ocean Market asset by visiting the asset's Ocean Market page.

+ +#### More Detailed Info: + +You can access all the information for the Ocean Market asset also by **enabling Debug mode**. To do this, follow these steps: + +**Step 1** - Click the Settings button in the top right corner of the Ocean Market + +

Click the Settings button

+ +**Step 2** - Check the Activate Debug Mode box in the dropdown menu + +

Check 'Active Debug Mode'

+ +**Step 3** - Go to the page for the asset you would like to examine, and scroll through the DDO information to find the NFT address, datatoken address, chain ID, and other information. + +
+ +### How to find the network and datatoken address from a DID? + +If you know the DID:op but you don't know the source link, then you can use Ocean Aquarius to resolve the metadata for the DID:op to find the `chainId`+ `datatoken address` of the asset. Simply enter in your browser "[https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/](https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1)\" to fetch the metadata. + +For example, for the following DID:op: "did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1" the Ocean Aquarius URL can be modified to add the DID:op and resolve its metadata. Simply add "[https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/](https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1)" to the beginning of the DID:op and enter the link in your browser like this: [https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1](https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1) + +

The metadata printout for this DID:op with the network's Chain ID and datatoken address circled in red

+ +Here are the networks and their corresponding chain IDs: + +``` +"mumbai: 80001" +"polygon: 137" +"bsc: 56" +"energyweb: 246" +"moonriver: 1285" +"mainnet: 1" +"goerli: 5" +"polygonedge: 81001" +"gaiaxtestnet: 2021000" +"alfajores: 44787" +"gen-x-testnet: 100" +"filecointestnet: 3141" +"oasis_saphire_testnet: 23295" +"development: 8996" +``` + +\ +Step 2: Query the Subgraph to see all buyers of the datatoken +------------------------------------------------------------- + +Select the corresponding subgraph URL for the asset's network. Below are some of the popular subgraph URLs, to show you the subgraph URL format. + +``` +https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql? +https://v4.subgraph.polygon.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql? +https://v4.subgraph.bsc.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql? +https://v4.subgraph.moonriver.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql? +https://v4.subgraph.energyweb.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql? +https://v4.subgraph.goerli.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql? +https://v4.subgraph.mumbai.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql? +``` + +You can then use the following example Javascript query to list the buyers of the datatoken. + +Note, that you can also copy and paste the contents of the query function below to fetch the same info from the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). + +```runkit nodeVersion="18.x.x" +const axios = require('axios') + +const datatoken = "0xc22bfd40f81c4a28c809f80d05070b95a11829d9".toLowerCase() + +const query = `{ + token(id : "${datatoken}") { + id, + orders( + orderBy: createdTimestamp + orderDirection: desc + first: 1000 + ) { + id + consumer { + id + } + payer { + id + } + reuses { + id + } + block + createdTimestamp + amount + } + } +}` + +const network = "mumbai" +var config = { + method: 'post', + url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`, + headers: { "Content-Type": "application/json" }, + data: JSON.stringify({ "query": query }) +}; + +axios(config) + .then(function (response) { + const orders = response.data.data.token.orders + console.log(orders) + for (let order of orders) { + console.log('id:' + order.id + ' consumer: ' + order.consumer.id + ' payer: ' + order.payer.id) + } + console.log(response.data.data.token.orders) + }) + .catch(function (error) { + console.log(error); +}); + +``` diff --git a/developers/subgraph/list-datatoken-buyers.md b/developers/subgraph/list-datatoken-buyers.md index 27c3dde6..c6a1343e 100644 --- a/developers/subgraph/list-datatoken-buyers.md +++ b/developers/subgraph/list-datatoken-buyers.md @@ -1,65 +1,12 @@ --- description: >- Use these steps to reveal the information contained within an asset's DID and - list the buyers of a datatoken + list the buyers of a datatoken using the Subgraph --- # List datatoken buyers -## Step 1: Find the Network and Datatoken address - -### How to find the network and datatoken address from an Ocean Market link? - -If you are given an Ocean Market link, then the network and datatoken address for the asset is visible on the Ocean Market webpage. For example, given this asset's Ocean Market link: [https://odc.oceanprotocol.com/asset/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1](https://odc.oceanprotocol.com/asset/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1) the webpage shows that this asset is hosted on the Mumbai network, and one simply clicks the datatoken's hyperlink to reveal the datatoken's address as shown in the screenshot below: - -

See the Network and Datatoken Address for an Ocean Market asset by visiting the asset's Ocean Market page.

- -#### More Detailed Info: - -You can access all the information for the Ocean Market asset also by **enabling Debug mode**. To do this, follow these steps: - -**Step 1** - Click the Settings button in the top right corner of the Ocean Market - -

Click the Settings button

- -**Step 2** - Check the Activate Debug Mode box in the dropdown menu - -

Check 'Active Debug Mode'

- -**Step 3** - Go to the page for the asset you would like to examine, and scroll through the DDO information to find the NFT address, datatoken address, chain ID, and other information. - -
- -### How to find the network and datatoken address from a DID? - -If you know the DID:op but you don't know the source link, then you can use Ocean Aquarius to resolve the metadata for the DID:op to find the `chainId`+ `datatoken address` of the asset. Simply enter in your browser "[https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/](https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1)\" to fetch the metadata. - -For example, for the following DID:op: "did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1" the Ocean Aquarius URL can be modified to add the DID:op and resolve its metadata. Simply add "[https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/](https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1)" to the beginning of the DID:op and enter the link in your browser like this: [https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1](https://v4.aquarius.oceanprotocol.com/api/aquarius/assets/ddo/did:op:1b26eda361c6b6d307c8a139c4aaf36aa74411215c31b751cad42e59881f92c1) - -

The metadata printout for this DID:op with the network's Chain ID and datatoken address circled in red

- -Here are the networks and their corresponding chain IDs: - -``` -"mumbai: 80001" -"polygon: 137" -"bsc: 56" -"energyweb: 246" -"moonriver: 1285" -"mainnet: 1" -"goerli: 5" -"polygonedge: 81001" -"gaiaxtestnet: 2021000" -"alfajores: 44787" -"gen-x-testnet: 100" -"filecointestnet: 3141" -"oasis_saphire_testnet: 23295" -"development: 8996" -``` - -\ -Step 2: Query the Subgraph to see all buyers of the datatoken -------------------------------------------------------------- +## Query the Subgraph to see all buyers of a datatoken Select the corresponding subgraph URL for the asset's network. Below are some of the popular subgraph URLs, to show you the subgraph URL format. diff --git a/discover/ocean-101.md b/discover/ocean-101.md index 17e010fb..86d23af1 100644 --- a/discover/ocean-101.md +++ b/discover/ocean-101.md @@ -8,28 +8,28 @@ Ocean Protocol is a decentralized data exchange protocol that aims to unlock the Ocean Protocol is used for a variety of purposes, including: -1. Data Sharing: Ocean Protocol allows individuals and organizations to share data securely and privately, enabling data owners to monetize their data assets while maintaining control over their data. -2. Data Monetization: Data owners can monetize their data by offering it for sale or by providing data services through compute-to-data (C2D) capabilities. Data consumers can access and utilize data assets to train machine learning models, perform data analysis, and drive insights. -3. Decentralized Data Marketplaces: Ocean Protocol facilitates the creation of decentralized data marketplaces where data providers can list their data assets and data consumers can discover and access them. These marketplaces operate on a peer-to-peer basis, eliminating the need for intermediaries and providing more efficient and transparent data transactions. -4. AI Development: Ocean Protocol supports the development of AI models by providing access to diverse and high-quality datasets. Data scientists and AI developers can leverage these datasets to train and improve their models, leading to more accurate and robust AI systems. +1. **Data Sharing**: Ocean Protocol allows individuals and organizations to share data securely and privately, enabling data owners to monetize their data assets while maintaining control over their data. +2. **Data Monetization**: Data owners can monetize their data by offering it for sale or by providing data services through compute-to-data (C2D) capabilities. Data consumers can access and utilize data assets to train machine learning models, perform data analysis, and drive insights. +3. **Decentralized Data Marketplaces**: Ocean Protocol facilitates the creation of decentralized data marketplaces where data providers can list their data assets and data consumers can discover and access them. These marketplaces operate on a peer-to-peer basis, eliminating the need for intermediaries and providing more efficient and transparent data transactions. +4. **AI Development**: Ocean Protocol supports the development of AI models by providing access to diverse and high-quality datasets. Data scientists and AI developers can leverage these datasets to train and improve their models, leading to more accurate and robust AI systems. ## Why Does Ocean Exist? Ocean Protocol exists to address several challenges in the current data ecosystem: -1. Data Silos: Data is often locked within organizations and inaccessible to others. Ocean Protocol aims to break down these data silos and enable data sharing across different entities, fostering collaboration and innovation. -2. Lack of Privacy: Traditional data sharing methods often compromise privacy. Ocean Protocol incorporates privacy-preserving techniques, such as encryption and access control, to ensure that data owners maintain control over their data and only share it with authorized parties. -3. Limited Data Monetization: Many data owners struggle to monetize their data assets effectively. Ocean Protocol provides a platform for data owners to list their data assets and earn revenue by selling or offering data services, creating new opportunities for data monetization. -4. Intermediaries and Inefficiencies: The current data economy rely on intermediaries, which introduce additional costs and complexities. Ocean Protocol eliminates intermediaries by leveraging blockchain technology and smart contracts, enabling direct peer-to-peer transactions and reducing friction in data exchange. +1. **Data Silos**: Data is often locked within organizations and inaccessible to others. Ocean Protocol aims to break down these data silos and enable data sharing across different entities, fostering collaboration and innovation. +2. **Lack of Privacy**: Traditional data sharing methods often compromise privacy. Ocean Protocol incorporates privacy-preserving techniques, such as encryption and access control, to ensure that data owners maintain control over their data and only share it with authorized parties. +3. **Limited Data Monetization**: Many data owners struggle to monetize their data assets effectively. Ocean Protocol provides a platform for data owners to list their data assets and earn revenue by selling or offering data services, creating new opportunities for data monetization. +4. **Intermediaries and Inefficiencies**: The current data economy rely on intermediaries, which introduce additional costs and complexities. Ocean Protocol eliminates intermediaries by leveraging blockchain technology and smart contracts, enabling direct peer-to-peer transactions and reducing friction in data exchange. ## How Does Ocean Work? Ocean Protocol utilizes a combination of blockchain technology, decentralized networks, and cryptographic techniques to facilitate secure and privacy-preserving data sharing. Here's an overview of how Ocean works: -1. Asset Registration: Data providers register their data assets on the Ocean blockchain, providing metadata that describes the asset, its usage terms, and pricing information. This metadata is stored on-chain and can be accessed by potential data consumers. -2. Discovery and Access Control: Data consumers can discover available data assets through decentralized metadata services like Aquarius. Access control mechanisms, such as smart contracts, verify the consumer's permissions and handle the transfer of data access tokens. -3. Secure Data Exchange: When a data consumer purchases access to a data asset, the asset's metadata and access instructions are encrypted by the data provider using the Provider service. The encrypted asset is then securely transferred to the consumer, who can decrypt and utilize it without revealing the asset's URL. -4. Compute-to-Data (C2D): Ocean Protocol supports C2D capabilities, allowing data consumers to perform computations on data assets without direct access to the underlying data. The compute operations are executed in a secure and controlled environment, ensuring data privacy and compliance. -5. Incentives and Governance: Ocean Protocol incorporates tokeconomics and a governance framework to incentivize participants and ensure the sustainability and evolution of the ecosystem. Participants can earn and stake Ocean tokens (OCEAN) to access data, contribute to the network, and participate in governance decisions. +1. **Asset Registration**: Data providers register their data assets on the Ocean blockchain, providing metadata that describes the asset, its usage terms, and pricing information. This metadata is stored on-chain and can be accessed by potential data consumers. +2. **Discovery and Access Control**: Data consumers can discover available data assets through decentralized metadata services like Aquarius. Access control mechanisms, such as smart contracts, verify the consumer's permissions and handle the transfer of data access tokens. +3. **Secure Data Exchange**: When a data consumer purchases access to a data asset, the asset's metadata and access instructions are encrypted by the data provider using the Provider service. The encrypted asset is then securely transferred to the consumer, who can decrypt and utilize it without revealing the asset's URL. +4. **Compute-to-Data (C2D)**: Ocean Protocol supports C2D capabilities, allowing data consumers to perform computations on data assets without direct access to the underlying data. The compute operations are executed in a secure and controlled environment, ensuring data privacy and compliance. +5. **Incentives and Governance**: Ocean Protocol incorporates tokeconomics and a governance framework to incentivize participants and ensure the sustainability and evolution of the ecosystem. Participants can earn and stake Ocean tokens (OCEAN) to access data, contribute to the network, and participate in governance decisions. It's a decentralized data exchange protocol that transforms the way we share, monetize, and make the most out of data. By tackling issues such as data silos, limited monetization options, privacy worries, and the hassles of middlemen, Ocean Protocol gives people and organizations the power to unleash the true value of their data. With its decentralized marketplaces, rock-solid data sharing methods, and privacy protection measures, Ocean Protocol opens doors for collaboration, sparks innovation, and encourages responsible and ethical data usage. It's all about making data work for everyone in a fair and transparent data economy.