Ocean#

class defichain.Ocean(url: str = 'https://ocean.defichain.com', version: str = 'v0', network: str = 'mainnet', logger: Logger | None = None)#

This is the main interface to communicate with the ocean protocol.

If you want to communicate with the standard Ocean, which is also used to operate the Lightwallet, then do not change anything in the parameters and create only the Ocean object as in the example.

Parameters:
  • url (str) – (optional) The main URL where an ocean instance can be reached

  • version (str) – (optional) witch version to use with this ocean connection

  • network (str) – (optional) witch network to use with this ocean connection

  • logger (Logger) – (optional) Logger Object

Returns:

Ocean (object) The object to interact with the ocean protocol

Example:
>>> from defichain import Ocean
>>> ocean = Ocean()
>>> blocks = ocean.blocks.list()  #  returns the latest 30 blocks
>>> print(blocks)