Exemple #1
0
    def test_transfer_2of2_serialized_deserialized(self):
        # Send a 2 of 2 transaction from beem5 which needs beem4's cosign to send
        # funds but sign the transaction with beem5's key and then serialize the transaction
        # and deserialize the transaction.  After that, sign with beem4's key.
        steem = self.bts
        steem.nobroadcast = False
        steem.wallet.unlock("123")
        # steem.wallet.removeAccount("beem4")
        steem.wallet.removePrivateKeyFromPublicKey(str(PublicKey(self.active_private_key_of_beem4, prefix=core_unit)))

        tx = TransactionBuilder(use_condenser_api=True, steem_instance=steem)
        tx.appendOps(Transfer(**{"from": 'beem5',
                                 "to": 'beem1',
                                 "amount": Amount("0.01 STEEM", steem_instance=steem),
                                 "memo": '2 of 2 serialized/deserialized transaction'}))

        tx.appendSigner("beem5", "active")
        tx.addSigningInformation("beem5", "active")
        tx.sign()
        tx.clearWifs()
        self.assertEqual(len(tx['signatures']), 1)
        # steem.wallet.removeAccount("beem5")
        steem.wallet.removePrivateKeyFromPublicKey(str(PublicKey(self.active_private_key_of_beem5, prefix=core_unit)))
        tx_json = tx.json()
        del tx
        new_tx = TransactionBuilder(tx=tx_json, steem_instance=steem)
        self.assertEqual(len(new_tx['signatures']), 1)
        steem.wallet.addPrivateKey(self.active_private_key_of_beem4)
        new_tx.appendMissingSignatures()
        new_tx.sign(reconstruct_tx=False)
        self.assertEqual(len(new_tx['signatures']), 2)
        new_tx.broadcast()
        steem.nobroadcast = True
Exemple #2
0
    def test_transfer_2of2_serialized_deserialized(self):
        # Send a 2 of 2 transaction from elf which needs steemfiles's cosign to send
        # funds but sign the transaction with elf's key and then serialize the transaction
        # and deserialize the transaction.  After that, sign with steemfiles's key.
        steem = self.bts
        steem.nobroadcast = False
        steem.wallet.unlock("123")
        steem.wallet.removeAccount("steemfiles")

        tx = TransactionBuilder(steem_instance=steem)
        tx.appendOps(
            Transfer(
                **{
                    "from": 'elf',
                    "to": 'leprechaun',
                    "amount": '0.01 SBD',
                    "memo": '2 of 2 serialized/deserialized transaction'
                }))

        tx.appendSigner("elf", "active")
        tx.addSigningInformation("elf", "active")
        tx.sign()
        tx.clearWifs()
        self.assertEqual(len(tx['signatures']), 1)
        steem.wallet.removeAccount("elf")
        tx_json = tx.json()
        del tx
        new_tx = TransactionBuilder(tx=tx_json, steem_instance=steem)
        self.assertEqual(len(new_tx['signatures']), 1)
        steem.wallet.addPrivateKey(self.active_private_key_of_steemfiles)
        new_tx.appendMissingSignatures()
        new_tx.sign(reconstruct_tx=False)
        self.assertEqual(len(new_tx['signatures']), 2)
        new_tx.broadcast()
        steem.nobroadcast = True
Exemple #3
0
    def test_transfer_2of2_wif(self):
        # Send a 2 of 2 transaction from elf which needs steemfiles's cosign to send
        # funds but sign the transaction with elf's key and then serialize the transaction
        # and deserialize the transaction.  After that, sign with steemfiles's key.
        steem = Steem(node=["wss://testnet.steem.vc"],
                      num_retries=10,
                      keys=[self.active_private_key_of_elf])

        tx = TransactionBuilder(steem_instance=steem)
        tx.appendOps(
            Transfer(
                **{
                    "from": 'elf',
                    "to": 'leprechaun',
                    "amount": '0.01 SBD',
                    "memo": '2 of 2 serialized/deserialized transaction'
                }))

        tx.appendSigner("elf", "active")
        tx.addSigningInformation("elf", "active")
        tx.sign()
        tx.clearWifs()
        self.assertEqual(len(tx['signatures']), 1)
        tx_json = tx.json()
        del steem
        del tx

        steem = Steem(node=["wss://testnet.steem.vc"],
                      num_retries=10,
                      keys=[self.active_private_key_of_steemfiles])
        new_tx = TransactionBuilder(tx=tx_json, steem_instance=steem)
        new_tx.appendMissingSignatures()
        new_tx.sign(reconstruct_tx=False)
        self.assertEqual(len(new_tx['signatures']), 2)
        new_tx.broadcast()
Exemple #4
0
    def test_transfer_2of2_offline(self):
        # Send a 2 of 2 transaction from beem5 which needs beem4's cosign to send
        # funds but sign the transaction with beem5's key and then serialize the transaction
        # and deserialize the transaction.  After that, sign with beem4's key.
        steem = self.bts
        steem.nobroadcast = False
        steem.wallet.unlock("123")
        steem.wallet.removeAccount("beem4")

        tx = TransactionBuilder(steem_instance=steem)
        tx.appendOps(
            Transfer(
                **{
                    "from": 'beem5',
                    "to": 'beem',
                    "amount": '0.01 SBD',
                    "memo": '2 of 2 serialized/deserialized transaction'
                }))

        tx.appendSigner("beem5", "active")
        tx.addSigningInformation("beem5", "active")
        tx.sign()
        tx.clearWifs()
        self.assertEqual(len(tx['signatures']), 1)
        steem.wallet.removeAccount("beem5")
        steem.wallet.addPrivateKey(self.active_private_key_of_beem4)
        tx.appendMissingSignatures()
        tx.sign(reconstruct_tx=False)
        self.assertEqual(len(tx['signatures']), 2)
        tx.broadcast()
        steem.nobroadcast = True
        steem.wallet.addPrivateKey(self.active_private_key_of_beem5)
Exemple #5
0
def request_recovery(account):
    """ Request the recovery of ACCOUNT. This action has to be
    initiated/signed by the recovery partner of ACCOUNT.

    """
    acc = Account(account)
    if acc.get_owner_history() == []:
        logger.error("The owner key of @%s was not changed within "
                     "the last 30 days - recovering this account is "
                     "not possible!" % (acc['name']))
        return

    # Ask and verify the new pubkey for the to-be-recovered account
    new_owner_key = input("Enter new PUBLIC owner key for @%s: " %
                          (acc['name']))
    # PublicKey call to make sure it is a valid public key
    pk_validity_check = PublicKey(new_owner_key, prefix=acc.steem.prefix)
    if format(pk_validity_check, acc.steem.prefix) != new_owner_key:
        raise ValueError("Invalid public owner key!")

    # Ask and verify the active key of the recovery account
    recovery_ak = getpass("Enter active key, owner key or master "
                          "password for @%s: " % (acc['recovery_account']))
    recovery_ak = passwordkey_to_key(recovery_ak,
                                     acc['recovery_account'],
                                     "active",
                                     prefix=acc.steem.prefix)

    # Assemble the account recovery request operation
    new_owner_authority = {
        'key_auths': [[new_owner_key, 1]],
        'account_auths': [],
        'weight_threshold': 1,
        'prefix': acc.steem.prefix
    }
    op = operations.Request_account_recovery(
        **{
            'account_to_recover': acc['name'],
            'recovery_account': acc['recovery_account'],
            'new_owner_authority': new_owner_authority,
            'extensions': [],
            'prefix': acc.steem.prefix
        })

    # Send the operation to the blockchain
    tb = TransactionBuilder(steem_instance=acc.steem)
    tb.appendOps([op])
    tb.appendWif(recovery_ak)
    tb.sign()
    tb.broadcast()
    logger.info("@%s requested account recovery for @%s:" %
                (acc['recovery_account'], acc['name']))
Exemple #6
0
    def test_Transfer_broadcast(self):
        nodelist = NodeList()
        stm = Steem(node=self.nodes,
                    keys=[self.active_key],
                    nobroadcast=True,
                    expiration=120,
                    num_retries=10)

        tx = TransactionBuilder(use_condenser_api=True, expiration=10, steem_instance=stm)
        tx.appendOps(Transfer(**{"from": "beem",
                                 "to": "beem1",
                                 "amount": Amount("1 STEEM", steem_instance=stm),
                                 "memo": ""}))
        tx.appendSigner("beem", "active")
        tx.sign()
        tx.broadcast()
Exemple #7
0
 def check_post(self):
     com = dict()
     com = {
         'parent_author': '',
         'parent_permlink': 'steem',
         'author': 'me',
         'permlink': 'testpost',
         'title': 'testpost pls ignore',
         'body': 'do not upvote',
         'json_metadata': {
             'tags': ('test', 'post', 'pls', 'ignore', 'steem'),
         }
     }
     print(len(com['body']))
     tx = TransactionBuilder(steem_instance=self.stm)
     tx.appendOps(Comment(com))
     tx.appendSigner("petertag", "active")
     signed_tx = tx.sign()
     sz = getsizeof(com)
     pprint(com)
     pprint(signed_tx)
     print("Size is %i" % sz)
     self.compute_cost(type=1,
                       tx_size=sz,
                       perm_len=len(com['permlink']),
                       pperm_len=len(com['parent_permlink']))
     broadcast_tx = tx.broadcast()
     pprint(broadcast_tx)
Exemple #8
0
 def test_Transfer_broadcast_appbase(self):
     stm = Steem(node=get_node_list(appbase=True),
                 keys=[wif],
                 num_retries=10)
     tx = TransactionBuilder(expiration=10, steem_instance=stm)
     tx.appendOps(
         Transfer(
             **{
                 "from": "test",
                 "to": "test1",
                 "amount": Amount("1 STEEM", steem_instance=stm),
                 "memo": ""
             }))
     tx.appendSigner("test", "active")
     tx.sign()
     with self.assertRaises(exceptions.MissingRequiredActiveAuthority):
         tx.broadcast()
Exemple #9
0
    def test_transfer_2of2_simple(self):
        # Send a 2 of 2 transaction from elf which needs beem4's cosign to send funds
        steem = self.bts
        steem.nobroadcast = False
        tx = TransactionBuilder(use_condenser_api=True, steem_instance=steem)
        tx.appendOps(Transfer(**{"from": 'beem5',
                                 "to": 'beem1',
                                 "amount": Amount("0.01 STEEM", steem_instance=steem),
                                 "memo": '2 of 2 simple transaction'}))

        tx.appendWif(self.active_private_key_of_beem5)
        tx.sign()
        tx.clearWifs()
        tx.appendWif(self.active_private_key_of_beem4)
        tx.sign(reconstruct_tx=False)
        self.assertEqual(len(tx['signatures']), 2)
        tx.broadcast()
        steem.nobroadcast = True
Exemple #10
0
 def test_transfer_1of1(self):
     steem = self.bts
     steem.nobroadcast = False
     tx = TransactionBuilder(use_condenser_api=True, steem_instance=steem)
     tx.appendOps(Transfer(**{"from": 'beem',
                              "to": 'beem1',
                              "amount": Amount("0.01 STEEM", steem_instance=steem),
                              "memo": '1 of 1 transaction'}))
     self.assertEqual(
         tx["operations"][0]["type"],
         "transfer_operation"
     )
     tx.appendWif(self.active_key)
     tx.sign()
     tx.sign()
     self.assertEqual(len(tx['signatures']), 1)
     tx.broadcast()
     steem.nobroadcast = True
Exemple #11
0
    def test_transfer_2of2_wallet(self):
        # Send a 2 of 2 transaction from beem5 which needs beem4's cosign to send
        # priv key of beem5 and beem4 are stored in the wallet
        # appendSigner fetches both keys and signs automatically with both keys.
        steem = self.bts
        steem.nobroadcast = False
        steem.wallet.unlock("123")

        tx = TransactionBuilder(use_condenser_api=True, steem_instance=steem)
        tx.appendOps(Transfer(**{"from": 'beem5',
                                 "to": 'beem1',
                                 "amount": Amount("0.01 STEEM", steem_instance=steem),
                                 "memo": '2 of 2 serialized/deserialized transaction'}))

        tx.appendSigner("beem5", "active")
        tx.sign()
        self.assertEqual(len(tx['signatures']), 2)
        tx.broadcast()
        steem.nobroadcast = True
Exemple #12
0
 def test_transfer_1of1(self):
     steem = self.bts
     steem.nobroadcast = False
     tx = TransactionBuilder(steem_instance=steem)
     tx.appendOps(
         Transfer(
             **{
                 "from": 'beem',
                 "to": 'leprechaun',
                 "amount": '0.01 SBD',
                 "memo": '1 of 1 transaction'
             }))
     self.assertEqual(tx["operations"][0][0], "transfer")
     tx.appendWif(self.active_key)
     tx.sign()
     tx.sign()
     self.assertEqual(len(tx['signatures']), 1)
     tx.broadcast()
     steem.nobroadcast = True
Exemple #13
0
    def test_transfer_2of2_wif(self):
        nodelist = NodeList()
        # Send a 2 of 2 transaction from elf which needs beem4's cosign to send
        # funds but sign the transaction with elf's key and then serialize the transaction
        # and deserialize the transaction.  After that, sign with beem4's key.
        steem = Steem(
            node=self.nodes,
            num_retries=10,
            keys=[self.active_private_key_of_beem5],
            expiration=360,
        )

        tx = TransactionBuilder(use_condenser_api=True, steem_instance=steem)
        tx.appendOps(
            Transfer(
                **{
                    "from": 'beem5',
                    "to": 'beem',
                    "amount": Amount("0.01 STEEM", steem_instance=steem),
                    "memo": '2 of 2 serialized/deserialized transaction'
                }))

        tx.appendSigner("beem5", "active")
        tx.addSigningInformation("beem5", "active")
        tx.sign()
        tx.clearWifs()
        self.assertEqual(len(tx['signatures']), 1)
        tx_json = tx.json()
        del steem
        del tx

        steem = Steem(
            node=self.nodes,
            num_retries=10,
            keys=[self.active_private_key_of_beem4],
            expiration=360,
        )
        new_tx = TransactionBuilder(tx=tx_json, steem_instance=steem)
        new_tx.appendMissingSignatures()
        new_tx.sign(reconstruct_tx=False)
        self.assertEqual(len(new_tx['signatures']), 2)
        new_tx.broadcast()
Exemple #14
0
    def test_transfer_2of2_simple(self):
        # Send a 2 of 2 transaction from elf which needs steemfiles's cosign to send funds
        steem = self.bts
        steem.nobroadcast = False
        tx = TransactionBuilder(steem_instance=steem)
        tx.appendOps(
            Transfer(
                **{
                    "from": 'elf',
                    "to": 'leprechaun',
                    "amount": '0.01 SBD',
                    "memo": '2 of 2 simple transaction'
                }))

        tx.appendWif(self.active_private_key_of_elf)
        tx.sign()
        tx.clearWifs()
        tx.appendWif(self.active_private_key_of_steemfiles)
        tx.sign(reconstruct_tx=False)
        self.assertEqual(len(tx['signatures']), 2)
        tx.broadcast()
        steem.nobroadcast = True
Exemple #15
0
def test_post(wls):
    op1 = operations.Social_action(
        **{
            "account": "guest123",
            "social_action_comment_create": {
                "permlink": 'just-a-test-post',
                "parent_author": "",
                "parent_permlink": "test",
                "title": "just a test post",
                "body": "test post body",
                "json_metadata": '{"app":"wls_python"}'
            }
        })

    op2 = operations.Social_action(
        **{
            "account": "guest123",
            "social_action_comment_update": {
                "permlink": 'just-a-test-post',
                "title": "just a test post",
                "body": "test post body",
            }
        })

    op3 = operations.Vote(
        **{
            'voter': 'guest123',
            'author': 'wlsuser',
            'permlink': 'another-test-post',
            'weight': 10000,
        })

    privateWif = "5K..."
    tx = TransactionBuilder(use_condenser_api=True, steem_instance=wls)
    tx.appendOps(op1)
    tx.appendWif(privateWif)
    tx.sign()
    tx.broadcast()
Exemple #16
0
    def test_transfer_2of2_wallet(self):
        # Send a 2 of 2 transaction from elf which needs steemfiles's cosign to send
        # priv key of elf and steemfiles are stored in the wallet
        # appendSigner fetches both keys and signs automatically with both keys.
        steem = self.bts
        steem.nobroadcast = False
        steem.wallet.unlock("123")

        tx = TransactionBuilder(steem_instance=steem)
        tx.appendOps(
            Transfer(
                **{
                    "from": 'elf',
                    "to": 'leprechaun',
                    "amount": '0.01 SBD',
                    "memo": '2 of 2 serialized/deserialized transaction'
                }))

        tx.appendSigner("elf", "active")
        tx.sign()
        self.assertEqual(len(tx['signatures']), 2)
        tx.broadcast()
        steem.nobroadcast = True
Exemple #17
0
            'account_auths': acc['posting']['account_auths'],
            'key_auths': [[key_auths_public['posting'], 1]],
            "address_auths": [],
            'weight_threshold': 1
        },
        'memo_key': key_auths_public['memo'],
        "json_metadata": acc['json_metadata'],
        "prefix": prefix,
    })

ops = [op]
tb = TransactionBuilder()
tb.appendOps(ops)
tb.appendWif(wif)
tb.sign()
output = tb.broadcast()

data = {
    "name":
    acc['name'],
    "wif":
    new_password,
    "owner": [{
        "type": "public",
        "value": key_auths_public["owner"]
    }, {
        "type": "private",
        "value": key_auths_private["owner"]
    }],
    "active": [{
        "type": "public",
Exemple #18
0
 print("broadcast voter %s votes %s" % (vote["voter"], vote["authorperm"]))
 author, permlink = resolve_authorperm(vote["authorperm"])
 op = operations.Vote(**{"voter": vote["voter"],
                         "author": author,
                         "permlink": permlink,
                         "weight": int(vote["weight"] * 100)})
 ops.append(op)      
 broadcasted_votes.append(vote)
 if len(ops) > 5:
     try:
         print("Broadcasting %d votes" % len(ops))
         tx.appendOps(ops)
         # tx.appendMissingSignatures()
         tx.appendSigner("rewarding", "posting")
         tx.sign()
         reply_message = tx.broadcast()
         # print(reply_message)
         ops = []
         #if vote["trail_vote"]:
         #    print("trail voter %s votes %s" % (vote["voter"], vote["authorperm"]))
         #else:
         #    print("voter %s votes %s after %.2f min (%.2f min)" % (vote["voter"], vote["authorperm"], age_min, vote["vote_delay_min"]))
         # reply_message = stm.vote(vote["weight"], vote["authorperm"], vote["voter"])
         # vote_count += 1
         expiration = formatTimeString(reply_message["expiration"]).replace(tzinfo=None)
     except Exception as e:
         expiration = datetime.utcnow()
         print("Vote failed: %s" % str(e))
         for vote in broadcasted_votes:
             try:
                 reply_message = stm.vote(vote["weight"], vote["authorperm"], vote["voter"])
s = Steem(node=['https://api.steemit.com'],
          keys=[recovery_account_private_key])

op_recover_account = beembase.operations.Recover_account(
    **op_recover_account_data)

print('op_recover_account')
print(op_recover_account)

tb = TransactionBuilder()
tb.appendOps([op_recover_account])
tb.appendWif(str(old_account_owner_private_key))
tb.appendWif(str(new_account_owner_private_key))
tb.sign()

result = tb.broadcast()
print('result')
print(result)

#update account keys initialisation and transmission
s = Steem(node=['https://api.steemit.com'],
          keys=[new_account_owner_private_key])

op_account_update = beembase.operations.Account_update(
    **op_account_update_data)

print('op_account_update')
print(op_account_update)

tb = TransactionBuilder()
tb.appendOps([op_account_update])
                tx = TransactionBuilder(hive_instance=node_client)
                ops = []
                op = operations.Comment_options(**{
                    'author' : accounts[0]['name'],
                    'permlink' : "hivepy-proposal-title-{}".format(accounts[0]['name']),
                    'max_accepted_payout' : '1000.000 TBD',
                    'percent_steem_dollars' : 5000,
                    'allow_votes' : True,
                    'allow_curation_rewards' : True,
                    'prefix': node_client.prefix
                })
                ops.append(op)
                tx.appendOps(ops)
                tx.appendWif(accounts[0]['private_key'])
                tx.sign()
                tx.broadcast()
                logger.exception( "Expected exception for old style op was not thrown" )
            except Exception as ex:
                if  str(ex) == "Assert Exception:false: Obsolete form of transaction detected, update your wallet.":
                    logger.info("Expected exception on old style op: {}".format(ex))
                    exit_code = 0
                else:
                    logger.info("Unexpected exception on old style op: {}".format(ex))

            hive_utils.common.wait_n_blocks(node_client.rpc.url, 5)

            # use hybrid op with new keys
            logger.info("Using hybrid op with new keys")
            try:
                tx = TransactionBuilder(hive_instance=node_client)
                ops = []
Exemple #21
0
def recover_account(account):
    """Recover ACCOUNT. This action has to be initiated/signed by the
    account to be recovered.

    """
    acc = Account(account)

    if acc.get_owner_history() == []:
        logger.error("@%s has an empty owner history - recovering "
                     "this account is not possible!" % (acc['name']))
        return

    # ask & verify the old owner key
    old_priv_owner_key = getpass("Enter the old master password or owner "
                                 "key for @%s: " % (acc['name']))
    old_pk = passwordkey_to_key(old_priv_owner_key,
                                acc['name'],
                                role="owner",
                                prefix=acc.steem.prefix)
    old_public_owner_key = format(old_pk.get_public(), acc.steem.prefix)

    # get the new password to prepare all new keys
    new_pwd = getpass("Enter the new master password for @%s: " %
                      (acc['name']))
    key_auths = {}
    for role in ['owner', 'active', 'posting', 'memo']:
        pk = PasswordKey(acc['name'], new_pwd, role=role)
        key_auths[role] = format(pk.get_public_key(), acc.steem.prefix)
        if role == 'owner':
            new_priv_owner_key = str(pk.get_private())

    # Assemble the account recovery operation
    recent_owner_authority = {
        "key_auths": [[old_public_owner_key, 1]],
        "account_auths": [],
        "weight_threshold": 1,
        "prefix": acc.steem.prefix
    }
    new_owner_authority = {
        "key_auths": [[key_auths['owner'], 1]],
        "account_auths": [],
        "weight_threshold": 1,
        "prefix": acc.steem.prefix
    }
    op = operations.Recover_account(
        **{
            'account_to_recover': acc['name'],
            'new_owner_authority': new_owner_authority,
            'recent_owner_authority': recent_owner_authority,
            'extensions': [],
            "prefix": acc.steem.prefix
        })

    # Send the recovery operations to the blockchain
    tb = TransactionBuilder(steem_instance=acc.steem)
    tb.appendOps([op])
    tb.appendWif(new_priv_owner_key)
    tb.appendWif(old_priv_owner_key)
    tb.sign()
    tb.broadcast()
    logger.info("@%s recovered." % (acc['name']))

    # Assemble the account update operation
    op = operations.Account_update(
        **{
            "account": acc["name"],
            'active': {
                'account_auths': [],
                'key_auths': [[key_auths['active'], 1]],
                "address_auths": [],
                'weight_threshold': 1,
                'prefix': acc.steem.prefix
            },
            'posting': {
                'account_auths': acc['posting']['account_auths'],
                'key_auths': [[key_auths['posting'], 1]],
                "address_auths": [],
                'weight_threshold': 1,
                'prefix': acc.steem.prefix
            },
            'memo_key': key_auths['memo'],
            "json_metadata": acc['json_metadata'],
            "prefix": acc.steem.prefix
        })

    # Send the recovery operations to the blockchain
    tb = TransactionBuilder(steem_instance=acc.steem)
    tb.appendOps([op])
    tb.appendWif(new_priv_owner_key)
    tb.sign()
    tb.broadcast()
    logger.info("SUCCESS: @%s's active, posting and memo keys updated." %
                (acc['name']))
Exemple #22
0
    # Make transaction and broadcast:
    tx = TransactionBuilder(blockchain_instance=hive)
    tx.appendOps(
        Vote(
            **{
                "voter": account,
                "author": h.author,
                "permlink": h.permlink,
                "weight": int(float(weight) * 100)
            }))

    tx.appendWif(pkey)
    signed_tx = tx.sign()
    if not dryrun:
        broadcast_tx = tx.broadcast(trx_id=True)

    votado = True
    votos.append({
        "time": datetime.datetime.now(),
        "permlink": h.permlink,
        "author": h.author,
        "rewards": float(h.reward)
    })

# Update and save script state
with open("state.pickle", "wb") as f:
    state["votos"] = votos
    state["last_called"] = datetime.datetime.now()
    pickle.dump(state, f)
Exemple #23
0
       "owner": ACCT,
       "url": "No website yet", 
       "block_signing_key": NATIVE_PREFIX + '1111111111111111111111111111111114T1Anm', 
       "props": {
         "account_creation_fee": Amount("0.100 %s" % (NATIVE_SYMBOL)),
         "maximum_block_size":131072, 
       },
     "fee": Amount("0.000 %s" % (NATIVE_SYMBOL)),
     "prefix": NATIVE_PREFIX,
     }
     op = operations.Witness_update(**update_witness)
     tx.appendOps(op)
     #tx.appendSigner(ACCT, "active")
     tx.appendWif(WIF)
     signed_tx = tx.sign()
     broadcast_tx = tx.broadcast()
     status_logger.logger.warning("Total missed at or above threshold. Disabling witness server. \nOperation: " + json.dumps(broadcast_tx, indent=4))
     sys.exit()
   else:
     status_logger.logger.info("Witness " + ACCT + " current total missed: " + str(total_missed) + "\nWitness server operational\n--------------------------")
   time.sleep(60) #Pause script for 60 seconds.
 except KeyboardInterrupt:
   sys.exit()
 except Exception as WitnessDoesNotExistsException:
   status_logger.logger.exception("Exception occured\n")
   status_logger.logger.info("Reconnecting...")
   stm = Steem(
     node=["https://peer.vit.tube/"],
     bundle=True,
     blocking="head",
     nobroadcast=NO_BROADCAST, #set True for testing	
Exemple #24
0
        try:
            c.refresh()
        except ContentDoesNotExistsException:
            continue
        c_list[c.permlink] = 1
        if not c.is_comment():
            counter += 1
            if voter not in c.get_votes() and c.time_elapsed() > timedelta(
                    minutes=wait) and c.time_elapsed() < timedelta(hours=2):
                op = operations.Vote(
                    **{
                        "voter": voter,
                        "author": c.author,
                        "permlink": c.permlink,
                        "weight": int(percent * 100)
                    })
                ops = []
                ops.append(op)
                stm.wallet.unlock(wallet_pw)
                tx = TransactionBuilder(steem_instance=stm)
                tx.appendOps(ops)
                tx.appendSigner(signer, 'posting')
                tx.sign()
                returncode = tx.broadcast()
                print(returncode)
                voter_vp -= percent * 2 / 100
        if counter > 10 or voter_vp < min_vp or c.time_elapsed() > timedelta(
                hours=2):
            # going back 10 entries should be enough (50 minutes, on a spamming account e.g.)
            break