def test_Vote(self): op = operations.Vote( **{ "voter": "foobara", "author": "foobarc", "permlink": "foobard", "weight": 1000 }) ops = [operations.Operation(op)] tx = SignedTransaction( ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) tx = tx.sign([wif], chain=self.steem.chain_params) tx.verify([PrivateKey(wif).pubkey], chain=self.steem.chain_params) tx_wire = hexlify(compat_bytes(tx)).decode("ascii") compare = ("f68585abf4dce7c80457010007666f6f6261726107666f6f62617263" "07666f6f62617264e8030001202e09123f732a438ef6d6138484d7ad" "edfdcf4a4f3d171f7fcafe836efa2a3c8877290bd34c67eded824ac0" "cc39e33d154d0617f64af936a83c442f62aef08fec") self.assertEqual(compare[:-130], tx_wire[:-130])
def test_Vote(self): op = operations.Vote( **{ "voter": "foobara", "author": "foobarc", "permlink": "foobard", "weight": 1000 }) ops = [operations.Operation(op)] tx = SignedTransaction(ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) tx = tx.sign([wif], chain=self.steem.chain_params) tx.verify([PrivateKey(wif).pubkey], chain=self.steem.chain_params) tx_wire = hexlify(bytes(tx)).decode("ascii") compare = ("f68585abf4dce7c80457010007666f6f6261726107666f6f62617263" "07666f6f62617264e8030001202e09123f732a438ef6d6138484d7ad" "edfdcf4a4f3d171f7fcafe836efa2a3c8877290bd34c67eded824ac0" "cc39e33d154d0617f64af936a83c442f62aef08fec") self.assertEqual(compare[:-130], tx_wire[:-130])
def get_public_keys(self, transaction_data): """ Extract public keys from the transaction signatures. :param transaction_data: The transaction data to extract the keys from. :return: List of public keys used to sign a the transaction. """ # creates a signed transaction instance. transaction = SignedTransaction(transaction_data) # start a public keys array. public_keys = [] # find all public keys matching the transaction signatures. for key in transaction.verify(chain=self.chain): # convert each key to Base58, with the current chain prefix (STM) public_keys.append(self.key_prefix + str(Base58(data=key))) # finally return the list of public keys. return public_keys