cfxdb.xbrnetwork

Submodules

Classes

Account

XBR Network members.

AccountLevel

Accounts

Database table for XBR member accounts.

IndexAccountsByEmail

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

IndexAccountsByUsername

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

IndexAccountsByWallet

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

IndexUserKeyByAccount

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

Schema

XBR Network backend database schema.

UserKey

User client (public) keys.

UserKeys

Database table for user client keys.

VerificationStatus

VerificationType

VerifiedAction

User actions (such as "on-board new user") yet to be verified. Actions to be verified are

VerifiedActions

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

WalletType

Package Contents

class Account(from_fbs=None)[source]

Bases: object

XBR Network members.

ACCOUNT_LEVEL

Valid account levels.

ACCOUNT_LEVEL_ACTIVE = 1

Account is active.

ACCOUNT_LEVEL_BLOCKED = 5

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

ACCOUNT_LEVEL_NONE = 0

Unset.

ACCOUNT_LEVEL_PENALTY = 4

Account is subject to a temporary penalty.

ACCOUNT_LEVEL_RETIRED = 3

Account is retired.

ACCOUNT_LEVEL_VERIFIED = 2

Account is active and verified.

WALLET_TYPE

Valid account wallet types.

WALLET_TYPE_FROM_STRING

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

WALLET_TYPE_HOSTED = 3

Account wallet in hosted (in this database).

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_NONE = 0

Wallet type unset (“null”).

WALLET_TYPE_TO_STRING

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

__str__()[source]
_created = None
_email = None
_email_verified = None
_eula = None
_from_fbs = None
_level = None
_oid = None
_profile = None
_recovery_algo = None
_recovery_data = None
_recovery_salt = None
_registered = None
_username = None
_wallet_address = None
_wallet_type = None
build(builder)[source]
static cast(buf)[source]
property created: numpy.datetime64

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

property email: str

User (primary) email address.

property email_verified: numpy.datetime64

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

property eula: str

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

property level: int

Current member level.

marshal()[source]
property oid: uuid.UUID

Globally unique and static member ID.

property profile: str

Optional member profile (IPFS Multihash string).

property recovery_algo: numpy.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 registered: int

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

property username: str

//xbr.network)

Type:

XBR Network username (must be globally unique on https

property wallet_address: bytes

Public address of user crypto wallet in use.

property wallet_type: int

Type of (primary) user crypto wallet in use.

class AccountLevel[source]

Bases: object

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

Bases: zlmdb.MapUuidFlatBuffers

Database table for XBR member accounts.

static parse(data)[source]
Parameters:

data

Returns:

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

Bases: zlmdb.MapStringUuid

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

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

Bases: zlmdb.MapStringUuid

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

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

Bases: zlmdb.MapBytes20Uuid

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

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

Bases: zlmdb.MapUuidTimestampBytes32

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

class Schema(db)[source]

Bases: object

XBR Network backend database schema.

EXPORTED = None
accounts: cfxdb.xbrnetwork.account.Accounts

Member accounts database table xbrnetwork.Accounts.

static attach(db)[source]

Attach database schema to database instance.

Parameters:

db (zlmdb.Database) – Database to attach schema to.

db
export(txn, fd)[source]
Parameters:
  • txn

  • fd

Returns:

idx_accounts_by_email: cfxdb.xbrnetwork.account.IndexAccountsByEmail

Index “by email” of member accounts xbrnetwork.IndexAccountsByEmail.

idx_accounts_by_username: cfxdb.xbrnetwork.account.IndexAccountsByUsername

Index “by username” of member accounts xbrnetwork.IndexAccountsByUsername.

idx_accounts_by_wallet: cfxdb.xbrnetwork.account.IndexAccountsByWallet

Index “by wallet” of member accounts xbrnetwork.IndexAccountsByWallet.

idx_user_key_by_account: cfxdb.xbrnetwork.userkey.IndexUserKeyByAccount

Index “by pubkey” of user keys xbrnetwork.IndexUserKeyByAccount.

user_keys: cfxdb.xbrnetwork.userkey.UserKeys

User client keys database table xbrnetwork.UserKeys.

verified_actions: cfxdb.xbrnetwork.vaction.VerifiedActions

Verified actions database table xbrnetwork.VerifiedActions.

class UserKey(from_fbs=None)[source]

Bases: object

User client (public) keys.

__str__()[source]
_created = None
_from_fbs = None
_owner = None
_pubkey = None
build(builder)[source]
static cast(buf)[source]
property created: numpy.datetime64

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

marshal()[source]
property owner: uuid.UUID

ID of user account this user key is owned by.

property pubkey: bytes

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

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

Bases: zlmdb.MapBytes32FlatBuffers

Database table for user client keys.

static parse(data)[source]
Parameters:

data

Returns:

class VerificationStatus[source]

Bases: object

EXPIRED = 4
FAILED = 3
NONE = 0
PENDING = 1
VERIFIED = 2
class VerificationType[source]

Bases: object

MEMBER_CREATEMARKET_EMAIL = 3
MEMBER_JOINMARKET_EMAIL = 4
MEMBER_LOGIN_EMAIL = 2
MEMBER_ONBOARD_EMAIL = 1
NONE = 0
class 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_STATUS

All valid verification status codes.

VERIFICATION_STATUS_EXPIRED = 4

Action cannot be verified any longer since it has expired.

VERIFICATION_STATUS_FAILED = 3

Verification has failed.

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_TYPE

All valid verification action types.

VERIFICATION_TYPE_CREATE_CATALOG = 5

Verification action type for creation of a catalog 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_LOGIN_MEMBER = 2

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

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_PUBLISH_API = 5

Verification action type for publishing on API via email verification.

__str__()[source]
_created = None
_from_fbs = None
_oid = None
_vcode = None
_verified_data = None
_verified_oid = None
_vstatus = None
_vtype = None
build(builder)[source]
static cast(buf)[source]
property created: numpy.datetime64

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

marshal()[source]
property oid: uuid.UUID

Globally unique and static ID of action.

property vcode: str

Verification code sent.

property verified_data: dict

Action data, serialized in CBOR.

property verified_oid: uuid.UUID

ID of object of verified action.

property vstatus: int

Verification type.

property vtype: int

Verification type.

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

Bases: zlmdb.MapUuidFlatBuffers

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

static parse(data)[source]
Parameters:

data

Returns:

class WalletType[source]

Bases: object

HOSTED = 3
IMPORTED = 1
METAMASK = 2
NONE = 0