Transaction Builder

To build your own transactions and sign them

from peerplays.transactionbuilder import TransactionBuilder
from peerplaysbase.operations import Transfer
tx = TransactionBuilder()
         "fee": {"amount": 0, "asset_id": "1.3.0"},  # will be filled in automatically
         "from": "1.2.124",
         "to": "1.2.1241",
         "amount": {"amount": 10000, "asset_id": "1.3.0"},
tx.appendSigner("xeroc", "active")
class peerplays.transactionbuilder.ProposalBuilder(proposer, proposal_expiration=None, proposal_review=None, parent=None, *args, **kwargs)

Proposal Builder allows us to construct an independent Proposal that may later be added to an instance ot TransactionBuilder

  • proposer (str) – Account name of the proposing user
  • proposal_expiration (int) – Number seconds until the proposal is supposed to expire
  • proposal_review (int) – Number of seconds for review of the proposal
  • transactionbuilder.TransactionBuilder – Specify your own instance of transaction builder (optional)
  • blockchain_instance (instance) – Blockchain instance
appendOps(ops, append_to=None)

Append op(s) to the transaction builder

Parameters:ops (list) – One or a list of operations

This allows to referr to the actual parent of the Proposal


Returns an instance of base “Operations” for further processing


Return the json formated version of this proposal

class peerplays.transactionbuilder.TransactionBuilder(tx={}, proposer=None, **kwargs)

This class simplifies the creation of transactions by adding operations and signers.

addSigningInformation(account, permission)

This is a private method that adds side information to a unsigned/partial transaction in order to simplify later signing (e.g. for multisig or coldstorage)

FIXME: Does not work with owner keys!


Store which accounts/keys are supposed to sign the transaction

This method is used for an offline-signer!

appendOps(ops, append_to=None)

Append op(s) to the transaction builder

Parameters:ops (list) – One or a list of operations
appendSigner(account, permission)

Try to obtain the wif key from the wallet by telling which account and permission is supposed to sign the transaction


Add a wif that should be used for signing of the transaction.


Broadcast a transaction to the blockchain network

Parameters:tx (tx) – Signed transaction to broadcast

Clear the transaction builder and start from scratch


Construct the actual transaction and store it in the class’s dict store


TransactionBuilders don’t have parents, they are their own parent


Show the transaction as plain json


Set asset to fee


Sign a provided transaction with the provided key(s)

  • 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.

Verify the authority of the signed transaction