The coins_client module

coins_client.convert_to_builtin_type(obj)

serialization using JSON (see http://pymotw.com/2/json/) transforms a python object into a JSON object

coins_client.dict_to_object(d)

serialization using JSON (see http://pymotw.com/2/json/) transforms a JSON object into a Python object

coins_client.get_newblock(pubkey)

Get a new block from server

Parameters:pubkey (coins.PublicKey) – public key of party the reward should be assigned to
Returns:a new block
Return type:coins.Block
coins_client.get_wallet(pubkey)

Get wallet (i.e. all the unspent transactions) from server

Parameters:pubkey (coins.PublicKey) – public key of party
Returns:the wallet (a list of transaction hash, output number, amount)
coins_client.post_newblock(b)

Post a new block to the server

Parameters:b (coins.Block) – a new block
Returns:success,msg. success is True if the block was added successfully to the blockchain. If success is False, the msg is set to the error encountered by the server
Return type:(bool,str)
coins_client.post_tx(tx, stx)

Post a transaction to the server

Parameters:
  • tx (coins.Transaction) – the transaction to be sent
  • stx (int) – the signature for the transaction
Returns:

success,msg. success is True if the transaction was added successfully to the list of pending transactions. If success is False, the msg is set to the error encountered by the server

Return type:

(bool,str)