graphenecommon.chain module

class graphenecommon.chain.AbstractGrapheneChain(node='', rpcuser='', rpcpassword='', debug=False, **kwargs)

Bases: object

broadcast(tx=None)

Broadcast a transaction to the Blockchain

Parameters:tx (tx) – Signed transaction to broadcast
clear()
clear_cache()

Clear Caches

connect(node='', rpcuser='', rpcpassword='', **kwargs)

Connect to blockchain network (internal use only)

define_classes()
finalizeOp(ops, account, permission, **kwargs)

This method obtains the required private keys if present in the wallet, finalizes the transaction, signs it and broadacasts it

Parameters:
  • ops (operation) – The operation (or list of operaions) to broadcast
  • account (operation) – The account that authorizes the operation
  • permission (string) – The required permission for signing (active, owner, posting)
  • append_to (object) – This allows to provide an instance of ProposalsBuilder (see new_proposal()) or TransactionBuilder (see new_tx()) to specify where to put a specific operation.
… note:: append_to is exposed to every method used in the
this class

… note:

If ``ops`` is a list of operation, they all need to be
signable by the same key! Thus, you cannot combine ops
that require active permission with ops that require
posting permission. Neither can you use different
accounts for different operations!
… note:: This uses txbuffer as instance of
transactionbuilder.TransactionBuilder. You may want to use your own txbuffer
info()

Returns the global properties

is_connected()
newWallet(pwd)
new_proposal(parent=None, proposer=None, proposal_expiration=None, proposal_review=None, **kwargs)
new_tx(*args, **kwargs)

Let’s obtain a new txbuffer

Returns int txid:
 id of the new txbuffer
new_wallet(pwd)

Create a new wallet. This method is basically only calls wallet.Wallet.create().

Parameters:pwd (str) – Password to use for the new wallet
Raises:exceptions.WalletExists – if there is already a wallet created
prefix

Contains the prefix of the blockchain

propbuffer

Return the default proposal buffer

proposal(proposer=None, proposal_expiration=None, proposal_review=None)

Return the default proposal buffer

… note:: If any parameter is set, the default proposal
parameters will be changed!
set_blocking(block=True)

This sets a flag that forces the broadcast to block until the transactions made it into a block

set_default_account(account)

Set the default account to be used

set_shared_config(config)

This allows to set a config that will be used when calling shared_blockchain_instance and allows to define the configuration without requiring to actually create an instance

set_shared_instance()

This method allows to set the current instance as default

sign(tx=None, wifs=[])

Sign a provided transaction witht he provided key(s)

Parameters:
  • tx (dict) – The transaction to be signed and returned
  • wifs (string) – One or many wif keys to use for signing a transaction. If not present, the keys will be loaded from the wallet as defined in “missing_signatures” key of the transactions.
tx()

Returns the default transaction buffer

txbuffer

Returns the currently active tx buffer

unlock(*args, **kwargs)

Unlock the internal wallet