• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.ser_number函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.ser_number函数的典型用法代码示例。如果您正苦于以下问题:Python ser_number函数的具体用法?Python ser_number怎么用?Python ser_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ser_number函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, timestamper, coinbaser, value, flags, height, data, ntime):
        super(CoinbaseTransaction, self).__init__()
        log.debug("Got to CoinBaseTX")
        #self.extranonce = 0
        
        if len(self.extranonce_placeholder) != self.extranonce_size:
            raise Exception("Extranonce placeholder don't match expected length!")

        tx_in = halfnode.CTxIn()
        tx_in.prevout.hash = 0L
        tx_in.prevout.n = 2**32-1
        tx_in._scriptSig_template = (
            util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(timestamper.time())) + \
            chr(self.extranonce_size),
            util.ser_string(coinbaser.get_coinbase_data() + data)
        )
                
        tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]
    
        tx_out = halfnode.CTxOut()
        tx_out.nValue = value
        tx_out.scriptPubKey = coinbaser.get_script_pubkey()
       
        self.nTime = ntime 
        if settings.COINDAEMON_TX_MSG == 'yes':
            self.strTxComment = settings.Tx_Message
        self.vin.append(tx_in)
        self.vout.append(tx_out)
        
        # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
        self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder)
开发者ID:capslockLtsPool,项目名称:st,代码行数:31,代码来源:coinbasetx.py


示例2: __init__

    def __init__(self, job_id, timestamper, coinbaser, value, flags, height, data):
        super(CoinbaseTransaction, self).__init__()

        if len(self.extranonce_placeholder) != self.extranonce_size:
            raise Exception("Extranonce placeholder don't match expected length!")

        tx_in = halfnode.CTxInTemplate()
        tx_in.prevout.hash = 0L
        tx_in.prevout.n = 2**32-1

        tx_in._scriptSig_template = (
            util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(timestamper.time())) +
            chr(self.extranonce_size),
            util.ser_string("%x" % job_id + "%x" % random.randint(0, 255) + coinbaser.get_coinbase_data() + data)
        )

        tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]

        tx_out = halfnode.CTxOut()
        tx_out.nValue = value
        tx_out.scriptPubKey = coinbaser.get_script_pubkey()

        self.vin.append(tx_in)
        self.vout.append(tx_out)

        # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
        self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder)
开发者ID:frrp,项目名称:bitcoin-mining-pool,代码行数:27,代码来源:coinbasetx.py


示例3: __init__

    def __init__(self, timestamper, coinbaser, value, flags, height, data, budget):
        super(CoinbaseTransaction, self).__init__(nVersion=2, nRefHeight=height)
        
        #self.extranonce = 0
        
        if len(self.extranonce_placeholder) != self.extranonce_size:
            raise Exception("Extranonce placeholder don't match expected length!")

        tx_in = halfnode.CTxIn()
        tx_in.prevout.hash = 0L
        tx_in.prevout.n = 2**32-1
        tx_in._scriptSig_template = (
            util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(timestamper.time())) + \
            chr(self.extranonce_size),
            util.ser_string(coinbaser.get_coinbase_data() + data)
        )
                
        tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]
    
        tx_out = halfnode.CTxOut()
        tx_out.nValue = value
        tx_out.scriptPubKey = coinbaser.get_script_pubkey()
        
        self.vin.append(tx_in)
        self.vout.append(tx_out)
        
        for entry in budget:
            txo = halfnode.CTxOut()
            txo.nValue = entry['value']
            txo.scriptPubKey = entry['scriptPubKey']['hex'].decode('hex')
            self.vout.append(txo)
        
        # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
        self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder)
开发者ID:flound1129,项目名称:stratum-mining-freicoin,代码行数:34,代码来源:coinbasetx.py


示例4: __init__

    def __init__(self, timestamper, coinbaser, value, charity_value, flags, height, data, ntime):
        super(CoinbaseTransactionPOS, self).__init__()
        log.debug("Got to CoinBaseTX")
        #self.extranonce = 0
        
        if len(self.extranonce_placeholder) != self.extranonce_size:
            raise Exception("Extranonce placeholder don't match expected length!")

        tx_in = halfnode.CTxIn()
        tx_in.prevout.hash = 0L
        tx_in.prevout.n = 2**32-1
        tx_in._scriptSig_template = (
            util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(timestamper.time())) + \
            chr(self.extranonce_size),
            util.ser_string(coinbaser.get_coinbase_data() + data)
        )
                
        tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]
    
        tx_out = halfnode.CTxOut()
        tx_out.nValue = value
        tx_out.scriptPubKey = coinbaser.get_script_pubkey()

        self.nTime = ntime 
        if settings.COINDAEMON_SHA256_TX != False:
            self.strTxComment = "http://github.com/ahmedbodi/stratum-mining"
        self.vin.append(tx_in)

        if settings.CHARITY_ENABLED is True:
            tx_out_charity = halfnode.CTxOut()
            tx_out_charity.nValue = charity_value
            tx_out_charity.scriptPubKey = util.getCharityScript()

            if settings.CHARITY_ISFIRSTTXOUT is True:
                self.vout.append(tx_out_charity)
                self.vout.append(tx_out)
            else:
                self.vout.append(tx_out)
                self.vout.append(tx_out_charity)
        else:
            self.vout.append(tx_out)
        
        # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
        self._serialized = super(CoinbaseTransactionPOS, self).serialize().split(self.extranonce_placeholder)
开发者ID:guozhuliiu,项目名称:stratum-mining,代码行数:44,代码来源:coinbasetx.py


示例5: __init__

    def __init__(self, timestamper, coinbaser, value, charity_value, flags, height, data, ntime):
        super(CoinbaseTransaction, self).__init__()
        
        #self.extranonce = 0
        
        if len(self.extranonce_placeholder) != self.extranonce_size:
            raise Exception("Extranonce placeholder don't match expected length!")

        tx_in = halfnode.CTxIn()
        tx_in.prevout.hash = 0L
        tx_in.prevout.n = 2**32-1
        tx_in._scriptSig_template = (
            util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(timestamper.time())) + \
            chr(self.extranonce_size),
            util.ser_string(coinbaser.get_coinbase_data() + data)
        )
                
        tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]

        # EMC2 Charity Address Requirement

        charity_value += int(settings.EXTRA_DONATION)
        if charity_value > value:
            charity_value = value

        tx_out_charity = halfnode.CTxOut()
        tx_out_charity.nValue = charity_value
        tx_out_charity.scriptPubKey = util.getCharityScript()

    
        tx_out = halfnode.CTxOut()
        tx_out.nValue = value - charity_value
        tx_out.scriptPubKey = coinbaser.get_script_pubkey()
       
        self.nTime = ntime 
        if settings.COINDAEMON_SHA256_TX == 'yes':
            self.strTxComment = ""
        self.vin.append(tx_in)
        self.vout.append(tx_out)
        self.vout.append(tx_out_charity)
        
        # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
        self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder)
开发者ID:Mezrin,项目名称:stratum-mining-marucoin,代码行数:43,代码来源:coinbasetx.py


示例6: __init__

    def __init__(self, coinbasers_value, total_value, flags, height, data):
        super(CoinbaseTransaction, self).__init__()
        
        #self.extranonce = 0
        
        if len(self.extranonce_placeholder) != self.extranonce_size:
            raise Exception("Extranonce placeholder don't match expected length!")

        tx_in = halfnode.CTxIn()
        tx_in.prevout.hash = 0L
        tx_in.prevout.n = 2**32-1
        tx_in._scriptSig_template = (
            util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(time.time())) + \
            chr(self.extranonce_size),
            # util.ser_string(coinbaser.get_coinbase_data() + data)
            util.ser_string(data)
        )
                
        tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]
        self.vin.append(tx_in)
    
        total_value_share = sum([x[1] for x in coinbasers_value])
        used_value = 0

        for coinbaser, value in coinbasers_value:
            tx_out = halfnode.CTxOut()

            current_value = total_value * value / total_value_share

            tx_out.nValue = current_value
            used_value += current_value

            tx_out.scriptPubKey = coinbaser.get_script_pubkey()
            self.vout.append(tx_out)

        if used_value < total_value:
            self.vout[0].nValue += total_value - used_value

        # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
        self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder)
开发者ID:sumory,项目名称:BTC,代码行数:40,代码来源:coinbasetx.py


示例7: __init__

    def __init__(self, timestamper, coinbaser, payee, value, flags, height, data):
        super(CoinbaseTransactionPOW, self).__init__()
        log.debug("Got to CoinBaseTX")
        #self.extranonce = 0
        
        if len(self.extranonce_placeholder) != self.extranonce_size:
            raise Exception("Extranonce placeholder don't match expected length!")

        tx_in = halfnode.CTxIn()
        tx_in.prevout.hash = 0L
        tx_in.prevout.n = 2**32-1
        tx_in._scriptSig_template = (
            util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(timestamper.time())) + \
            chr(self.extranonce_size),
            util.ser_string(coinbaser.get_coinbase_data() + data)
        )
                
        tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]

        tx_out2 = None 
        if(payee != None):
            value2 = value / 5
            value  -= value2

            tx_out2 = halfnode.CTxOut()
            tx_out2.nValue = value2
            tx_out2.scriptPubKey = payee
    
        tx_out = halfnode.CTxOut()
        tx_out.nValue = value
        tx_out.scriptPubKey = coinbaser.get_script_pubkey()

        if settings.COINDAEMON_TX != False:
            self.strTxComment = "http://github.com/ahmedbodi/stratum-mining"
        self.vin.append(tx_in)
        self.vout.append(tx_out)
        if tx_out2: self.vout.append(tx_out2)
        
        # Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
        self._serialized = super(CoinbaseTransactionPOW, self).serialize().split(self.extranonce_placeholder)
开发者ID:bankonme,项目名称:darkcoin-stratum,代码行数:40,代码来源:coinbasetx.py



注:本文中的util.ser_number函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.ser_string函数代码示例发布时间:2022-05-26
下一篇:
Python util.sample函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap