예제 #1
0
 def time_transfer(self):
     self.op = operations.Transfer(**{
         "from": "foo",
         "to": "baar",
         "amount": Amount("111.110 HIVE", hive_instance=self.hv),
         "memo": "Fooo",
         "prefix": self.default_prefix
     })
     self.doit()
예제 #2
0
    def transfer_dict(self, transfer_dict):
        """Calc RC costs for a transfer dict object

        Example for calculating RC costs

        .. code-block:: python

            from bhive.rc import RC
            from bhive.amount import Amount
            transfer_dict = {
                             "from": "foo", "to": "baar",
                             "amount": Amount("111.110 HIVE"),
                             "memo": "Fooo"
                            }

            rc = RC()
            print(rc.comment(transfer_dict))

        """
        market_op_count = 1
        op = operations.Transfer(**transfer_dict)
        tx_size = self.get_tx_size(op)
        return self.transfer(tx_size=tx_size, market_op_count=market_op_count)
    hive_test.setup()
    bhive_test.setup()
    hive_times = []
    bhive_times = []
    loops = 50
    for i in range(0, loops):
        print(i)
        opHive = hiveOperations.Transfer(**{
            "from": "foo",
            "to": "baar",
            "amount": "111.110 HIVE",
            "memo": "Fooo"
        })
        opBhive = operations.Transfer(**{
            "from": "foo",
            "to": "baar",
            "amount": Amount("111.110 HIVE", hive_instance=Hive(offline=True)),
            "memo": "Fooo"
        })

        t_s, t_v = hive_test.doit(ops=opHive)
        hive_times.append([t_s, t_v])

        t_s, t_v = bhive_test.doit(ops=opBhive)
        bhive_times.append([t_s, t_v])

    hive_dt = [0, 0]
    bhive_dt = [0, 0]
    for i in range(0, loops):
        hive_dt[0] += hive_times[i][0]
        hive_dt[1] += hive_times[i][1]
        bhive_dt[0] += bhive_times[i][0]
예제 #4
0
from bhive.nodelist import NodeList
from bhivebase.transactions import getBlockParams
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

# example wif
wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"

if __name__ == "__main__":
    hv_online = Hive()
    ref_block_num, ref_block_prefix = getBlockParams(hv_online)
    print("ref_block_num %d - ref_block_prefix %d" %
          (ref_block_num, ref_block_prefix))

    hv = Hive(offline=True)

    op = operations.Transfer({
        'from': 'bhive.app',
        'to': 'thecrazygm',
        'amount': "0.001 HBD",
        'memo': ""
    })
    tb = TransactionBuilder(hive_instance=hv)

    tb.appendOps([op])
    tb.appendWif(wif)
    tb.constructTx(ref_block_num=ref_block_num,
                   ref_block_prefix=ref_block_prefix)
    tx = tb.sign(reconstruct_tx=False)
    print(tx.json())