Beispiel #1
0
def test_issue185_system(monkeypatch):
    """A system-level test, to replicate original failure seen in #185"""
    setup_issue_185(monkeypatch)

    # actual test. Imports only come now, to avoid setting class-level attributes
    from ocean_lib.ocean.ocean import Ocean
    from ocean_lib.web3_internal.wallet import Wallet

    private_key = os.getenv("TEST_PRIVATE_KEY1")
    config = {"network": os.getenv("NETWORK_URL")}
    ocean = Ocean(config)

    wallet = Wallet(ocean.web3, private_key=private_key)

    # this failed before the fix
    datatoken = ocean.create_data_token("Dataset name",
                                        "dtsymbol",
                                        from_wallet=wallet)
    assert datatoken is not None
Beispiel #2
0
def run_scenario():
    config = Config('config.ini')
    ocean = Ocean(config)
    wallet = Wallet(
        ocean.web3,
        0x376e05899a4ae00463a3a607c774069b7d6a647860dba723f39b735c91238ddf,
        None, "EARLYTOBEDANDEARLYTORISE")
    ConfigProvider.set_config(config)
    Web3Provider.init_web3(
        provider=get_web3_connection_provider(config.network_url))
    ContractHandler.set_artifacts_path(config.artifacts_path)
    print(dir(wallet))
    print(wallet.address)
    print(config.network_url)
    print(config.provider_url)
    print(config.network_url)
    print(config.artifacts_path)

    data_token = ocean.create_data_token('S1Seven', 'S1SV', from_wallet=wallet)
    print(f'created new datatoken with address {data_token.address}')
    token_address = data_token.address
    print(token_address)
    '''
#configure the components
ConfigProvider.set_config(config)
Web3Provider.init_web3(provider=get_web3_connection_provider(config.network_url))
ContractHandler.set_artifacts_path(config.artifacts_path)

print("")
print(dir(config))
print(config.network_url)
print(config.provider_url)
print(config.network_url)
print(config.artifacts_path)



data_token = ocean.create_data_token('S1Seven', 'S1SV', from_wallet=wallet)
print(f'created new datatoken with address {data_token.address}')
token_address = data_token.address


date_created = "2020-12-01T10:55:11Z"
service_attributes = {
        "main": {
            "name": "dataAssetAccessServiceAgreement",
            "creator": wallet.address,
            "timeout": 3600 * 24,
            "datePublished": date_created,
            "cost": 1.0, # <don't change, this is obsolete>
        }
    }
Beispiel #4
0
from ocean_lib.web3_internal.wallet import Wallet
from ocean_lib.data_provider.data_service_provider import DataServiceProvider
from ocean_utils.agreements.service_factory import ServiceDescriptor
#Publish asset to download. Tetsing
#Alice's config
config = {
   'network' : os.getenv('NETWORK_URL'),
   'metadataStoreUri' : os.getenv('AQUARIUS_URL'),
   'providerUri' : os.getenv('PROVIDER_URL'),
}
ocean = Ocean(config)


alice_wallet = Wallet(ocean.web3, private_key=os.getenv('Publisher_Key'))

data_token = ocean.create_data_token('GPT-2 Pretrained', 'GPT2P', alice_wallet, blob=ocean.config.metadata_store_url)
token_address = data_token.address

date_created = "2020-02-01T10:55:11Z"
service_attributes = {
        "main": {
            "name": "dataAssetAccessServiceAgreement",
            "creator": alice_wallet.address,
            "timeout": 3600 * 24,
            "datePublished": date_created,
            "cost": 1.0, # <don't change, this is obsolete>
        }
    }

service_endpoint = DataServiceProvider.get_url(ocean.config)
download_service = ServiceDescriptor.access_service_descriptor(service_attributes, service_endpoint)
Beispiel #5
0
import os

from examples.compute_service import build_compute_descriptor, get_config_dict, run_compute, publish_asset
#Publish Model with compute to data, with training algorithim
#Alice's config
config = {
   'network' : os.getenv('NETWORK_URL'),
   'metadataStoreUri' : os.getenv('AQUARIUS_URL'),
   'providerUri' : os.getenv('PROVIDER_URL'),
}
ocean = Ocean(config)


alice_wallet = Wallet(ocean.web3, private_key=os.getenv('Publisher_Key'))

data_token = ocean.create_data_token('DToxen2', 'DTX2', alice_wallet, blob=ocean.config.metadata_store_url)
token_address = data_token.address

date_created = "2020-02-01T10:55:11Z"
service_attributes = {
        "main": {
            "name": "dataAssetAccessServiceAgreement",
            "creator": alice_wallet.address,
            "timeout": 3600 * 24,
            "datePublished": date_created,
            "cost": 1.0, # <don't change, this is obsolete>
        }
    }

service_endpoint = DataServiceProvider.get_url(ocean.config)
download_service = ServiceDescriptor.access_service_descriptor(service_attributes, service_endpoint)