Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue113 dev instrs #184

Merged
merged 8 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ This is in beta state and you can expect running into problems. If you run into

### Simple Flow

[Publish your first datatoken](READMEs/datatokens\-flow.md) - connect to Ethereum, create an Ocean instance, and publish.
This stripped-down flow shows the essence of Ocean. Just downloading, no metadata.

[Go to simple flow](READMEs/datatokens\-flow.md)

### Marketplace flow

This batteries-included flow includes metadata, multiple services for one datatoken, and compute-to-data.

[Go to marketplace flow](READMEs/marketplace\-flow.md)

### Learn more

Expand All @@ -54,10 +62,6 @@ This is in beta state and you can expect running into problems. If you run into
- [Learn about wallets](READMEs/wallets.md) - on generating, storing, and accessing private keys
- [Get an overview of ocean.py](READMEs/overview.md) - key modules and functions

### Marketplace flow

[Create a marketplace and sell data](READMEs/marketplace\-flow.md) - batteries-included flow including using off-chain services for metadata and consuming datasets.

## 🦑 Development

If you want to further develop ocean.py, then [please go here](READMEs/developers.md).
Expand Down
77 changes: 38 additions & 39 deletions READMEs/datatokens-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,72 @@ Copyright 2021 Ocean Protocol Foundation
SPDX-License-Identifier: Apache-2.0
-->

# Publish your first datatoken
# Quickstart: Publish datatoken

## A. Set Ethereum network & node (Rinkeby & Infura)
## Run the services

1. Infura runs hosted Ethereum nodes. Go to https://infura.io and sign up
In a new console:

2. At Infura site, create a new project

3. Within the project settings page, note your Infura `project id` value. We will use it in the next step.

4. Make the network available as an envvar. In console:

<!---->

export NETWORK_URL=https://rinkeby.infura.io/v3/<your Infura project id>

## B. Set Ethereum account and get Rinkeby ETH

1. [Install Metamask to your browser](https://docs.oceanprotocol.com/tutorials/metamask-setup/). This will generate an Ethereum account for you.

2. [Export the private key from Metamask](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key). Write it down.

3. [Get Rinkeby ETH from a faucet](https://faucet.rinkeby.io/). Have it sent to the your Metamask's Ethereum account address.
```console
#grab repo
git clone https://github.com/oceanprotocol/barge
cd barge

4. Make your private key available as an envvar. In console:
#clean up old containers (to be sure)
docker system prune -a --volumes

<!---->
#run barge (runs ganache, Provider, Aquarius)
./start_ocean.sh --with-provider2
```

export MY_TEST_KEY=<my_private_key>
## Create config file
Create a file called `config.ini` and fill it as follows.
```text
[eth-network]
network = ganache
artifacts.path = ~/.ocean/ocean-contracts/artifacts
address.file = ~/.ocean/ocean-contracts/artifacts/address.json
```

## C. Install ocean-lib
## Install the library, set envvars

In bash console:
In a new console:

```console
#create a python virtualenv
#Initialize virtual environment and activate it.
python -m venv venv
source venv/bin/activate
source venv/bin/activate

#install!
#Install the ocean.py library
pip install ocean-lib

#set envvars
export TEST_PRIVATE_KEY1=0xc594c6e5def4bab63ac29eed19a134c130388f74f019bc74b8f4389df2837a58

#go into python
python
```

## D. Publish datatokens
## Publish datatokens

In Python console:
In the Python console:

```python
import os
from ocean_lib.config import Config
from ocean_lib.ocean.ocean import Ocean
from ocean_lib.web3_internal.wallet import Wallet

private_key = os.getenv('MY_TEST_KEY')
config = {'network': os.getenv('NETWORK_URL')}
private_key = os.getenv('TEST_PRIVATE_KEY1')
config = Config('config.ini')
ocean = Ocean(config)

print("create wallet: begin")
wallet = Wallet(ocean.web3, private_key=private_key)
print(f"create wallet: done. Its address is {wallet.address}")

print("create datatoken: begin. This will take a few seconds, since it's a transaction on Rinkeby.")
print("create datatoken: begin.")
datatoken = ocean.create_data_token("Dataset name", "dtsymbol", from_wallet=wallet)
print(f"created datatoken: done. Its address is {datatoken.address}")
```

If you made it to the end: congrats, you have created your first Ocean datatoken! 🐋

Or, if you got an error like "insufficient funds for gas", it's because your account doesn't have enough ETH to pay for gas. Get more from the faucet linked above.

Follow-on tutorials will flesh things out more.
Congrats, you've created your first Ocean datatoken! 🐋
Loading