cfxdb.xbr

Submodules

Classes

Actor

XBR Market Actors.

ActorType

Actors

Market actors table, mapping from (market_id|UUID, actor_adr|bytes[20], actor_type|int) to cfxdb.xbr.Actor.

Api

XBRNetwork.Api database object.

Apis

Apis table, mapping from oid|UUID to cfxdb.xbr.Api

Block

Blockchain blocks. This table stores information about the series of Ethereum blocks that make up the blockchain.

Blocks

Blockchain blocks processed.

Catalog

XBRNetwork.FbsRepository database object.

Catalogs

Catalogs table, mapping from oid|UUID to cfxdb.xbr.FbsRepository

Consent

XBRNetwork.Consent database object.

Consents

Consents table

IndexConsentByMemberAddress

Consent-by-member-address index with (member_adr|bytes[20], timestamp|int) -> consent_oid|UUID mapping.

IndexMarketsByActor

Markets-by-actor index with (actor_adr|bytes[20], joined|int) -> market_id|UUID mapping.

IndexMarketsByMaker

Markets-by-maker index with maker_adr|bytes[20] -> market_id|UUID mapping.

IndexMarketsByOwner

Markets-by-owner index with (owner_adr|bytes[20], created|int) -> market_id|UUID mapping.

Market

XBRNetwork.Market database object.

Markets

Markets table, mapping from market_id|UUID to cfxdb.xbr.Market

Member

XBR Network member database object.

MemberLevel

Members

XBR members by member_adr.

Schema

CFC edge database schema for ZLMDB.

TokenApproval

IERC20.TokenApproval event database object.

TokenApprovals

Persisted token approvals archive.

TokenTransfer

IERC20.TokenTransfer event database object.

TokenTransfers

Persisted token transfers archive.

Package Contents

class Actor(from_fbs=None)[source]

Bases: object

XBR Market Actors.

__str__()[source]
_actor = None
_actor_type = None
_from_fbs = None
_joined = None
_market = None
_meta = None
_security = None
_signature = None
_tid = None
_timestamp = None
property actor: bytes

Ethereum address of the member.

property actor_type: int

Type of the market actor.

build(builder)[source]
static cast(buf)[source]
property joined: int

Block number (on the blockchain) when the actor (originally) joined the market.

property market: uuid.UUID

ID of the market this actor is associated with.

marshal()[source]
property meta: str

The XBR market metadata published by the market owner. IPFS Multihash pointing to a RDF/Turtle file with market metadata.

property security: int

Security (XBR tokens) deposited by the actor in the market.

property signature: bytes

When signed off-chain and submitted via XBRMarket.joinMarketFor.

property tid: bytes

Transaction hash of the transaction this change was committed to the blockchain under.

property timestamp: numpy.datetime64

Database transaction time (epoch time in ns) of insert or last update.

class ActorType[source]

Bases: object

CONSUMER = 2
NONE = 0
PROVIDER = 1
PROVIDER_CONSUMER = 3
class Actors(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapUuidBytes20Uint8FlatBuffers

Market actors table, mapping from (market_id|UUID, actor_adr|bytes[20], actor_type|int) to cfxdb.xbr.Actor.

class Api(from_fbs=None)[source]

Bases: object

XBRNetwork.Api database object.

__str__()[source]
_catalog_oid = None
_from_fbs = None
_meta = None
_oid = None
_published = None
_schema = None
_signature = None
_tid = None
_timestamp = None
build(builder)[source]
static cast(buf)[source]
property catalog_oid: uuid.UUID

The unique ID of the catalog.

marshal() dict[source]
property meta: str

The XBR market metadata published by the market owner. IPFS Multihash pointing to a RDF/Turtle file with market metadata.

property oid: uuid.UUID

The unique ID of the api.

property published: int

Global market sequence number.

property schema: str

The XBR market terms set by the market owner. IPFS Multihash pointing to a ZIP archive file with market documents.

property signature: bytes

When signed off-chain and submitted via XBRMarket.createMarketFor.

property tid: bytes

Transaction hash of the transaction this change was committed to the blockchain under.

property timestamp: numpy.datetime64

Database transaction time (epoch time in ns) of insert or last update.

class Apis(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapUuidFlatBuffers

Apis table, mapping from oid|UUID to cfxdb.xbr.Api

class Block(from_fbs=None)[source]

Bases: object

Blockchain blocks. This table stores information about the series of Ethereum blocks that make up the blockchain.

__str__()[source]
_block_hash = None
_block_number = None
_cnt_events = None
_from_fbs = None
_timestamp = None
property block_hash: bytes

Block hash.

property block_number: int

block number.

Type:

Primary key

build(builder)[source]
static cast(buf)[source]
property cnt_events: int

Number of XBR blockchain log events found in the block.

marshal() dict[source]
property timestamp: numpy.datetime64

Timestamp when record was inserted (Unix epoch time in ns).

class Blocks(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapBytes32FlatBuffers

Blockchain blocks processed.

Map zlmdb.MapBytes32FlatBuffers from block_number to cfxdb.xbr.Block

class Catalog(from_fbs=None)[source]

Bases: object

XBRNetwork.FbsRepository database object.

__str__()[source]
_from_fbs = None
_meta = None
_oid = None
_owner = None
_seq = None
_signature = None
_terms = None
_tid = None
_timestamp = None
build(builder)[source]
static cast(buf)[source]
marshal() dict[source]
property meta: str

The XBR market metadata published by the market owner. IPFS Multihash pointing to a RDF/Turtle file with market metadata.

property oid: uuid.UUID

The unique ID of the market.

property owner: bytes

FbsRepository owner.

property seq: int

Global market sequence number.

property signature: bytes

When signed off-chain and submitted via XBRMarket.createMarketFor.

property terms: str

The XBR market terms set by the market owner. IPFS Multihash pointing to a ZIP archive file with market documents.

property tid: bytes

Transaction hash of the transaction this change was committed to the blockchain under.

property timestamp: numpy.datetime64

Database transaction time (epoch time in ns) of insert or last update.

class Catalogs(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapUuidFlatBuffers

Catalogs table, mapping from oid|UUID to cfxdb.xbr.FbsRepository

class Consent(from_fbs=None)[source]

Bases: object

XBRNetwork.Consent database object.

__str__()[source]
_catalog_oid = None
_delegate = None
_delegate_type = None
_from_fbs = None
_market_oid = None
_member = None
_service_prefix = None
_signature = None
_synced = None
_tid = None
_timestamp = None
_updated = None
build(builder)[source]
static cast(buf)[source]
property catalog_oid: uuid.UUID

The unique ID of the catalog.

property consent: bool

Whether we have the consent

property delegate: bytes

The unique ID of the market.

property delegate_type: int

The unique ID of the market.

property market_oid: uuid.UUID

The unique ID of the market.

marshal() dict[source]
property member: bytes

The unique ID of the market.

property service_prefix: str
property signature: bytes

When signed off-chain and submitted via XBRMarket.createMarketFor.

property synced: bool

Whether the consent is synced with blockchain

property tid: bytes

Transaction hash of the transaction this change was committed to the blockchain under.

property timestamp: numpy.datetime64

Database transaction time (epoch time in ns) of insert or last update.

property updated: int

The amount of XBR tokens a XBR provider joining the market must deposit.

class Consents(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapUuidBytes20Bytes20Uint8UuidFlatBuffers

Consents table

class IndexConsentByMemberAddress(slot=None, compress=None)[source]

Bases: zlmdb.MapBytes20TimestampUuid

Consent-by-member-address index with (member_adr|bytes[20], timestamp|int) -> consent_oid|UUID mapping.

class IndexMarketsByActor(slot=None, compress=None)[source]

Bases: zlmdb.MapBytes20TimestampUuid

Markets-by-actor index with (actor_adr|bytes[20], joined|int) -> market_id|UUID mapping.

class IndexMarketsByMaker(slot=None, compress=None)[source]

Bases: zlmdb.MapBytes20Uuid

Markets-by-maker index with maker_adr|bytes[20] -> market_id|UUID mapping.

class IndexMarketsByOwner(slot=None, compress=None)[source]

Bases: zlmdb.MapBytes20TimestampUuid

Markets-by-owner index with (owner_adr|bytes[20], created|int) -> market_id|UUID mapping.

class Market(from_fbs=None)[source]

Bases: object

XBRNetwork.Market database object.

__str__()[source]
_coin = None
_consumer_security = None
_created = None
_from_fbs = None
_maker = None
_market = None
_market_fee = None
_meta = None
_owner = None
_provider_security = None
_seq = None
_signature = None
_terms = None
_tid = None
_timestamp = None
build(builder)[source]
static cast(buf)[source]
property coin: bytes

Market coin.

property consumer_security: int

The amount of XBR tokens a XBR consumer joining the market must deposit.

property created: int

Block number (on the blockchain) when the actor (originally) joined the market.

property maker: bytes

The address of the XBR market maker that will run this market. The delegate of the market owner.

property market: uuid.UUID

The unique ID of the market.

property market_fee: int

The fee taken by the market (beneficiary is the market owner). The fee is a percentage of the revenue of the XBR Provider that receives XBR Token paid for transactions. The fee must be between 0% (inclusive) and 99% (inclusive), and is expressed as a fraction of the total supply of XBR tokens.

marshal() dict[source]
property meta: str

The XBR market metadata published by the market owner. IPFS Multihash pointing to a RDF/Turtle file with market metadata.

property owner: bytes

Market owner.

property provider_security: int

The amount of XBR tokens a XBR provider joining the market must deposit.

property seq: int

Global market sequence number.

property signature: bytes

When signed off-chain and submitted via XBRMarket.createMarketFor.

property terms: str

The XBR market terms set by the market owner. IPFS Multihash pointing to a ZIP archive file with market documents.

property tid: bytes

Transaction hash of the transaction this change was committed to the blockchain under.

property timestamp: numpy.datetime64

Database transaction time (epoch time in ns) of insert or last update.

class Markets(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapUuidFlatBuffers

Markets table, mapping from market_id|UUID to cfxdb.xbr.Market

class Member(from_fbs=None)[source]

Bases: object

XBR Network member database object.

__str__()[source]
_account_oid = None
_address = None
_eula = None
_from_fbs = None
_level = None
_profile = None
_registered = None
_signature = None
_tid = None
_timestamp = None
property account_oid: uuid.UUID

ID of user account this member has an account on planet.xbr.network.

property address: bytes

Ethereum address of the member.

build(builder)[source]
static cast(buf)[source]
property eula: str

EULA the member agreed to when joining the market (IPFS Multihash string).

property level: int

Current member level.

marshal() dict[source]
property profile: str

Optional member profile (IPFS Multihash string).

property registered: int

Block number (on the blockchain) when the member (originally) registered.

property signature: bytes

When signed off-chain and submitted via XBRNetwork.registerMemberFor.

property tid: bytes

Transaction hash of the transaction this change was committed to the blockchain under.

property timestamp: numpy.datetime64

Database transaction time (epoch time in ns) of insert or last update.

class MemberLevel[source]

Bases: object

ACTIVE = 1
BLOCKED = 5
NONE = 0
PENALTY = 4
RETIRED = 3
VERIFIED = 2
class Members(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapBytes20FlatBuffers

XBR members by member_adr.

Map zlmdb.MapBytes20FlatBuffers from member_adr to cfxdb.xbr.Member

class Schema(db)[source]

Bases: object

CFC edge database schema for ZLMDB.

actors: cfxdb.xbr.actor.Actors

XBR market actors.

apis: cfxdb.xbr.api.Apis

XBR network apis.

static attach(db)[source]

Factory to create a schema from attaching to a database. The schema tables will be automatically mapped as persistant maps and attached to the database slots.

Parameters:

db – zlmdb.Database

Returns:

object of Schema

blocks: cfxdb.xbr.block.Blocks

Ethereum blocks basic information.

catalogs: cfxdb.xbr.catalog.Catalogs

XBR network catalogs.

consents: cfxdb.xbr.consent.Consents

XBR data consents.

db
idx_apis_by_catalog: cfxdb.xbr.api.IndexApiByCatalog

Index catalog_oid -> api_oid.

idx_catalogs_by_owner: cfxdb.xbr.catalog.IndexCatalogsByOwner

Index (member_oid, created) -> catalog_oid.

Consents-by-members-address index with (member_adr|bytes[20], joined|int) -> member_adr|UUID mapping.

idx_markets_by_actor: cfxdb.xbr.market.IndexMarketsByActor

Index (actor_adr, joined) -> market_oid.

idx_markets_by_maker: cfxdb.xbr.market.IndexMarketsByMaker

Index maker_adr -> market_oid.

idx_markets_by_owner: cfxdb.xbr.market.IndexMarketsByOwner

Index (owner_adr, created) -> market_oid.

idx_offer_by_key: cfxdb.xbrmm.offer.IndexOfferByKey

Index of key offers by key ID (rather than offer ID, as the object table is indexed by).

idx_paying_channel_by_delegate: cfxdb.xbrmm.channel.IndexPayingChannelByDelegate

Maps from XBR provider delegate address to the currently active paying channel address for the given provider delegate.

idx_paying_channel_by_recipient: cfxdb.xbrmm.channel.IndexPayingChannelByRecipient

Maps from XBR seller actor address to the currently active paying channel address for the given actor.

idx_payment_channel_by_actor: cfxdb.xbrmm.channel.IndexPaymentChannelByActor

Maps from XBR (buyer) actor address to the currently active payment channel address for the given actor.

idx_payment_channel_by_delegate: cfxdb.xbrmm.channel.IndexPaymentChannelByDelegate

Maps from XBR consumer delegate address to the currently active payment channel address for the given consumer delegate.

markets: cfxdb.xbr.market.Markets

XBR markets.

members: cfxdb.xbr.member.Members

XBR network members.

offers: cfxdb.xbrmm.offer.Offers

Data encryption key offers.

paying_balances: cfxdb.xbrmm.channel.PayingChannelBalances

Current off-chain balances within paying channels.

paying_channels: cfxdb.xbrmm.channel.PayingChannels

Paying channels for XBR provider delegates.

payment_balances: cfxdb.xbrmm.channel.PaymentChannelBalances

Current off-chain balances within payment channels.

payment_channels: cfxdb.xbrmm.channel.PaymentChannels

Payment channels for XBR consumer delegates.

token_approvals: cfxdb.xbr.token.TokenApprovals

Token approvals archive.

token_transfers: cfxdb.xbr.token.TokenTransfers

Token transfers archive.

transactions: cfxdb.xbrmm.transaction.Transactions
class TokenApproval(from_fbs=None)[source]

Bases: object

IERC20.TokenApproval event database object.

__str__()[source]
_block_hash = None
_from_fbs = None
_owner_address = None
_spender_address = None
_tx_hash = None
_value = None
property block_hash: bytes

Block hash.

build(builder)[source]
static cast(buf)[source]
marshal() dict[source]
property owner_address: bytes

XBR token sending address.

property spender_address: bytes

XBR token receiving address.

property tx_hash: bytes

Transaction hash.

Type:

Primary key

property value: int

XBR token transferred.

class TokenApprovals(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapBytes32FlatBuffers

Persisted token approvals archive.

Map zlmdb.MapBytes32FlatBuffers from transaction_hash to cfxdb.xbr.TokenApproval

class TokenTransfer(from_fbs=None)[source]

Bases: object

IERC20.TokenTransfer event database object.

__str__()[source]
_block_hash = None
_from_address = None
_from_fbs = None
_to_address = None
_tx_hash = None
_value = None
property block_hash: bytes

Block hash.

build(builder)[source]
static cast(buf)[source]
property from_address: bytes

XBR token sending address.

marshal() dict[source]
property to_address: bytes

XBR token receiving address.

property tx_hash: bytes

Transaction hash.

Type:

Primary key

property value: int

XBR token transferred.

class TokenTransfers(slot=None, compress=None, build=None, cast=None)[source]

Bases: zlmdb.MapBytes32FlatBuffers

Persisted token transfers archive.

Map zlmdb.MapBytes32FlatBuffers from transaction_hash to cfxdb.xbr.TokenTransfer