def time_transfer(self):
     self.op = operations.Transfer(
         **{
             "from": "foo",
             "to": "baar",
             "amount": Amount("111.110 STEEM", steem_instance=self.stm),
             "memo": "Fooo",
             "prefix": self.default_prefix
         })
     self.doit()
 def test_Transfer(self):
     self.op = operations.Transfer(
         **{
             "from": "nettybot",
             "to": "netuoso",
             "amount": Amount("0.001 STEEM", steem_instance=self.stm),
             "memo": "",
             "prefix": default_prefix
         })
     self.apdu = ([
         b"d40400007205800000308000000d80000000800000008000000004"
         b"200000000000000000000000000000000000000000000000000000"
         b"00000000000004021b88040485342c6304048164b85e0401010423"
         b"02086e65747479626f74076e6574756f736f010000000000000003"
         b"535445454d000000040100"
     ])
     self.cm = (
         u"04021b88040485342c6304048164b85e040101042302086e65747479626f74076e6574756f736f010000000000000003535445454d000000040100"
     )
     self.doit()
Esempio n. 3
0
File: rc.py Progetto: symbiotes/beem
    def transfer_dict(self, transfer_dict):
        """Calc RC costs for a transfer dict object

        Example for calculating RC costs

        .. code-block:: python

            from beem.rc import RC
            from beem.amount import Amount
            transfer_dict = {
                             "from": "foo", "to": "baar",
                             "amount": Amount("111.110 STEEM"),
                             "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)
Esempio n. 4
0
from beem.nodelist import NodeList
from beembase.transactions import getBlockParams
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

# example wif
wif = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"

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

    stm = Steem(offline=True)

    op = operations.Transfer({
        'from': 'beembot',
        'to': 'holger80',
        'amount': "0.001 SBD",
        'memo': ""
    })
    tb = TransactionBuilder(steem_instance=stm)

    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())
    steem_test.setup()
    beem_test.setup()
    steem_times = []
    beem_times = []
    loops = 50
    for i in range(0, loops):
        print(i)
        opSteem = steemOperations.Transfer(**{
            "from": "foo",
            "to": "baar",
            "amount": "111.110 STEEM",
            "memo": "Fooo"
        })
        opBeem = operations.Transfer(**{
            "from": "foo",
            "to": "baar",
            "amount": Amount("111.110 STEEM", steem_instance=Steem(offline=True)),
            "memo": "Fooo"
        })

        t_s, t_v = steem_test.doit(ops=opSteem)
        steem_times.append([t_s, t_v])

        t_s, t_v = beem_test.doit(ops=opBeem)
        beem_times.append([t_s, t_v])

    steem_dt = [0, 0]
    beem_dt = [0, 0]
    for i in range(0, loops):
        steem_dt[0] += steem_times[i][0]
        steem_dt[1] += steem_times[i][1]
        beem_dt[0] += beem_times[i][0]