def test_witness_update(self): op = operations.WitnessUpdate( **{ "owner": "xeroc", "url": "foooobar", "block_signing_key": "STM6zLNtyFVToBsBZDsgMhgjpwysYVbsQD6YhP3kRkQhANUB4w7Qp", "props": { "account_creation_fee": "10.000 STEEM", "maximum_block_size": 1111111, "sbd_interest_rate": 1000 }, "fee": "10.000 STEEM", }) 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_wire = hexlify(bytes(tx)).decode("ascii") compare = ("f68585abf4dce7c80457010b057865726f6308666f6f6f6f6261" "720314aa202c9158990b3ec51a1aa49b2ab5d300c97b391df3be" "b34bb74f3c62699e102700000000000003535445454d000047f4" "1000e803102700000000000003535445454d00000001206adca4" "bebc872e8d792caeb3b729e9a5e8af90c07ab3f744fb4d0f19d5" "7b3bec32f5a43f5acdfc065f0227e45e599745c46e41c023d69f" "b9f2405478badadb4c") self.assertEqual(compare[:-130], tx_wire[:-130])
def update_witness(): with open("config_update_witness.json", 'r') as load_f: input_args = json.load(load_f) for i in range(len(input_args)): args = input_args[i] key = args['key'] update_account_object = args['update_witness'] account_name = update_account_object['owner'] steem = Steem(nodes=nodes_remote, keys=key) # now we can construct the transaction # we will set no_broadcast to True because # we don't want to really send funds, just testing. tb = TransactionBuilder() # lets serialize our transfers into a format Steem can understand operationsList = [] operationsList.append( operations.WitnessUpdate(**update_account_object)) # tell TransactionBuilder to use our serialized transfers tb.appendOps(operationsList) # we need to tell TransactionBuilder about # everyone who needs to sign the transaction. # since all payments are made from `richguy`, # we just need to do this once tb.appendSigner(account_name, 'owner') # sign the transaction tb.sign() # broadcast the transaction (publish to steem) # since we specified no_broadcast=True earlier # this method won't actually do anything tx = tb.broadcast() print(account_name + " done")
def witness_update(self, signing_key, url, props, account=None): """ Update witness :param pubkey signing_key: Signing key :param str url: URL :param dict props: Properties :param str account: (optional) witness account name Properties::: { "account_creation_fee": x, "maximum_block_size": x, } """ if not account: account = configStorage.get("default_account") if not account: raise ValueError("You need to provide an account") try: PublicKey(signing_key) except Exception as e: raise e op = operations.WitnessUpdate( **{ "owner": account, "url": url, "block_signing_key": signing_key, "props": props, "fee": "0.000 STEEM", "prefix": self.steemd.chain_params["prefix"] }) return self.finalizeOp(op, account, "active")