Ejemplo n.º 1
0
        def __init__(self, private_key, public_key, m_public_key,
                     sub_public_key):  #指定矿工的私钥和公钥
            #metadata
            self.hash = zsign.random_hash(256)  #交易hash(id)
            self.ver = 1
            self.vin_sz = 2
            self.vout_sz = 1
            self.lock_time = 0
            self.size = 404
            self.coinbase = str(random.randint(0, 10000))  #coinbase中的任意数据
            #input
            self.inputs = []  #交易输入,一笔
            #output
            self.outputs = []  #交易输出,一笔

            #redactable
            self.h = None
            self.r = None
            self.sigma = None
            self.spk = None
            self.pk = None
            self.arbitrary = ''
            self.mpk = None

            self.set_input([('0' * 256, -1)])  #设置输入
            self.set_output([(25, public_key)])  #设置输出,即矿工自身
            self.sign(private_key, public_key, [], ['pay-to-public-key-hash'],
                      m_public_key, sub_public_key)  #签名
Ejemplo n.º 2
0
 def __init__(self):
     #metadata
     self.hash = zsign.random_hash(256)
     self.ver = 1
     self.vin_sz = 2
     self.vout_sz = 1
     self.lock_time = 0
     self.size = 404
     #input
     self.inputs = []
     #output
     self.outputs = []
Ejemplo n.º 3
0
        def __init__(self, private_key, public_key):
            #metadata
            self.hash = zsign.random_hash(256)
            self.ver = 1
            self.vin_sz = 2
            self.vout_sz = 1
            self.lock_time = 0
            self.size = 404
            self.coinbase = str(random.randint(0, 10000))
            #input
            self.inputs = []
            #output
            self.outputs = []

            self.set_input([('0' * 256, -1)])
            self.set_output([(25, public_key)])
            self.sign(private_key, public_key, [], ['pay-to-script-hash'])
Ejemplo n.º 4
0
 def __init__(self):
     #metadata
     self.hash = zsign.random_hash(256)  #交易hash(id)
     self.ver = 1
     self.vin_sz = 2
     self.vout_sz = 1
     self.lock_time = 0
     self.size = 404
     #input
     self.inputs = []  #交易输入
     #output
     self.outputs = []  #交易输出
     #redactable
     self.h = None
     self.r = None
     self.sigma = None
     self.spk = None
     self.pk = None
     self.arbitrary = ''
     self.mpk = None