Example #1
0
def sign_context(binary_tx, private):

    wallet = Wallet(b'', b'0' * 32, True)
    wallet.CreateKey(binascii.unhexlify(private))
    script_hash = WalletContract.CreateSignatureContract(
        list(wallet._keys.values())[0].PublicKey)
    wallet._contracts[script_hash.ScriptHash.ToBytes()] = script_hash
    tx = ContractTransaction.DeserializeFromBufer(
        binascii.unhexlify(binary_tx))
    context = ContractParametersContext(tx, isMultiSig=False)
    context.ScriptHashes = [script_hash.ScriptHash]
    wallet.Sign(context)
    return [x.ToJson() for x in context.GetScripts()]
Example #2
0
 def test_get_contains_key_should_not_be_found(self):
     wallet = Wallet("fakepath", to_aes_key("123"), True)
     wallet.CreateKey()
     keypair = KeyPair(priv_key=self.pk)
     self.assertFalse(wallet.ContainsKey(keypair.PublicKey))
Example #3
0
 def test_get_contains_key_should_be_found(self):
     wallet = Wallet("fakepath", to_aes_key("123"), True)
     wallet.CreateKey()
     keypair = wallet.GetKeys()[0]
     self.assertTrue(wallet.ContainsKey(keypair.PublicKey))
Example #4
0
 def AddContract(self, contract):
     Wallet.AddContract(self, contract)