Network

Blockchain


class cfxdb.meta.Attribute(from_fbs=None)[source]

Bases: object

Generic meta-data attributes that can be stored on objects in tables.

property table_oid: UUID

Table of the object holding the attribute.

property object_oid: UUID

Object (within the table) holding the attribute.

property attribute: str

Attribute name (part of the key).

property modified: datetime64

Timestamp when the attribute was last modified (or first created).

property value

Arbitrary attribute value, stored CBOR-serialized.

class cfxdb.meta.Attributes(slot=None, compress=None, build=None, cast=None)[source]

Bases: MapUuidUuidStringFlatBuffers

Generic meta-data attributes that can be stored on objects in tables. Primary key of this table is (table_oid, object_oid, attribute).

Map zlmdb.MapUuidUuidStringFlatBuffers from (table_oid, object_oid, attribute) to cfxdb.meta.Attribute

class cfxdb.xbr.Block(from_fbs=None)[source]

Bases: object

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

property timestamp: datetime64

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

property block_hash: bytes

Block hash.

property block_number: int

Primary key: block number.

property cnt_events: int

Number of XBR blockchain log events found in the block.

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

Bases: MapBytes32FlatBuffers

Blockchain blocks processed.

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

class cfxdb.xbr.TokenApproval(from_fbs=None)[source]

Bases: object

IERC20.TokenApproval event database object.

property tx_hash: bytes

Primary key: Transaction hash.

property block_hash: bytes

Block hash.

property owner_address: bytes

XBR token sending address.

property spender_address: bytes

XBR token receiving address.

property value: int

XBR token transferred.

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

Bases: MapBytes32FlatBuffers

Persisted token approvals archive.

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

class cfxdb.xbr.TokenTransfer(from_fbs=None)[source]

Bases: object

IERC20.TokenTransfer event database object.

property tx_hash: bytes

Primary key: Transaction hash.

property block_hash: bytes

Block hash.

property from_address: bytes

XBR token sending address.

property to_address: bytes

XBR token receiving address.

property value: int

XBR token transferred.

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

Bases: MapBytes32FlatBuffers

Persisted token transfers archive.

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

Network


class cfxdb.xbr.Member(from_fbs=None)[source]

Bases: object

XBR Network member database object.

property address: bytes

Ethereum address of the member.

property account_oid: UUID

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

property timestamp: datetime64

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

property registered: int

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

property eula: str

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

property profile: str

Optional member profile (IPFS Multihash string).

property level: int

Current member level.

property tid: bytes

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

property signature: bytes

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

class cfxdb.xbr.Members(slot=None, compress=None, build=None, cast=None)[source]

Bases: MapBytes20FlatBuffers

XBR members by member_adr.

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

class cfxdb.xbr.Market(from_fbs=None)[source]

Bases: object

XBRNetwork.Market database object.

property market: UUID

The unique ID of the market.

property timestamp: datetime64

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

property created: int

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

property seq: int

Global market sequence number.

property owner: bytes

Market owner.

property coin: bytes

Market coin.

property terms: str

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

property meta: str

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

property maker: bytes

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

property provider_security: int

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

property consumer_security: int

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

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.

property tid: bytes

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

property signature: bytes

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

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

Bases: MapUuidFlatBuffers

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

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

Bases: MapBytes20TimestampUuid

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

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

Bases: MapBytes20TimestampUuid

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

class cfxdb.xbr.Actor(from_fbs=None)[source]

Bases: object

XBR Market Actors.

property timestamp: datetime64

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

property market: UUID

ID of the market this actor is associated with.

property actor: bytes

Ethereum address of the member.

property actor_type: int

Type of the market actor.

property joined: int

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

property security: int

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

property meta: str

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

property tid: bytes

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

property signature: bytes

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

class cfxdb.xbr.Actors(slot=None, compress=None, build=None, cast=None)[source]

Bases: MapUuidBytes20Uint8FlatBuffers

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

Account


class cfxdb.xbrnetwork.Account(from_fbs=None)[source]

Bases: object

XBR Network members.

ACCOUNT_LEVEL_NONE = 0

Unset.

ACCOUNT_LEVEL_ACTIVE = 1

Account is active.

ACCOUNT_LEVEL_VERIFIED = 2

Account is active and verified.

ACCOUNT_LEVEL_RETIRED = 3

Account is retired.

ACCOUNT_LEVEL_PENALTY = 4

Account is subject to a temporary penalty.

ACCOUNT_LEVEL_BLOCKED = 5

Account is currently blocked and cannot current actively participate in the market.

ACCOUNT_LEVEL = [0, 1, 2, 3, 4, 5]

Valid account levels.

WALLET_TYPE_NONE = 0

Wallet type unset (“null”).

WALLET_TYPE_IMPORTED = 1

Account (primary) wallet was imported (the user provided the wallet public address).

WALLET_TYPE_METAMASK = 2

Account (primary) wallet was imported (the user provided the wallet public address).

WALLET_TYPE_HOSTED = 3

Account wallet in hosted (in this database).

WALLET_TYPE = [0, 1, 2, 3]

Valid account wallet types.

WALLET_TYPE_TO_STRING = {0: 'none', 1: 'imported', 2: 'metamask', 3: 'hosted'}

Map of wallet-type-code to wallet-type-name.

WALLET_TYPE_FROM_STRING = {'hosted': 3, 'imported': 1, 'metamask': 2, 'none': 0}

Map of wallet-type-name to wallet-type-code.

property recovery_algo: datetime64

Timestamp (epoch time in ns) of initial creation of this record.

property recovery_data: bytes

Recovery backup data (usually encrypted according to the account backup recovery algo in use).

property recovery_salt: bytes

Salt used for encryption of recovery data.

property oid: UUID

Globally unique and static member ID.

property created: datetime64

Timestamp (epoch time in ns) of initial creation of this record.

property username: str

XBR Network username (must be globally unique on https://xbr.network)

property email: str

User (primary) email address.

property email_verified: datetime64

Timestamp (epoch time in ns) when the user email was (last) verified or 0 if unverified.

property wallet_type: int

Type of (primary) user crypto wallet in use.

property wallet_address: bytes

Public address of user crypto wallet in use.

property registered: int

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

property eula: str

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

property profile: str

Optional member profile (IPFS Multihash string).

property level: int

Current member level.

class cfxdb.xbrnetwork.Accounts(slot=None, compress=None, build=None, cast=None)[source]

Bases: MapUuidFlatBuffers

Database table for XBR member accounts.

static parse(data)[source]
Parameters

data

Returns

class cfxdb.xbrnetwork.IndexAccountsByUsername(slot=None, compress=None)[source]

Bases: MapStringUuid

Database (index) table for username-to-account mapping.

class cfxdb.xbrnetwork.IndexAccountsByEmail(slot=None, compress=None)[source]

Bases: MapStringUuid

Database (index) table for (user-)email-to-account mapping.

class cfxdb.xbrnetwork.IndexAccountsByWallet(slot=None, compress=None)[source]

Bases: MapBytes20Uuid

Database (index) table for (user-)wallet-to-account mapping.

VerifiedAction


class cfxdb.xbrnetwork.VerifiedAction(from_fbs=None)[source]

Bases: object

User actions (such as “on-board new user”) yet to be verified. Actions to be verified are identified using their “Verification Action ID”. A verificatin email is sent to the (primary) email address of the user, and to verify, the user must click the verification link contained in the email. The verification link contains the verification action ID and code.

VERIFICATION_TYPE_NONE = 0

Unset verification action type (“null”).

VERIFICATION_TYPE_ONBOARD_MEMBER = 1

Verification action type for on-boarding new members via email verification.

VERIFICATION_TYPE_LOGIN_MEMBER = 2

Verification action type for login of member (client) via email verification.

VERIFICATION_TYPE_CREATE_MARKET = 3

Verification action type for creation of new data market via email verification.

VERIFICATION_TYPE_JOIN_MARKET = 4

Verification action type for joining an existing market via email verification.

VERIFICATION_TYPE_CREATE_CATALOG = 5

Verification action type for creation of a catalog via email verification.

VERIFICATION_TYPE_PUBLISH_API = 5

Verification action type for publishing on API via email verification.

VERIFICATION_TYPE = [0, 1, 2, 3, 4, 5, 6]

All valid verification action types.

VERIFICATION_STATUS_NONE = 0

Unset verification action status (“null”).

VERIFICATION_STATUS_PENDING = 1

Verification is still pending.

VERIFICATION_STATUS_VERIFIED = 2

Verification has been successfully completed.

VERIFICATION_STATUS_FAILED = 3

Verification has failed.

VERIFICATION_STATUS_EXPIRED = 4

Action cannot be verified any longer since it has expired.

VERIFICATION_STATUS = [0, 1, 2, 3, 4]

All valid verification status codes.

property oid: UUID

Globally unique and static ID of action.

property created: datetime64

Timestamp (epoch time in ns) of initial creation of this record.

property vtype: int

Verification type.

property vstatus: int

Verification type.

property vcode: str

Verification code sent.

property verified_oid: UUID

ID of object of verified action.

property verified_data: dict

Action data, serialized in CBOR.

class cfxdb.xbrnetwork.VerifiedActions(slot=None, compress=None, build=None, cast=None)[source]

Bases: MapUuidFlatBuffers

Database table for verification/verified actions, eg on-boarding new XBR members.

static parse(data)[source]
Parameters

data

Returns

UserKey


class cfxdb.xbrnetwork.UserKey(from_fbs=None)[source]

Bases: object

User client (public) keys.

property pubkey: bytes

User key - a Ed25519 public key - for authenticating using WAMP-cryptosign.

property created: datetime64

Timestamp (epoch time in ns) of initial creation of this record.

property owner: UUID

ID of user account this user key is owned by.

class cfxdb.xbrnetwork.UserKeys(slot=None, compress=None, build=None, cast=None)[source]

Bases: MapBytes32FlatBuffers

Database table for user client keys.

static parse(data)[source]
Parameters

data

Returns

class cfxdb.xbrnetwork.IndexUserKeyByAccount(slot=None, compress=None)[source]

Bases: MapUuidTimestampBytes32

Database (index) table for (member_oid, created) -> userkey mapping.