diff --git a/skycoin/__init__.py b/skycoin/__init__.py index 76a885fd..99806a77 100644 --- a/skycoin/__init__.py +++ b/skycoin/__init__.py @@ -1,4 +1,6 @@ from .skyerror import * import cipher import base58 -import secp256k1go \ No newline at end of file +import secp256k1go +import encrypt +import scrypt \ No newline at end of file diff --git a/skycoin/cipher.py b/skycoin/cipher.py index 0003de55..6fb37976 100644 --- a/skycoin/cipher.py +++ b/skycoin/cipher.py @@ -1,4 +1,3 @@ -# from .libpy import * from libpy import skycoin def PubKey(): @@ -83,4 +82,64 @@ def GenerateDeterministicKeyPair(data, public_key, secret_key): return skycoin.SKY_cipher_GenerateDeterministicKeyPair(data, public_key, secret_key) def AddressNull(address): - return skycoin.SKY_cipher_Address_Null(address) \ No newline at end of file + return skycoin.SKY_cipher_Address_Null(address) + +def PubKeyVerify(public_key): + return skycoin.SKY_cipher_PubKey_Verify(public_key) + +def SecKeyVerify(secret_key): + return skycoin.SKY_cipher_SecKey_Verify(secret_key) + +def ECDH(public_key_2, secret_key_1): + return skycoin.SKY_cipher_ECDH(public_key_2, secret_key_1) + +def Sig(): + return skycoin.cipher_Sig() + +def NewSig(data, sig): + return skycoin.SKY_cipher_NewSig(data, sig) + +def SignHash(sha_sum, secret_key_1, sig_1): + return skycoin.SKY_cipher_SignHash(sha_sum, secret_key_1, sig_1) + +def ChkSig(addres, sha_sum, sig_1): + return skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_1) + +def PubKeyFromSig(sig_1, sha_sum, public_key_2): + return skycoin.SKY_cipher_PubKeyFromSig(sig_1, sha_sum, public_key_2) + +def VerifySignature(public_key, sig_1, sha_sum_1): + return skycoin.SKY_cipher_VerifySignature(public_key, sig_1, sha_sum_1) + +def GenerateDeterministicKeyPairsSeed(seed, num): + return skycoin.SKY_cipher_GenerateDeterministicKeyPairsSeed(seed, num) + +def Ripemd160(): + return skycoin.cipher_Ripemd160() + +def HashRipemd160(p0, p1): + return skycoin.SKY_cipher_HashRipemd160(p0, p1) + +def Ripemd160Set(h, b): + return skycoin.SKY_cipher_Ripemd160_Set(h, b) + +def SHA256Set(h, b): + return skycoin.SKY_cipher_SHA256_Set(h, b) + +def SHA256Hex(h): + return skycoin.SKY_cipher_SHA256_Hex(h) + +def SHA256FromHex(p0, p1): + return skycoin.SKY_cipher_SHA256FromHex(p0, p1) + +def DoubleSHA256(b, h): + return skycoin.SKY_cipher_DoubleSHA256(b, h) + +def AddSHA256(p0, p1, p2): + return skycoin.SKY_cipher_AddSHA256(p0, p1, p2) + +def SHA256Xor(p0, p1, p2): + return skycoin.SKY_cipher_SHA256_Xor(p0, p1, p2) + +def SHA256Null(p0): + return skycoin.SKY_cipher_SHA256_Null(p0) \ No newline at end of file diff --git a/skycoin/encrypt.py b/skycoin/encrypt.py new file mode 100644 index 00000000..fb8f1937 --- /dev/null +++ b/skycoin/encrypt.py @@ -0,0 +1,16 @@ +from libpy import skycoin + +def Sha256XorEncrypt(data, cadena): + return skycoin.SKY_encrypt_Sha256Xor_Encrypt(data, cadena) + +def Sha256XorDecrypt(p0, p1): + return skycoin.SKY_encrypt_Sha256Xor_Decrypt(p0, p1) + +def ScryptChacha20poly1305(): + return skycoin.encrypt__ScryptChacha20poly1305() + +def ScryptChacha20poly1305Encrypt(crypt, plaintext, passwd): + return skycoin.SKY_encrypt_ScryptChacha20poly1305_Encrypt(crypt, plaintext, passwd) + +def ScryptChacha20poly1305Decrypt(crypt, encrypto, password): + return skycoin.SKY_encrypt_ScryptChacha20poly1305_Decrypt(crypt, encrypto, password) \ No newline at end of file diff --git a/skycoin/scrypt.py b/skycoin/scrypt.py new file mode 100644 index 00000000..1ebcbec0 --- /dev/null +++ b/skycoin/scrypt.py @@ -0,0 +1,4 @@ +from libpy import skycoin + +def Key(p0, p1, p2, p3, p4, p5): + return skycoin.SKY_scrypt_Key(p0, p1, p2, p3, p4, p5) \ No newline at end of file diff --git a/skycoin/secp256k1go.py b/skycoin/secp256k1go.py index a4629908..e3db2434 100644 --- a/skycoin/secp256k1go.py +++ b/skycoin/secp256k1go.py @@ -29,4 +29,7 @@ def FieldNormalize(p0): return skycoin.SKY_secp256k1go_Field_Normalize(p0) def FieldEquals(p0, p1): - return skycoin.SKY_secp256k1go_Field_Equals(p0, p1) \ No newline at end of file + return skycoin.SKY_secp256k1go_Field_Equals(p0, p1) + +def FieldInv(in_, out): + return skycoin.SKY_secp256k1go_Field_Inv(in_, out) \ No newline at end of file diff --git a/skycoin/skycoin.py b/skycoin/skycoin.py deleted file mode 100644 index fdef405e..00000000 --- a/skycoin/skycoin.py +++ /dev/null @@ -1,3254 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 3.0.12 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - -from sys import version_info as _swig_python_version_info -if _swig_python_version_info >= (2, 7, 0): - def swig_import_helper(): - import importlib - pkg = __name__.rpartition('.')[0] - mname = '.'.join((pkg, '_skycoin')).lstrip('.') - try: - return importlib.import_module(mname) - except ImportError: - return importlib.import_module('_skycoin') - _skycoin = swig_import_helper() - del swig_import_helper -elif _swig_python_version_info >= (2, 6, 0): - def swig_import_helper(): - from os.path import dirname - import imp - fp = None - try: - fp, pathname, description = imp.find_module('_skycoin', [dirname(__file__)]) - except ImportError: - import _skycoin - return _skycoin - try: - _mod = imp.load_module('_skycoin', fp, pathname, description) - finally: - if fp is not None: - fp.close() - return _mod - _skycoin = swig_import_helper() - del swig_import_helper -else: - import _skycoin -del _swig_python_version_info - -try: - _swig_property = property -except NameError: - pass # Python < 2.2 doesn't have 'property'. - -try: - import builtins as __builtin__ -except ImportError: - import __builtin__ - -def _swig_setattr_nondynamic(self, class_type, name, value, static=1): - if (name == "thisown"): - return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name, None) - if method: - return method(self, value) - if (not static): - if _newclass: - object.__setattr__(self, name, value) - else: - self.__dict__[name] = value - else: - raise AttributeError("You cannot add attributes to %s" % self) - - -def _swig_setattr(self, class_type, name, value): - return _swig_setattr_nondynamic(self, class_type, name, value, 0) - - -def _swig_getattr(self, class_type, name): - if (name == "thisown"): - return self.this.own() - method = class_type.__swig_getmethods__.get(name, None) - if method: - return method(self) - raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) - - -def _swig_repr(self): - try: - strthis = "proxy of " + self.this.__repr__() - except __builtin__.Exception: - strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - -try: - _object = object - _newclass = 1 -except __builtin__.Exception: - class _object: - pass - _newclass = 0 - - -def destroy_cipher_SecKeys(p): - return _skycoin.destroy_cipher_SecKeys(p) -destroy_cipher_SecKeys = _skycoin.destroy_cipher_SecKeys - -def destroy_cipher_PubKeys(p): - return _skycoin.destroy_cipher_PubKeys(p) -destroy_cipher_PubKeys = _skycoin.destroy_cipher_PubKeys - -def equalSlices(slice1, slice2, elem_size): - return _skycoin.equalSlices(slice1, slice2, elem_size) -equalSlices = _skycoin.equalSlices - -def equalTransactions(t1, t2): - return _skycoin.equalTransactions(t1, t2) -equalTransactions = _skycoin.equalTransactions - -def equalTransactionsArrays(pTxs1, pTxs2): - return _skycoin.equalTransactionsArrays(pTxs1, pTxs2) -equalTransactionsArrays = _skycoin.equalTransactionsArrays - -def equalBlockHeaders(bh1, bh2): - return _skycoin.equalBlockHeaders(bh1, bh2) -equalBlockHeaders = _skycoin.equalBlockHeaders -class cipher_PubKey(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_PubKey, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_PubKey, name) - __repr__ = _swig_repr - - def __eq__(self, a): - return _skycoin.cipher_PubKey___eq__(self, a) - - def compareToString(self, str): - return _skycoin.cipher_PubKey_compareToString(self, str) - - def toStr(self): - return _skycoin.cipher_PubKey_toStr(self) - - def assignFrom(self, data): - return _skycoin.cipher_PubKey_assignFrom(self, data) - - def assignTo(self, data): - return _skycoin.cipher_PubKey_assignTo(self, data) - __swig_setmethods__["data"] = _skycoin.cipher_PubKey_data_set - __swig_getmethods__["data"] = _skycoin.cipher_PubKey_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_PubKey_data_get, _skycoin.cipher_PubKey_data_set) - - def __init__(self): - this = _skycoin.new_cipher_PubKey() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_PubKey - __del__ = lambda self: None -cipher_PubKey_swigregister = _skycoin.cipher_PubKey_swigregister -cipher_PubKey_swigregister(cipher_PubKey) - -class cipher_SecKey(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_SecKey, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_SecKey, name) - __repr__ = _swig_repr - - def __eq__(self, a): - return _skycoin.cipher_SecKey___eq__(self, a) - - def compareToString(self, str): - return _skycoin.cipher_SecKey_compareToString(self, str) - - def toStr(self): - return _skycoin.cipher_SecKey_toStr(self) - - def assignFrom(self, data): - return _skycoin.cipher_SecKey_assignFrom(self, data) - - def assignTo(self, data): - return _skycoin.cipher_SecKey_assignTo(self, data) - __swig_setmethods__["data"] = _skycoin.cipher_SecKey_data_set - __swig_getmethods__["data"] = _skycoin.cipher_SecKey_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_SecKey_data_get, _skycoin.cipher_SecKey_data_set) - - def __init__(self): - this = _skycoin.new_cipher_SecKey() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_SecKey - __del__ = lambda self: None -cipher_SecKey_swigregister = _skycoin.cipher_SecKey_swigregister -cipher_SecKey_swigregister(cipher_SecKey) - -class cipher_Ripemd160(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_Ripemd160, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_Ripemd160, name) - __repr__ = _swig_repr - - def __eq__(self, a): - return _skycoin.cipher_Ripemd160___eq__(self, a) - - def compareToString(self, str): - return _skycoin.cipher_Ripemd160_compareToString(self, str) - - def toStr(self): - return _skycoin.cipher_Ripemd160_toStr(self) - - def assignFrom(self, data): - return _skycoin.cipher_Ripemd160_assignFrom(self, data) - - def assignTo(self, data): - return _skycoin.cipher_Ripemd160_assignTo(self, data) - __swig_setmethods__["data"] = _skycoin.cipher_Ripemd160_data_set - __swig_getmethods__["data"] = _skycoin.cipher_Ripemd160_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_Ripemd160_data_get, _skycoin.cipher_Ripemd160_data_set) - - def __init__(self): - this = _skycoin.new_cipher_Ripemd160() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_Ripemd160 - __del__ = lambda self: None -cipher_Ripemd160_swigregister = _skycoin.cipher_Ripemd160_swigregister -cipher_Ripemd160_swigregister(cipher_Ripemd160) - -class cipher_Sig(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_Sig, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_Sig, name) - __repr__ = _swig_repr - - def __eq__(self, a): - return _skycoin.cipher_Sig___eq__(self, a) - - def compareToString(self, str): - return _skycoin.cipher_Sig_compareToString(self, str) - - def toStr(self): - return _skycoin.cipher_Sig_toStr(self) - - def assignFrom(self, data): - return _skycoin.cipher_Sig_assignFrom(self, data) - - def assignTo(self, data): - return _skycoin.cipher_Sig_assignTo(self, data) - __swig_setmethods__["data"] = _skycoin.cipher_Sig_data_set - __swig_getmethods__["data"] = _skycoin.cipher_Sig_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_Sig_data_get, _skycoin.cipher_Sig_data_set) - - def __init__(self): - this = _skycoin.new_cipher_Sig() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_Sig - __del__ = lambda self: None -cipher_Sig_swigregister = _skycoin.cipher_Sig_swigregister -cipher_Sig_swigregister(cipher_Sig) - -class cipher_SHA256(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_SHA256, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_SHA256, name) - __repr__ = _swig_repr - - def __eq__(self, a): - return _skycoin.cipher_SHA256___eq__(self, a) - - def compareToString(self, str): - return _skycoin.cipher_SHA256_compareToString(self, str) - - def toStr(self): - return _skycoin.cipher_SHA256_toStr(self) - - def assignFrom(self, data): - return _skycoin.cipher_SHA256_assignFrom(self, data) - - def assignTo(self, data): - return _skycoin.cipher_SHA256_assignTo(self, data) - __swig_setmethods__["data"] = _skycoin.cipher_SHA256_data_set - __swig_getmethods__["data"] = _skycoin.cipher_SHA256_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_SHA256_data_get, _skycoin.cipher_SHA256_data_set) - - def __init__(self): - this = _skycoin.new_cipher_SHA256() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_SHA256 - __del__ = lambda self: None -cipher_SHA256_swigregister = _skycoin.cipher_SHA256_swigregister -cipher_SHA256_swigregister(cipher_SHA256) - -class cipher_Checksum(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_Checksum, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_Checksum, name) - __repr__ = _swig_repr - - def __eq__(self, a): - return _skycoin.cipher_Checksum___eq__(self, a) - - def compareToString(self, str): - return _skycoin.cipher_Checksum_compareToString(self, str) - - def toStr(self): - return _skycoin.cipher_Checksum_toStr(self) - - def assignFrom(self, data): - return _skycoin.cipher_Checksum_assignFrom(self, data) - - def assignTo(self, data): - return _skycoin.cipher_Checksum_assignTo(self, data) - __swig_setmethods__["data"] = _skycoin.cipher_Checksum_data_set - __swig_getmethods__["data"] = _skycoin.cipher_Checksum_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_Checksum_data_get, _skycoin.cipher_Checksum_data_set) - - def __init__(self): - this = _skycoin.new_cipher_Checksum() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_Checksum - __del__ = lambda self: None -cipher_Checksum_swigregister = _skycoin.cipher_Checksum_swigregister -cipher_Checksum_swigregister(cipher_Checksum) - -class cipher_SecKeys(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_SecKeys, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_SecKeys, name) - __repr__ = _swig_repr - - def getAt(self, i): - return _skycoin.cipher_SecKeys_getAt(self, i) - - def setAt(self, i, seckey): - return _skycoin.cipher_SecKeys_setAt(self, i, seckey) - - def __eq__(self, a): - return _skycoin.cipher_SecKeys___eq__(self, a) - - def allocate(self, n): - return _skycoin.cipher_SecKeys_allocate(self, n) - - def release(self): - return _skycoin.cipher_SecKeys_release(self) - __swig_setmethods__["data"] = _skycoin.cipher_SecKeys_data_set - __swig_getmethods__["data"] = _skycoin.cipher_SecKeys_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_SecKeys_data_get, _skycoin.cipher_SecKeys_data_set) - __swig_setmethods__["count"] = _skycoin.cipher_SecKeys_count_set - __swig_getmethods__["count"] = _skycoin.cipher_SecKeys_count_get - if _newclass: - count = _swig_property(_skycoin.cipher_SecKeys_count_get, _skycoin.cipher_SecKeys_count_set) - - def __init__(self): - this = _skycoin.new_cipher_SecKeys() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_SecKeys - __del__ = lambda self: None -cipher_SecKeys_swigregister = _skycoin.cipher_SecKeys_swigregister -cipher_SecKeys_swigregister(cipher_SecKeys) - -class cipher_PubKeys(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_PubKeys, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_PubKeys, name) - __repr__ = _swig_repr - - def getAt(self, i): - return _skycoin.cipher_PubKeys_getAt(self, i) - - def setAt(self, i, pubkey): - return _skycoin.cipher_PubKeys_setAt(self, i, pubkey) - - def __eq__(self, a): - return _skycoin.cipher_PubKeys___eq__(self, a) - - def allocate(self, n): - return _skycoin.cipher_PubKeys_allocate(self, n) - - def release(self): - return _skycoin.cipher_PubKeys_release(self) - __swig_setmethods__["data"] = _skycoin.cipher_PubKeys_data_set - __swig_getmethods__["data"] = _skycoin.cipher_PubKeys_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_PubKeys_data_get, _skycoin.cipher_PubKeys_data_set) - __swig_setmethods__["count"] = _skycoin.cipher_PubKeys_count_set - __swig_getmethods__["count"] = _skycoin.cipher_PubKeys_count_get - if _newclass: - count = _swig_property(_skycoin.cipher_PubKeys_count_get, _skycoin.cipher_PubKeys_count_set) - - def __init__(self): - this = _skycoin.new_cipher_PubKeys() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_PubKeys - __del__ = lambda self: None -cipher_PubKeys_swigregister = _skycoin.cipher_PubKeys_swigregister -cipher_PubKeys_swigregister(cipher_PubKeys) - -class cipher_SHA256s(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_SHA256s, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_SHA256s, name) - __repr__ = _swig_repr - - def getAt(self, i): - return _skycoin.cipher_SHA256s_getAt(self, i) - - def setAt(self, i, hash): - return _skycoin.cipher_SHA256s_setAt(self, i, hash) - - def __eq__(self, a): - return _skycoin.cipher_SHA256s___eq__(self, a) - - def allocate(self, n): - return _skycoin.cipher_SHA256s_allocate(self, n) - - def release(self): - return _skycoin.cipher_SHA256s_release(self) - __swig_setmethods__["data"] = _skycoin.cipher_SHA256s_data_set - __swig_getmethods__["data"] = _skycoin.cipher_SHA256s_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_SHA256s_data_get, _skycoin.cipher_SHA256s_data_set) - __swig_setmethods__["count"] = _skycoin.cipher_SHA256s_count_set - __swig_getmethods__["count"] = _skycoin.cipher_SHA256s_count_get - if _newclass: - count = _swig_property(_skycoin.cipher_SHA256s_count_get, _skycoin.cipher_SHA256s_count_set) - - def __init__(self): - this = _skycoin.new_cipher_SHA256s() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_SHA256s - __del__ = lambda self: None -cipher_SHA256s_swigregister = _skycoin.cipher_SHA256s_swigregister -cipher_SHA256s_swigregister(cipher_SHA256s) - -class coin_UxOutArray(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin_UxOutArray, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin_UxOutArray, name) - __repr__ = _swig_repr - __swig_setmethods__["data"] = _skycoin.coin_UxOutArray_data_set - __swig_getmethods__["data"] = _skycoin.coin_UxOutArray_data_get - if _newclass: - data = _swig_property(_skycoin.coin_UxOutArray_data_get, _skycoin.coin_UxOutArray_data_set) - __swig_setmethods__["count"] = _skycoin.coin_UxOutArray_count_set - __swig_getmethods__["count"] = _skycoin.coin_UxOutArray_count_get - if _newclass: - count = _swig_property(_skycoin.coin_UxOutArray_count_get, _skycoin.coin_UxOutArray_count_set) - - def __init__(self): - this = _skycoin.new_coin_UxOutArray() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin_UxOutArray - __del__ = lambda self: None -coin_UxOutArray_swigregister = _skycoin.coin_UxOutArray_swigregister -coin_UxOutArray_swigregister(coin_UxOutArray) - -class cipher_Addresses(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher_Addresses, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher_Addresses, name) - __repr__ = _swig_repr - __swig_setmethods__["data"] = _skycoin.cipher_Addresses_data_set - __swig_getmethods__["data"] = _skycoin.cipher_Addresses_data_get - if _newclass: - data = _swig_property(_skycoin.cipher_Addresses_data_get, _skycoin.cipher_Addresses_data_set) - __swig_setmethods__["count"] = _skycoin.cipher_Addresses_count_set - __swig_getmethods__["count"] = _skycoin.cipher_Addresses_count_get - if _newclass: - count = _swig_property(_skycoin.cipher_Addresses_count_get, _skycoin.cipher_Addresses_count_set) - - def __init__(self): - this = _skycoin.new_cipher_Addresses() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher_Addresses - __del__ = lambda self: None -cipher_Addresses_swigregister = _skycoin.cipher_Addresses_swigregister -cipher_Addresses_swigregister(cipher_Addresses) - -class _GoString_(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, _GoString_, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, _GoString_, name) - __repr__ = _swig_repr - __swig_setmethods__["p"] = _skycoin._GoString__p_set - __swig_getmethods__["p"] = _skycoin._GoString__p_get - if _newclass: - p = _swig_property(_skycoin._GoString__p_get, _skycoin._GoString__p_set) - __swig_setmethods__["n"] = _skycoin._GoString__n_set - __swig_getmethods__["n"] = _skycoin._GoString__n_get - if _newclass: - n = _swig_property(_skycoin._GoString__n_get, _skycoin._GoString__n_set) - - def __init__(self): - this = _skycoin.new__GoString_() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete__GoString_ - __del__ = lambda self: None -_GoString__swigregister = _skycoin._GoString__swigregister -_GoString__swigregister(_GoString_) - -class GoInterface(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, GoInterface, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, GoInterface, name) - __repr__ = _swig_repr - __swig_setmethods__["t"] = _skycoin.GoInterface_t_set - __swig_getmethods__["t"] = _skycoin.GoInterface_t_get - if _newclass: - t = _swig_property(_skycoin.GoInterface_t_get, _skycoin.GoInterface_t_set) - __swig_setmethods__["v"] = _skycoin.GoInterface_v_set - __swig_getmethods__["v"] = _skycoin.GoInterface_v_get - if _newclass: - v = _swig_property(_skycoin.GoInterface_v_get, _skycoin.GoInterface_v_set) - - def __init__(self): - this = _skycoin.new_GoInterface() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_GoInterface - __del__ = lambda self: None -GoInterface_swigregister = _skycoin.GoInterface_swigregister -GoInterface_swigregister(GoInterface) - -class GoSlice(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, GoSlice, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, GoSlice, name) - __repr__ = _swig_repr - __swig_setmethods__["data"] = _skycoin.GoSlice_data_set - __swig_getmethods__["data"] = _skycoin.GoSlice_data_get - if _newclass: - data = _swig_property(_skycoin.GoSlice_data_get, _skycoin.GoSlice_data_set) - __swig_setmethods__["len"] = _skycoin.GoSlice_len_set - __swig_getmethods__["len"] = _skycoin.GoSlice_len_get - if _newclass: - len = _swig_property(_skycoin.GoSlice_len_get, _skycoin.GoSlice_len_set) - __swig_setmethods__["cap"] = _skycoin.GoSlice_cap_set - __swig_getmethods__["cap"] = _skycoin.GoSlice_cap_get - if _newclass: - cap = _swig_property(_skycoin.GoSlice_cap_get, _skycoin.GoSlice_cap_set) - - def __init__(self): - this = _skycoin.new_GoSlice() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_GoSlice - __del__ = lambda self: None -GoSlice_swigregister = _skycoin.GoSlice_swigregister -GoSlice_swigregister(GoSlice) - - -def SKY_coin_NewBlock(p0, p1, p2, p3, p4): - return _skycoin.SKY_coin_NewBlock(p0, p1, p2, p3, p4) -SKY_coin_NewBlock = _skycoin.SKY_coin_NewBlock - -def SKY_coin_SignedBlock_VerifySignature(p0, p1): - return _skycoin.SKY_coin_SignedBlock_VerifySignature(p0, p1) -SKY_coin_SignedBlock_VerifySignature = _skycoin.SKY_coin_SignedBlock_VerifySignature - -def SKY_coin_NewGenesisBlock(p0, p1, p2): - return _skycoin.SKY_coin_NewGenesisBlock(p0, p1, p2) -SKY_coin_NewGenesisBlock = _skycoin.SKY_coin_NewGenesisBlock - -def SKY_coin_Block_HashHeader(p0, p1): - return _skycoin.SKY_coin_Block_HashHeader(p0, p1) -SKY_coin_Block_HashHeader = _skycoin.SKY_coin_Block_HashHeader - -def SKY_coin_Block_PreHashHeader(p0, p1): - return _skycoin.SKY_coin_Block_PreHashHeader(p0, p1) -SKY_coin_Block_PreHashHeader = _skycoin.SKY_coin_Block_PreHashHeader - -def SKY_coin_Block_Time(p0): - return _skycoin.SKY_coin_Block_Time(p0) -SKY_coin_Block_Time = _skycoin.SKY_coin_Block_Time - -def SKY_coin_Block_Seq(p0): - return _skycoin.SKY_coin_Block_Seq(p0) -SKY_coin_Block_Seq = _skycoin.SKY_coin_Block_Seq - -def SKY_coin_Block_HashBody(p0, p1): - return _skycoin.SKY_coin_Block_HashBody(p0, p1) -SKY_coin_Block_HashBody = _skycoin.SKY_coin_Block_HashBody - -def SKY_coin_Block_Size(p0): - return _skycoin.SKY_coin_Block_Size(p0) -SKY_coin_Block_Size = _skycoin.SKY_coin_Block_Size - -def SKY_coin_Block_String(p0): - return _skycoin.SKY_coin_Block_String(p0) -SKY_coin_Block_String = _skycoin.SKY_coin_Block_String - -def SKY_coin_Block_GetTransaction(p0, p1): - return _skycoin.SKY_coin_Block_GetTransaction(p0, p1) -SKY_coin_Block_GetTransaction = _skycoin.SKY_coin_Block_GetTransaction - -def SKY_coin_NewBlockHeader(p0, p1, p2, p3, p4, p5): - return _skycoin.SKY_coin_NewBlockHeader(p0, p1, p2, p3, p4, p5) -SKY_coin_NewBlockHeader = _skycoin.SKY_coin_NewBlockHeader - -def SKY_coin_BlockHeader_Hash(p0, p1): - return _skycoin.SKY_coin_BlockHeader_Hash(p0, p1) -SKY_coin_BlockHeader_Hash = _skycoin.SKY_coin_BlockHeader_Hash - -def SKY_coin_BlockHeader_Bytes(p0): - return _skycoin.SKY_coin_BlockHeader_Bytes(p0) -SKY_coin_BlockHeader_Bytes = _skycoin.SKY_coin_BlockHeader_Bytes - -def SKY_coin_BlockHeader_String(p0): - return _skycoin.SKY_coin_BlockHeader_String(p0) -SKY_coin_BlockHeader_String = _skycoin.SKY_coin_BlockHeader_String - -def SKY_coin_BlockBody_Hash(p0, p1): - return _skycoin.SKY_coin_BlockBody_Hash(p0, p1) -SKY_coin_BlockBody_Hash = _skycoin.SKY_coin_BlockBody_Hash - -def SKY_coin_BlockBody_Size(): - return _skycoin.SKY_coin_BlockBody_Size() -SKY_coin_BlockBody_Size = _skycoin.SKY_coin_BlockBody_Size - -def SKY_coin_BlockBody_Bytes(p0): - return _skycoin.SKY_coin_BlockBody_Bytes(p0) -SKY_coin_BlockBody_Bytes = _skycoin.SKY_coin_BlockBody_Bytes - -def SKY_coin_CreateUnspents(*args): - return _skycoin.SKY_coin_CreateUnspents(*args) -SKY_coin_CreateUnspents = _skycoin.SKY_coin_CreateUnspents - -def SKY_coin_CreateUnspent(p0, p1, p2, p3): - return _skycoin.SKY_coin_CreateUnspent(p0, p1, p2, p3) -SKY_coin_CreateUnspent = _skycoin.SKY_coin_CreateUnspent - -def SKY_coin_GetBlockObject(p0): - return _skycoin.SKY_coin_GetBlockObject(p0) -SKY_coin_GetBlockObject = _skycoin.SKY_coin_GetBlockObject - -def SKY_coin_GetBlockBody(p0): - return _skycoin.SKY_coin_GetBlockBody(p0) -SKY_coin_GetBlockBody = _skycoin.SKY_coin_GetBlockBody - -def SKY_coin_NewEmptyBlock(p0): - return _skycoin.SKY_coin_NewEmptyBlock(p0) -SKY_coin_NewEmptyBlock = _skycoin.SKY_coin_NewEmptyBlock - -def SKY_bip39_NewDefaultMnemomic(): - return _skycoin.SKY_bip39_NewDefaultMnemomic() -SKY_bip39_NewDefaultMnemomic = _skycoin.SKY_bip39_NewDefaultMnemomic - -def SKY_bip39_NewEntropy(p0): - return _skycoin.SKY_bip39_NewEntropy(p0) -SKY_bip39_NewEntropy = _skycoin.SKY_bip39_NewEntropy - -def SKY_bip39_NewMnemonic(p0): - return _skycoin.SKY_bip39_NewMnemonic(p0) -SKY_bip39_NewMnemonic = _skycoin.SKY_bip39_NewMnemonic - -def SKY_bip39_MnemonicToByteArray(p0): - return _skycoin.SKY_bip39_MnemonicToByteArray(p0) -SKY_bip39_MnemonicToByteArray = _skycoin.SKY_bip39_MnemonicToByteArray - -def SKY_bip39_IsMnemonicValid(p0): - return _skycoin.SKY_bip39_IsMnemonicValid(p0) -SKY_bip39_IsMnemonicValid = _skycoin.SKY_bip39_IsMnemonicValid - -def SKY_api_NewClient(p0): - return _skycoin.SKY_api_NewClient(p0) -SKY_api_NewClient = _skycoin.SKY_api_NewClient - -def SKY_api_Client_CSRF(p0): - return _skycoin.SKY_api_Client_CSRF(p0) -SKY_api_Client_CSRF = _skycoin.SKY_api_Client_CSRF - -def SKY_api_Client_Version(p0): - return _skycoin.SKY_api_Client_Version(p0) -SKY_api_Client_Version = _skycoin.SKY_api_Client_Version - -def SKY_api_Client_Outputs(p0): - return _skycoin.SKY_api_Client_Outputs(p0) -SKY_api_Client_Outputs = _skycoin.SKY_api_Client_Outputs - -def SKY_api_Client_OutputsForAddresses(p0, p1): - return _skycoin.SKY_api_Client_OutputsForAddresses(p0, p1) -SKY_api_Client_OutputsForAddresses = _skycoin.SKY_api_Client_OutputsForAddresses - -def SKY_api_Client_OutputsForHashes(p0, p1): - return _skycoin.SKY_api_Client_OutputsForHashes(p0, p1) -SKY_api_Client_OutputsForHashes = _skycoin.SKY_api_Client_OutputsForHashes - -def SKY_api_Client_CoinSupply(p0): - return _skycoin.SKY_api_Client_CoinSupply(p0) -SKY_api_Client_CoinSupply = _skycoin.SKY_api_Client_CoinSupply - -def SKY_api_Client_BlockByHash(p0, p1): - return _skycoin.SKY_api_Client_BlockByHash(p0, p1) -SKY_api_Client_BlockByHash = _skycoin.SKY_api_Client_BlockByHash - -def SKY_api_Client_BlockBySeq(p0, p1): - return _skycoin.SKY_api_Client_BlockBySeq(p0, p1) -SKY_api_Client_BlockBySeq = _skycoin.SKY_api_Client_BlockBySeq - -def SKY_api_Client_Blocks(p0, p1, p2): - return _skycoin.SKY_api_Client_Blocks(p0, p1, p2) -SKY_api_Client_Blocks = _skycoin.SKY_api_Client_Blocks - -def SKY_api_Client_LastBlocks(p0, p1): - return _skycoin.SKY_api_Client_LastBlocks(p0, p1) -SKY_api_Client_LastBlocks = _skycoin.SKY_api_Client_LastBlocks - -def SKY_api_Client_BlockchainMetadata(p0): - return _skycoin.SKY_api_Client_BlockchainMetadata(p0) -SKY_api_Client_BlockchainMetadata = _skycoin.SKY_api_Client_BlockchainMetadata - -def SKY_api_Client_BlockchainProgress(p0): - return _skycoin.SKY_api_Client_BlockchainProgress(p0) -SKY_api_Client_BlockchainProgress = _skycoin.SKY_api_Client_BlockchainProgress - -def SKY_api_Client_Balance(p0, p1, p2): - return _skycoin.SKY_api_Client_Balance(p0, p1, p2) -SKY_api_Client_Balance = _skycoin.SKY_api_Client_Balance - -def SKY_api_Client_UxOut(p0, p1): - return _skycoin.SKY_api_Client_UxOut(p0, p1) -SKY_api_Client_UxOut = _skycoin.SKY_api_Client_UxOut - -def SKY_api_Client_AddressUxOuts(p0, p1): - return _skycoin.SKY_api_Client_AddressUxOuts(p0, p1) -SKY_api_Client_AddressUxOuts = _skycoin.SKY_api_Client_AddressUxOuts - -def SKY_api_Client_Wallet(p0, p1): - return _skycoin.SKY_api_Client_Wallet(p0, p1) -SKY_api_Client_Wallet = _skycoin.SKY_api_Client_Wallet - -def SKY_api_Client_Wallets(p0): - return _skycoin.SKY_api_Client_Wallets(p0) -SKY_api_Client_Wallets = _skycoin.SKY_api_Client_Wallets - -def SKY_api_Client_CreateUnencryptedWallet(p0, p1, p2, p3): - return _skycoin.SKY_api_Client_CreateUnencryptedWallet(p0, p1, p2, p3) -SKY_api_Client_CreateUnencryptedWallet = _skycoin.SKY_api_Client_CreateUnencryptedWallet - -def SKY_api_Client_CreateEncryptedWallet(p0, p1, p2, p3, p4): - return _skycoin.SKY_api_Client_CreateEncryptedWallet(p0, p1, p2, p3, p4) -SKY_api_Client_CreateEncryptedWallet = _skycoin.SKY_api_Client_CreateEncryptedWallet - -def SKY_api_Client_NewWalletAddress(p0, p1, p2, p3): - return _skycoin.SKY_api_Client_NewWalletAddress(p0, p1, p2, p3) -SKY_api_Client_NewWalletAddress = _skycoin.SKY_api_Client_NewWalletAddress - -def SKY_api_Client_WalletBalance(p0, p1, p2): - return _skycoin.SKY_api_Client_WalletBalance(p0, p1, p2) -SKY_api_Client_WalletBalance = _skycoin.SKY_api_Client_WalletBalance - -def SKY_api_Client_Spend(p0, p1, p2, p3, p4, p5): - return _skycoin.SKY_api_Client_Spend(p0, p1, p2, p3, p4, p5) -SKY_api_Client_Spend = _skycoin.SKY_api_Client_Spend - -def SKY_api_Client_CreateTransaction(p0): - return _skycoin.SKY_api_Client_CreateTransaction(p0) -SKY_api_Client_CreateTransaction = _skycoin.SKY_api_Client_CreateTransaction - -def SKY_api_Client_UpdateWallet(p0, p1, p2): - return _skycoin.SKY_api_Client_UpdateWallet(p0, p1, p2) -SKY_api_Client_UpdateWallet = _skycoin.SKY_api_Client_UpdateWallet - -def SKY_api_Client_WalletFolderName(p0): - return _skycoin.SKY_api_Client_WalletFolderName(p0) -SKY_api_Client_WalletFolderName = _skycoin.SKY_api_Client_WalletFolderName - -def SKY_api_Client_NewSeed(p0, p1): - return _skycoin.SKY_api_Client_NewSeed(p0, p1) -SKY_api_Client_NewSeed = _skycoin.SKY_api_Client_NewSeed - -def SKY_api_Client_GetWalletSeed(p0, p1, p2): - return _skycoin.SKY_api_Client_GetWalletSeed(p0, p1, p2) -SKY_api_Client_GetWalletSeed = _skycoin.SKY_api_Client_GetWalletSeed - -def SKY_api_Client_NetworkConnection(p0, p1): - return _skycoin.SKY_api_Client_NetworkConnection(p0, p1) -SKY_api_Client_NetworkConnection = _skycoin.SKY_api_Client_NetworkConnection - -def SKY_api_Client_NetworkConnections(p0): - return _skycoin.SKY_api_Client_NetworkConnections(p0) -SKY_api_Client_NetworkConnections = _skycoin.SKY_api_Client_NetworkConnections - -def SKY_api_Client_NetworkDefaultConnections(p0): - return _skycoin.SKY_api_Client_NetworkDefaultConnections(p0) -SKY_api_Client_NetworkDefaultConnections = _skycoin.SKY_api_Client_NetworkDefaultConnections - -def SKY_api_Client_NetworkTrustedConnections(p0): - return _skycoin.SKY_api_Client_NetworkTrustedConnections(p0) -SKY_api_Client_NetworkTrustedConnections = _skycoin.SKY_api_Client_NetworkTrustedConnections - -def SKY_api_Client_NetworkExchangeableConnections(p0): - return _skycoin.SKY_api_Client_NetworkExchangeableConnections(p0) -SKY_api_Client_NetworkExchangeableConnections = _skycoin.SKY_api_Client_NetworkExchangeableConnections - -def SKY_api_Client_PendingTransactions(p0): - return _skycoin.SKY_api_Client_PendingTransactions(p0) -SKY_api_Client_PendingTransactions = _skycoin.SKY_api_Client_PendingTransactions - -def SKY_api_Client_Transaction(p0, p1): - return _skycoin.SKY_api_Client_Transaction(p0, p1) -SKY_api_Client_Transaction = _skycoin.SKY_api_Client_Transaction - -def SKY_api_Client_Transactions(p0, p1): - return _skycoin.SKY_api_Client_Transactions(p0, p1) -SKY_api_Client_Transactions = _skycoin.SKY_api_Client_Transactions - -def SKY_api_Client_ConfirmedTransactions(p0, p1): - return _skycoin.SKY_api_Client_ConfirmedTransactions(p0, p1) -SKY_api_Client_ConfirmedTransactions = _skycoin.SKY_api_Client_ConfirmedTransactions - -def SKY_api_Client_UnconfirmedTransactions(p0, p1): - return _skycoin.SKY_api_Client_UnconfirmedTransactions(p0, p1) -SKY_api_Client_UnconfirmedTransactions = _skycoin.SKY_api_Client_UnconfirmedTransactions - -def SKY_api_Client_InjectTransaction(p0, p1): - return _skycoin.SKY_api_Client_InjectTransaction(p0, p1) -SKY_api_Client_InjectTransaction = _skycoin.SKY_api_Client_InjectTransaction - -def SKY_api_Client_ResendUnconfirmedTransactions(p0): - return _skycoin.SKY_api_Client_ResendUnconfirmedTransactions(p0) -SKY_api_Client_ResendUnconfirmedTransactions = _skycoin.SKY_api_Client_ResendUnconfirmedTransactions - -def SKY_api_Client_RawTransaction(p0, p1): - return _skycoin.SKY_api_Client_RawTransaction(p0, p1) -SKY_api_Client_RawTransaction = _skycoin.SKY_api_Client_RawTransaction - -def SKY_api_Client_AddressTransactions(p0, p1): - return _skycoin.SKY_api_Client_AddressTransactions(p0, p1) -SKY_api_Client_AddressTransactions = _skycoin.SKY_api_Client_AddressTransactions - -def SKY_api_Client_Richlist(p0, p1): - return _skycoin.SKY_api_Client_Richlist(p0, p1) -SKY_api_Client_Richlist = _skycoin.SKY_api_Client_Richlist - -def SKY_api_Client_AddressCount(p0): - return _skycoin.SKY_api_Client_AddressCount(p0) -SKY_api_Client_AddressCount = _skycoin.SKY_api_Client_AddressCount - -def SKY_api_Client_UnloadWallet(p0, p1): - return _skycoin.SKY_api_Client_UnloadWallet(p0, p1) -SKY_api_Client_UnloadWallet = _skycoin.SKY_api_Client_UnloadWallet - -def SKY_api_Client_Health(p0): - return _skycoin.SKY_api_Client_Health(p0) -SKY_api_Client_Health = _skycoin.SKY_api_Client_Health - -def SKY_api_Client_EncryptWallet(p0, p1, p2): - return _skycoin.SKY_api_Client_EncryptWallet(p0, p1, p2) -SKY_api_Client_EncryptWallet = _skycoin.SKY_api_Client_EncryptWallet - -def SKY_api_Client_DecryptWallet(p0, p1, p2): - return _skycoin.SKY_api_Client_DecryptWallet(p0, p1, p2) -SKY_api_Client_DecryptWallet = _skycoin.SKY_api_Client_DecryptWallet - -def SKY_secp256k1go_XY_Print(p0, p1): - return _skycoin.SKY_secp256k1go_XY_Print(p0, p1) -SKY_secp256k1go_XY_Print = _skycoin.SKY_secp256k1go_XY_Print - -def SKY_secp256k1go_XY_ParsePubkey(p0, p1): - return _skycoin.SKY_secp256k1go_XY_ParsePubkey(p0, p1) -SKY_secp256k1go_XY_ParsePubkey = _skycoin.SKY_secp256k1go_XY_ParsePubkey - -def SKY_secp256k1go_XY_Bytes(p0): - return _skycoin.SKY_secp256k1go_XY_Bytes(p0) -SKY_secp256k1go_XY_Bytes = _skycoin.SKY_secp256k1go_XY_Bytes - -def SKY_secp256k1go_XY_BytesUncompressed(p0): - return _skycoin.SKY_secp256k1go_XY_BytesUncompressed(p0) -SKY_secp256k1go_XY_BytesUncompressed = _skycoin.SKY_secp256k1go_XY_BytesUncompressed - -def SKY_secp256k1go_XY_SetXY(p0, p1, p2): - return _skycoin.SKY_secp256k1go_XY_SetXY(p0, p1, p2) -SKY_secp256k1go_XY_SetXY = _skycoin.SKY_secp256k1go_XY_SetXY - -def SKY_secp256k1go_XY_IsValid(p0): - return _skycoin.SKY_secp256k1go_XY_IsValid(p0) -SKY_secp256k1go_XY_IsValid = _skycoin.SKY_secp256k1go_XY_IsValid - -def SKY_secp256k1go_XY_SetXYZ(p0, p1): - return _skycoin.SKY_secp256k1go_XY_SetXYZ(p0, p1) -SKY_secp256k1go_XY_SetXYZ = _skycoin.SKY_secp256k1go_XY_SetXYZ - -def SKY_secp256k1go_XY_Neg(p0, p1): - return _skycoin.SKY_secp256k1go_XY_Neg(p0, p1) -SKY_secp256k1go_XY_Neg = _skycoin.SKY_secp256k1go_XY_Neg - -def SKY_secp256k1go_XY_SetXO(p0, p1, p2): - return _skycoin.SKY_secp256k1go_XY_SetXO(p0, p1, p2) -SKY_secp256k1go_XY_SetXO = _skycoin.SKY_secp256k1go_XY_SetXO - -def SKY_secp256k1go_XY_AddXY(p0, p1): - return _skycoin.SKY_secp256k1go_XY_AddXY(p0, p1) -SKY_secp256k1go_XY_AddXY = _skycoin.SKY_secp256k1go_XY_AddXY - -def SKY_secp256k1go_XY_GetPublicKey(p0): - return _skycoin.SKY_secp256k1go_XY_GetPublicKey(p0) -SKY_secp256k1go_XY_GetPublicKey = _skycoin.SKY_secp256k1go_XY_GetPublicKey - -def SKY_api_NewWalletResponse(p0): - return _skycoin.SKY_api_NewWalletResponse(p0) -SKY_api_NewWalletResponse = _skycoin.SKY_api_NewWalletResponse - -def SKY_api_NewCreateTransactionResponse(p0, p1): - return _skycoin.SKY_api_NewCreateTransactionResponse(p0, p1) -SKY_api_NewCreateTransactionResponse = _skycoin.SKY_api_NewCreateTransactionResponse - -def SKY_api_NewCreatedTransaction(p0, p1): - return _skycoin.SKY_api_NewCreatedTransaction(p0, p1) -SKY_api_NewCreatedTransaction = _skycoin.SKY_api_NewCreatedTransaction - -def SKY_api_CreatedTransaction_ToTransaction(p0): - return _skycoin.SKY_api_CreatedTransaction_ToTransaction(p0) -SKY_api_CreatedTransaction_ToTransaction = _skycoin.SKY_api_CreatedTransaction_ToTransaction - -def SKY_api_NewCreatedTransactionOutput(p0, p1): - return _skycoin.SKY_api_NewCreatedTransactionOutput(p0, p1) -SKY_api_NewCreatedTransactionOutput = _skycoin.SKY_api_NewCreatedTransactionOutput - -def SKY_api_NewCreatedTransactionInput(p0): - return _skycoin.SKY_api_NewCreatedTransactionInput(p0) -SKY_api_NewCreatedTransactionInput = _skycoin.SKY_api_NewCreatedTransactionInput - -def SKY_wallet_NewError(p0): - return _skycoin.SKY_wallet_NewError(p0) -SKY_wallet_NewError = _skycoin.SKY_wallet_NewError - -def SKY_wallet_NewWallet(p0, p1): - return _skycoin.SKY_wallet_NewWallet(p0, p1) -SKY_wallet_NewWallet = _skycoin.SKY_wallet_NewWallet - -def SKY_wallet_Wallet_Lock(p0, p1, p2): - return _skycoin.SKY_wallet_Wallet_Lock(p0, p1, p2) -SKY_wallet_Wallet_Lock = _skycoin.SKY_wallet_Wallet_Lock - -def SKY_wallet_Wallet_Unlock(p0, p1): - return _skycoin.SKY_wallet_Wallet_Unlock(p0, p1) -SKY_wallet_Wallet_Unlock = _skycoin.SKY_wallet_Wallet_Unlock - -def SKY_wallet_Load(p0): - return _skycoin.SKY_wallet_Load(p0) -SKY_wallet_Load = _skycoin.SKY_wallet_Load - -def SKY_wallet_Wallet_Save(p0, p1): - return _skycoin.SKY_wallet_Wallet_Save(p0, p1) -SKY_wallet_Wallet_Save = _skycoin.SKY_wallet_Wallet_Save - -def SKY_wallet_Wallet_Validate(p0): - return _skycoin.SKY_wallet_Wallet_Validate(p0) -SKY_wallet_Wallet_Validate = _skycoin.SKY_wallet_Wallet_Validate - -def SKY_wallet_Wallet_Type(p0): - return _skycoin.SKY_wallet_Wallet_Type(p0) -SKY_wallet_Wallet_Type = _skycoin.SKY_wallet_Wallet_Type - -def SKY_wallet_Wallet_Version(p0): - return _skycoin.SKY_wallet_Wallet_Version(p0) -SKY_wallet_Wallet_Version = _skycoin.SKY_wallet_Wallet_Version - -def SKY_wallet_Wallet_Filename(p0): - return _skycoin.SKY_wallet_Wallet_Filename(p0) -SKY_wallet_Wallet_Filename = _skycoin.SKY_wallet_Wallet_Filename - -def SKY_wallet_Wallet_Label(p0): - return _skycoin.SKY_wallet_Wallet_Label(p0) -SKY_wallet_Wallet_Label = _skycoin.SKY_wallet_Wallet_Label - -def SKY_wallet_Wallet_IsEncrypted(p0): - return _skycoin.SKY_wallet_Wallet_IsEncrypted(p0) -SKY_wallet_Wallet_IsEncrypted = _skycoin.SKY_wallet_Wallet_IsEncrypted - -def SKY_wallet_Wallet_GenerateAddresses(p0, p1): - return _skycoin.SKY_wallet_Wallet_GenerateAddresses(p0, p1) -SKY_wallet_Wallet_GenerateAddresses = _skycoin.SKY_wallet_Wallet_GenerateAddresses - -def SKY_wallet_Wallet_GetAddresses(p0): - return _skycoin.SKY_wallet_Wallet_GetAddresses(p0) -SKY_wallet_Wallet_GetAddresses = _skycoin.SKY_wallet_Wallet_GetAddresses - -def SKY_wallet_Wallet_GetEntry(p0, p1, p2): - return _skycoin.SKY_wallet_Wallet_GetEntry(p0, p1, p2) -SKY_wallet_Wallet_GetEntry = _skycoin.SKY_wallet_Wallet_GetEntry - -def SKY_wallet_Wallet_AddEntry(p0, p1): - return _skycoin.SKY_wallet_Wallet_AddEntry(p0, p1) -SKY_wallet_Wallet_AddEntry = _skycoin.SKY_wallet_Wallet_AddEntry - -def SKY_wallet_DistributeSpendHours(p0, p1, p2): - return _skycoin.SKY_wallet_DistributeSpendHours(p0, p1, p2) -SKY_wallet_DistributeSpendHours = _skycoin.SKY_wallet_DistributeSpendHours - -def SKY_wallet_DistributeCoinHoursProportional(p0, p1): - return _skycoin.SKY_wallet_DistributeCoinHoursProportional(p0, p1) -SKY_wallet_DistributeCoinHoursProportional = _skycoin.SKY_wallet_DistributeCoinHoursProportional - -def SKY_wallet_NewUxBalances(p0): - return _skycoin.SKY_wallet_NewUxBalances(p0) -SKY_wallet_NewUxBalances = _skycoin.SKY_wallet_NewUxBalances - -def SKY_wallet_NewUxBalance(p0, p1, p2): - return _skycoin.SKY_wallet_NewUxBalance(p0, p1, p2) -SKY_wallet_NewUxBalance = _skycoin.SKY_wallet_NewUxBalance - -def SKY_wallet_ChooseSpendsMinimizeUxOuts(p0, p1, p2): - return _skycoin.SKY_wallet_ChooseSpendsMinimizeUxOuts(p0, p1, p2) -SKY_wallet_ChooseSpendsMinimizeUxOuts = _skycoin.SKY_wallet_ChooseSpendsMinimizeUxOuts - -def SKY_wallet_ChooseSpendsMaximizeUxOuts(p0, p1, p2): - return _skycoin.SKY_wallet_ChooseSpendsMaximizeUxOuts(p0, p1, p2) -SKY_wallet_ChooseSpendsMaximizeUxOuts = _skycoin.SKY_wallet_ChooseSpendsMaximizeUxOuts - -def SKY_cli_CheckWalletBalance(p0, p1, p2): - return _skycoin.SKY_cli_CheckWalletBalance(p0, p1, p2) -SKY_cli_CheckWalletBalance = _skycoin.SKY_cli_CheckWalletBalance - -def SKY_cli_GetBalanceOfAddresses(p0, p1, p2): - return _skycoin.SKY_cli_GetBalanceOfAddresses(p0, p1, p2) -SKY_cli_GetBalanceOfAddresses = _skycoin.SKY_cli_GetBalanceOfAddresses - -def SKY_wallet_NewReadableEntry(p0): - return _skycoin.SKY_wallet_NewReadableEntry(p0) -SKY_wallet_NewReadableEntry = _skycoin.SKY_wallet_NewReadableEntry - -def SKY_wallet_LoadReadableEntry(p0): - return _skycoin.SKY_wallet_LoadReadableEntry(p0) -SKY_wallet_LoadReadableEntry = _skycoin.SKY_wallet_LoadReadableEntry - -def SKY_wallet_NewReadableEntryFromPubkey(p0): - return _skycoin.SKY_wallet_NewReadableEntryFromPubkey(p0) -SKY_wallet_NewReadableEntryFromPubkey = _skycoin.SKY_wallet_NewReadableEntryFromPubkey - -def SKY_wallet_ReadableEntry_Save(p0, p1): - return _skycoin.SKY_wallet_ReadableEntry_Save(p0, p1) -SKY_wallet_ReadableEntry_Save = _skycoin.SKY_wallet_ReadableEntry_Save - -def SKY_wallet_LoadReadableWallet(p0): - return _skycoin.SKY_wallet_LoadReadableWallet(p0) -SKY_wallet_LoadReadableWallet = _skycoin.SKY_wallet_LoadReadableWallet - -def SKY_wallet_ReadableWallet_Save(p0, p1): - return _skycoin.SKY_wallet_ReadableWallet_Save(p0, p1) -SKY_wallet_ReadableWallet_Save = _skycoin.SKY_wallet_ReadableWallet_Save - -def SKY_wallet_ReadableWallet_Load(p0, p1): - return _skycoin.SKY_wallet_ReadableWallet_Load(p0, p1) -SKY_wallet_ReadableWallet_Load = _skycoin.SKY_wallet_ReadableWallet_Load - -def SKY_wallet_ReadableWallet_Erase(p0): - return _skycoin.SKY_wallet_ReadableWallet_Erase(p0) -SKY_wallet_ReadableWallet_Erase = _skycoin.SKY_wallet_ReadableWallet_Erase - -def SKY_secp256k1go_DecompressPoint(p0, p1, p2): - return _skycoin.SKY_secp256k1go_DecompressPoint(p0, p1, p2) -SKY_secp256k1go_DecompressPoint = _skycoin.SKY_secp256k1go_DecompressPoint - -def SKY_secp256k1go_RecoverPublicKey(p0, p1, p2): - return _skycoin.SKY_secp256k1go_RecoverPublicKey(p0, p1, p2) -SKY_secp256k1go_RecoverPublicKey = _skycoin.SKY_secp256k1go_RecoverPublicKey - -def SKY_secp256k1go_Multiply(p0, p1): - return _skycoin.SKY_secp256k1go_Multiply(p0, p1) -SKY_secp256k1go_Multiply = _skycoin.SKY_secp256k1go_Multiply - -def SKY_secp256k1go_BaseMultiply(p0): - return _skycoin.SKY_secp256k1go_BaseMultiply(p0) -SKY_secp256k1go_BaseMultiply = _skycoin.SKY_secp256k1go_BaseMultiply - -def SKY_secp256k1go_BaseMultiplyAdd(p0, p1): - return _skycoin.SKY_secp256k1go_BaseMultiplyAdd(p0, p1) -SKY_secp256k1go_BaseMultiplyAdd = _skycoin.SKY_secp256k1go_BaseMultiplyAdd - -def SKY_secp256k1go_GeneratePublicKey(p0): - return _skycoin.SKY_secp256k1go_GeneratePublicKey(p0) -SKY_secp256k1go_GeneratePublicKey = _skycoin.SKY_secp256k1go_GeneratePublicKey - -def SKY_secp256k1go_SeckeyIsValid(p0): - return _skycoin.SKY_secp256k1go_SeckeyIsValid(p0) -SKY_secp256k1go_SeckeyIsValid = _skycoin.SKY_secp256k1go_SeckeyIsValid - -def SKY_secp256k1go_PubkeyIsValid(p0): - return _skycoin.SKY_secp256k1go_PubkeyIsValid(p0) -SKY_secp256k1go_PubkeyIsValid = _skycoin.SKY_secp256k1go_PubkeyIsValid - -def SKY_base58_String2Hex(p0): - return _skycoin.SKY_base58_String2Hex(p0) -SKY_base58_String2Hex = _skycoin.SKY_base58_String2Hex - -def SKY_base58_Base58_ToInt(p0): - return _skycoin.SKY_base58_Base58_ToInt(p0) -SKY_base58_Base58_ToInt = _skycoin.SKY_base58_Base58_ToInt - -def SKY_base58_Base58_ToHex(p0): - return _skycoin.SKY_base58_Base58_ToHex(p0) -SKY_base58_Base58_ToHex = _skycoin.SKY_base58_Base58_ToHex - -def SKY_base58_Base58_Base582Int(p0): - return _skycoin.SKY_base58_Base58_Base582Int(p0) -SKY_base58_Base58_Base582Int = _skycoin.SKY_base58_Base58_Base582Int - -def SKY_base58_Base582Hex(p0): - return _skycoin.SKY_base58_Base582Hex(p0) -SKY_base58_Base582Hex = _skycoin.SKY_base58_Base582Hex - -def SKY_base58_Base58_BitHex(p0): - return _skycoin.SKY_base58_Base58_BitHex(p0) -SKY_base58_Base58_BitHex = _skycoin.SKY_base58_Base58_BitHex - -def SKY_base58_Int2Base58(p0): - return _skycoin.SKY_base58_Int2Base58(p0) -SKY_base58_Int2Base58 = _skycoin.SKY_base58_Int2Base58 - -def SKY_base58_Hex2Base58(p0): - return _skycoin.SKY_base58_Hex2Base58(p0) -SKY_base58_Hex2Base58 = _skycoin.SKY_base58_Hex2Base58 - -def SKY_base58_Hex2Base58String(p0): - return _skycoin.SKY_base58_Hex2Base58String(p0) -SKY_base58_Hex2Base58String = _skycoin.SKY_base58_Hex2Base58String - -def SKY_base58_Hex2Base58Str(p0): - return _skycoin.SKY_base58_Hex2Base58Str(p0) -SKY_base58_Hex2Base58Str = _skycoin.SKY_base58_Hex2Base58Str - -def SKY_cli_GenerateWallet(p0, p2): - return _skycoin.SKY_cli_GenerateWallet(p0, p2) -SKY_cli_GenerateWallet = _skycoin.SKY_cli_GenerateWallet - -def SKY_cli_MakeAlphanumericSeed(): - return _skycoin.SKY_cli_MakeAlphanumericSeed() -SKY_cli_MakeAlphanumericSeed = _skycoin.SKY_cli_MakeAlphanumericSeed - -def SKY_webrpc_NewClient(p0): - return _skycoin.SKY_webrpc_NewClient(p0) -SKY_webrpc_NewClient = _skycoin.SKY_webrpc_NewClient - -def SKY_webrpc_Client_CSRF(p0): - return _skycoin.SKY_webrpc_Client_CSRF(p0) -SKY_webrpc_Client_CSRF = _skycoin.SKY_webrpc_Client_CSRF - -def SKY_webrpc_Client_InjectTransaction(p0, p1): - return _skycoin.SKY_webrpc_Client_InjectTransaction(p0, p1) -SKY_webrpc_Client_InjectTransaction = _skycoin.SKY_webrpc_Client_InjectTransaction - -def SKY_webrpc_Client_GetStatus(p0, p1): - return _skycoin.SKY_webrpc_Client_GetStatus(p0, p1) -SKY_webrpc_Client_GetStatus = _skycoin.SKY_webrpc_Client_GetStatus - -def SKY_webrpc_Client_GetTransactionByID(p0, p1, p2): - return _skycoin.SKY_webrpc_Client_GetTransactionByID(p0, p1, p2) -SKY_webrpc_Client_GetTransactionByID = _skycoin.SKY_webrpc_Client_GetTransactionByID - -def SKY_webrpc_Client_GetAddressUxOuts(p0, p1): - return _skycoin.SKY_webrpc_Client_GetAddressUxOuts(p0, p1) -SKY_webrpc_Client_GetAddressUxOuts = _skycoin.SKY_webrpc_Client_GetAddressUxOuts - -def SKY_webrpc_Client_GetBlocks(p0, p1, p2): - return _skycoin.SKY_webrpc_Client_GetBlocks(p0, p1, p2) -SKY_webrpc_Client_GetBlocks = _skycoin.SKY_webrpc_Client_GetBlocks - -def SKY_webrpc_Client_GetBlocksBySeq(p0, p1): - return _skycoin.SKY_webrpc_Client_GetBlocksBySeq(p0, p1) -SKY_webrpc_Client_GetBlocksBySeq = _skycoin.SKY_webrpc_Client_GetBlocksBySeq - -def SKY_webrpc_Client_GetLastBlocks(p0, p1): - return _skycoin.SKY_webrpc_Client_GetLastBlocks(p0, p1) -SKY_webrpc_Client_GetLastBlocks = _skycoin.SKY_webrpc_Client_GetLastBlocks - -def SKY_browser_Open(p0): - return _skycoin.SKY_browser_Open(p0) -SKY_browser_Open = _skycoin.SKY_browser_Open - -def SKY_iputil_LocalhostIP(): - return _skycoin.SKY_iputil_LocalhostIP() -SKY_iputil_LocalhostIP = _skycoin.SKY_iputil_LocalhostIP - -def SKY_iputil_IsLocalhost(p0): - return _skycoin.SKY_iputil_IsLocalhost(p0) -SKY_iputil_IsLocalhost = _skycoin.SKY_iputil_IsLocalhost - -def SKY_iputil_SplitAddr(p0): - return _skycoin.SKY_iputil_SplitAddr(p0) -SKY_iputil_SplitAddr = _skycoin.SKY_iputil_SplitAddr - -def SKY_encoder_StructField_String(p0): - return _skycoin.SKY_encoder_StructField_String(p0) -SKY_encoder_StructField_String = _skycoin.SKY_encoder_StructField_String - -def SKY_encoder_ParseFields(p0, p1): - return _skycoin.SKY_encoder_ParseFields(p0, p1) -SKY_encoder_ParseFields = _skycoin.SKY_encoder_ParseFields - -def SKY_secp256k1_SumSHA256(p0): - return _skycoin.SKY_secp256k1_SumSHA256(p0) -SKY_secp256k1_SumSHA256 = _skycoin.SKY_secp256k1_SumSHA256 - -def SKY_secp256k1_RandByte(p0): - return _skycoin.SKY_secp256k1_RandByte(p0) -SKY_secp256k1_RandByte = _skycoin.SKY_secp256k1_RandByte - -def SKY_cli_GenerateAddressesInFile(p0, p1, p2): - return _skycoin.SKY_cli_GenerateAddressesInFile(p0, p1, p2) -SKY_cli_GenerateAddressesInFile = _skycoin.SKY_cli_GenerateAddressesInFile - -def SKY_cli_FormatAddressesAsJSON(p0): - return _skycoin.SKY_cli_FormatAddressesAsJSON(p0) -SKY_cli_FormatAddressesAsJSON = _skycoin.SKY_cli_FormatAddressesAsJSON - -def SKY_cli_FormatAddressesAsJoinedArray(p0): - return _skycoin.SKY_cli_FormatAddressesAsJoinedArray(p0) -SKY_cli_FormatAddressesAsJoinedArray = _skycoin.SKY_cli_FormatAddressesAsJoinedArray - -def SKY_cli_AddressesToStrings(p0): - return _skycoin.SKY_cli_AddressesToStrings(p0) -SKY_cli_AddressesToStrings = _skycoin.SKY_cli_AddressesToStrings - -def SKY_coin_AddUint64(p0, p1): - return _skycoin.SKY_coin_AddUint64(p0, p1) -SKY_coin_AddUint64 = _skycoin.SKY_coin_AddUint64 - -def SKY_coin_Uint64ToInt64(p0): - return _skycoin.SKY_coin_Uint64ToInt64(p0) -SKY_coin_Uint64ToInt64 = _skycoin.SKY_coin_Uint64ToInt64 - -def SKY_coin_Int64ToUint64(p0): - return _skycoin.SKY_coin_Int64ToUint64(p0) -SKY_coin_Int64ToUint64 = _skycoin.SKY_coin_Int64ToUint64 - -def SKY_cipher_PubKeySlice_Len(*args): - return _skycoin.SKY_cipher_PubKeySlice_Len(*args) -SKY_cipher_PubKeySlice_Len = _skycoin.SKY_cipher_PubKeySlice_Len - -def SKY_cipher_PubKeySlice_Less(*args): - return _skycoin.SKY_cipher_PubKeySlice_Less(*args) -SKY_cipher_PubKeySlice_Less = _skycoin.SKY_cipher_PubKeySlice_Less - -def SKY_cipher_PubKeySlice_Swap(*args): - return _skycoin.SKY_cipher_PubKeySlice_Swap(*args) -SKY_cipher_PubKeySlice_Swap = _skycoin.SKY_cipher_PubKeySlice_Swap - -def SKY_cipher_RandByte(p0): - return _skycoin.SKY_cipher_RandByte(p0) -SKY_cipher_RandByte = _skycoin.SKY_cipher_RandByte - -def SKY_cipher_NewPubKey(p0, p1): - return _skycoin.SKY_cipher_NewPubKey(p0, p1) -SKY_cipher_NewPubKey = _skycoin.SKY_cipher_NewPubKey - -def SKY_cipher_PubKeyFromHex(p0, p1): - return _skycoin.SKY_cipher_PubKeyFromHex(p0, p1) -SKY_cipher_PubKeyFromHex = _skycoin.SKY_cipher_PubKeyFromHex - -def SKY_cipher_PubKeyFromSecKey(p0, p1): - return _skycoin.SKY_cipher_PubKeyFromSecKey(p0, p1) -SKY_cipher_PubKeyFromSecKey = _skycoin.SKY_cipher_PubKeyFromSecKey - -def SKY_cipher_PubKeyFromSig(p0, p1, p2): - return _skycoin.SKY_cipher_PubKeyFromSig(p0, p1, p2) -SKY_cipher_PubKeyFromSig = _skycoin.SKY_cipher_PubKeyFromSig - -def SKY_cipher_PubKey_Verify(p0): - return _skycoin.SKY_cipher_PubKey_Verify(p0) -SKY_cipher_PubKey_Verify = _skycoin.SKY_cipher_PubKey_Verify - -def SKY_cipher_PubKey_Hex(p0): - return _skycoin.SKY_cipher_PubKey_Hex(p0) -SKY_cipher_PubKey_Hex = _skycoin.SKY_cipher_PubKey_Hex - -def SKY_cipher_PubKey_ToAddressHash(p0, p1): - return _skycoin.SKY_cipher_PubKey_ToAddressHash(p0, p1) -SKY_cipher_PubKey_ToAddressHash = _skycoin.SKY_cipher_PubKey_ToAddressHash - -def SKY_cipher_NewSecKey(p0, p1): - return _skycoin.SKY_cipher_NewSecKey(p0, p1) -SKY_cipher_NewSecKey = _skycoin.SKY_cipher_NewSecKey - -def SKY_cipher_SecKeyFromHex(p0, p1): - return _skycoin.SKY_cipher_SecKeyFromHex(p0, p1) -SKY_cipher_SecKeyFromHex = _skycoin.SKY_cipher_SecKeyFromHex - -def SKY_cipher_SecKey_Verify(p0): - return _skycoin.SKY_cipher_SecKey_Verify(p0) -SKY_cipher_SecKey_Verify = _skycoin.SKY_cipher_SecKey_Verify - -def SKY_cipher_SecKey_Hex(p0): - return _skycoin.SKY_cipher_SecKey_Hex(p0) -SKY_cipher_SecKey_Hex = _skycoin.SKY_cipher_SecKey_Hex - -def SKY_cipher_ECDH(p0, p1): - return _skycoin.SKY_cipher_ECDH(p0, p1) -SKY_cipher_ECDH = _skycoin.SKY_cipher_ECDH - -def SKY_cipher_NewSig(p0, p1): - return _skycoin.SKY_cipher_NewSig(p0, p1) -SKY_cipher_NewSig = _skycoin.SKY_cipher_NewSig - -def SKY_cipher_SigFromHex(p0, p1): - return _skycoin.SKY_cipher_SigFromHex(p0, p1) -SKY_cipher_SigFromHex = _skycoin.SKY_cipher_SigFromHex - -def SKY_cipher_Sig_Hex(p0): - return _skycoin.SKY_cipher_Sig_Hex(p0) -SKY_cipher_Sig_Hex = _skycoin.SKY_cipher_Sig_Hex - -def SKY_cipher_SignHash(p0, p1, p2): - return _skycoin.SKY_cipher_SignHash(p0, p1, p2) -SKY_cipher_SignHash = _skycoin.SKY_cipher_SignHash - -def SKY_cipher_ChkSig(p0, p1, p2): - return _skycoin.SKY_cipher_ChkSig(p0, p1, p2) -SKY_cipher_ChkSig = _skycoin.SKY_cipher_ChkSig - -def SKY_cipher_VerifySignedHash(p0, p1): - return _skycoin.SKY_cipher_VerifySignedHash(p0, p1) -SKY_cipher_VerifySignedHash = _skycoin.SKY_cipher_VerifySignedHash - -def SKY_cipher_VerifySignature(p0, p1, p2): - return _skycoin.SKY_cipher_VerifySignature(p0, p1, p2) -SKY_cipher_VerifySignature = _skycoin.SKY_cipher_VerifySignature - -def SKY_cipher_GenerateDeterministicKeyPair(p0, p1, p2): - return _skycoin.SKY_cipher_GenerateDeterministicKeyPair(p0, p1, p2) -SKY_cipher_GenerateDeterministicKeyPair = _skycoin.SKY_cipher_GenerateDeterministicKeyPair - -def SKY_cipher_DeterministicKeyPairIterator(p0, p2, p3): - return _skycoin.SKY_cipher_DeterministicKeyPairIterator(p0, p2, p3) -SKY_cipher_DeterministicKeyPairIterator = _skycoin.SKY_cipher_DeterministicKeyPairIterator - -def SKY_cipher_GenerateDeterministicKeyPairs(*args): - return _skycoin.SKY_cipher_GenerateDeterministicKeyPairs(*args) -SKY_cipher_GenerateDeterministicKeyPairs = _skycoin.SKY_cipher_GenerateDeterministicKeyPairs - -def SKY_cipher_GenerateDeterministicKeyPairsSeed(*args): - return _skycoin.SKY_cipher_GenerateDeterministicKeyPairsSeed(*args) -SKY_cipher_GenerateDeterministicKeyPairsSeed = _skycoin.SKY_cipher_GenerateDeterministicKeyPairsSeed - -def SKY_cipher_TestSecKey(p0): - return _skycoin.SKY_cipher_TestSecKey(p0) -SKY_cipher_TestSecKey = _skycoin.SKY_cipher_TestSecKey - -def SKY_cipher_TestSecKeyHash(p0, p1): - return _skycoin.SKY_cipher_TestSecKeyHash(p0, p1) -SKY_cipher_TestSecKeyHash = _skycoin.SKY_cipher_TestSecKeyHash - -def SKY_cipher_GenerateKeyPair(p0, p1): - return _skycoin.SKY_cipher_GenerateKeyPair(p0, p1) -SKY_cipher_GenerateKeyPair = _skycoin.SKY_cipher_GenerateKeyPair - -def SKY_secp256k1go_Signature_Create(): - return _skycoin.SKY_secp256k1go_Signature_Create() -SKY_secp256k1go_Signature_Create = _skycoin.SKY_secp256k1go_Signature_Create - -def SKY_secp256k1go_Signature_GetR(p0): - return _skycoin.SKY_secp256k1go_Signature_GetR(p0) -SKY_secp256k1go_Signature_GetR = _skycoin.SKY_secp256k1go_Signature_GetR - -def SKY_secp256k1go_Signature_GetS(p0): - return _skycoin.SKY_secp256k1go_Signature_GetS(p0) -SKY_secp256k1go_Signature_GetS = _skycoin.SKY_secp256k1go_Signature_GetS - -def SKY_secp256k1go_Signature_Print(p0, p1): - return _skycoin.SKY_secp256k1go_Signature_Print(p0, p1) -SKY_secp256k1go_Signature_Print = _skycoin.SKY_secp256k1go_Signature_Print - -def SKY_secp256k1go_Signature_Verify(p0, p1, p2): - return _skycoin.SKY_secp256k1go_Signature_Verify(p0, p1, p2) -SKY_secp256k1go_Signature_Verify = _skycoin.SKY_secp256k1go_Signature_Verify - -def SKY_secp256k1go_Signature_Recover(p0, p1, p2, p3): - return _skycoin.SKY_secp256k1go_Signature_Recover(p0, p1, p2, p3) -SKY_secp256k1go_Signature_Recover = _skycoin.SKY_secp256k1go_Signature_Recover - -def SKY_secp256k1go_Signature_Sign(p0, p1, p2, p3): - return _skycoin.SKY_secp256k1go_Signature_Sign(p0, p1, p2, p3) -SKY_secp256k1go_Signature_Sign = _skycoin.SKY_secp256k1go_Signature_Sign - -def SKY_secp256k1go_Signature_ParseBytes(p0, p1): - return _skycoin.SKY_secp256k1go_Signature_ParseBytes(p0, p1) -SKY_secp256k1go_Signature_ParseBytes = _skycoin.SKY_secp256k1go_Signature_ParseBytes - -def SKY_secp256k1go_Signature_Bytes(p0): - return _skycoin.SKY_secp256k1go_Signature_Bytes(p0) -SKY_secp256k1go_Signature_Bytes = _skycoin.SKY_secp256k1go_Signature_Bytes - -def SKY_cli_App_Run(p0, p1): - return _skycoin.SKY_cli_App_Run(p0, p1) -SKY_cli_App_Run = _skycoin.SKY_cli_App_Run - -def SKY_cli_Config_GetCoin(p0): - return _skycoin.SKY_cli_Config_GetCoin(p0) -SKY_cli_Config_GetCoin = _skycoin.SKY_cli_Config_GetCoin - -def SKY_cli_Config_GetRPCAddress(p0): - return _skycoin.SKY_cli_Config_GetRPCAddress(p0) -SKY_cli_Config_GetRPCAddress = _skycoin.SKY_cli_Config_GetRPCAddress - -def SKY_cli_RPCClientFromApp(p0): - return _skycoin.SKY_cli_RPCClientFromApp(p0) -SKY_cli_RPCClientFromApp = _skycoin.SKY_cli_RPCClientFromApp - -def SKY_cli_Getenv(p0): - return _skycoin.SKY_cli_Getenv(p0) -SKY_cli_Getenv = _skycoin.SKY_cli_Getenv - -def SKY_cli_Setenv(p0, p1): - return _skycoin.SKY_cli_Setenv(p0, p1) -SKY_cli_Setenv = _skycoin.SKY_cli_Setenv - -def SKY_poly1305_Verify(p1): - return _skycoin.SKY_poly1305_Verify(p1) -SKY_poly1305_Verify = _skycoin.SKY_poly1305_Verify - -def SKY_wallet_NewBalance(p0, p1, p2): - return _skycoin.SKY_wallet_NewBalance(p0, p1, p2) -SKY_wallet_NewBalance = _skycoin.SKY_wallet_NewBalance - -def SKY_wallet_NewBalanceFromUxOut(p0, p1, p2): - return _skycoin.SKY_wallet_NewBalanceFromUxOut(p0, p1, p2) -SKY_wallet_NewBalanceFromUxOut = _skycoin.SKY_wallet_NewBalanceFromUxOut - -def SKY_wallet_Balance_Add(p0, p1, p2): - return _skycoin.SKY_wallet_Balance_Add(p0, p1, p2) -SKY_wallet_Balance_Add = _skycoin.SKY_wallet_Balance_Add - -def SKY_wallet_Balance_Sub(p0, p1, p2): - return _skycoin.SKY_wallet_Balance_Sub(p0, p1, p2) -SKY_wallet_Balance_Sub = _skycoin.SKY_wallet_Balance_Sub - -def SKY_wallet_Balance_Equals(p0, p1): - return _skycoin.SKY_wallet_Balance_Equals(p0, p1) -SKY_wallet_Balance_Equals = _skycoin.SKY_wallet_Balance_Equals - -def SKY_wallet_Balance_IsZero(p0): - return _skycoin.SKY_wallet_Balance_IsZero(p0) -SKY_wallet_Balance_IsZero = _skycoin.SKY_wallet_Balance_IsZero - -def SKY_utc_UnixNow(): - return _skycoin.SKY_utc_UnixNow() -SKY_utc_UnixNow = _skycoin.SKY_utc_UnixNow - -def SKY_httphelper_Address_UnmarshalJSON(p0, p1): - return _skycoin.SKY_httphelper_Address_UnmarshalJSON(p0, p1) -SKY_httphelper_Address_UnmarshalJSON = _skycoin.SKY_httphelper_Address_UnmarshalJSON - -def SKY_httphelper_Address_MarshalJSON(p0): - return _skycoin.SKY_httphelper_Address_MarshalJSON(p0) -SKY_httphelper_Address_MarshalJSON = _skycoin.SKY_httphelper_Address_MarshalJSON - -def SKY_httphelper_Coins_UnmarshalJSON(p1): - return _skycoin.SKY_httphelper_Coins_UnmarshalJSON(p1) -SKY_httphelper_Coins_UnmarshalJSON = _skycoin.SKY_httphelper_Coins_UnmarshalJSON - -def SKY_httphelper_Coins_MarshalJSON(): - return _skycoin.SKY_httphelper_Coins_MarshalJSON() -SKY_httphelper_Coins_MarshalJSON = _skycoin.SKY_httphelper_Coins_MarshalJSON - -def SKY_httphelper_Coins_Value(): - return _skycoin.SKY_httphelper_Coins_Value() -SKY_httphelper_Coins_Value = _skycoin.SKY_httphelper_Coins_Value - -def SKY_httphelper_Hours_UnmarshalJSON(p1): - return _skycoin.SKY_httphelper_Hours_UnmarshalJSON(p1) -SKY_httphelper_Hours_UnmarshalJSON = _skycoin.SKY_httphelper_Hours_UnmarshalJSON - -def SKY_httphelper_Hours_MarshalJSON(): - return _skycoin.SKY_httphelper_Hours_MarshalJSON() -SKY_httphelper_Hours_MarshalJSON = _skycoin.SKY_httphelper_Hours_MarshalJSON - -def SKY_httphelper_Hours_Value(): - return _skycoin.SKY_httphelper_Hours_Value() -SKY_httphelper_Hours_Value = _skycoin.SKY_httphelper_Hours_Value - -def SKY_wallet_Entry_Verify(p0): - return _skycoin.SKY_wallet_Entry_Verify(p0) -SKY_wallet_Entry_Verify = _skycoin.SKY_wallet_Entry_Verify - -def SKY_wallet_Entry_VerifyPublic(p0): - return _skycoin.SKY_wallet_Entry_VerifyPublic(p0) -SKY_wallet_Entry_VerifyPublic = _skycoin.SKY_wallet_Entry_VerifyPublic - -def SKY_wallet_CreateAddresses(p0, p1, p2, p3): - return _skycoin.SKY_wallet_CreateAddresses(p0, p1, p2, p3) -SKY_wallet_CreateAddresses = _skycoin.SKY_wallet_CreateAddresses - -def SKY_wallet_GetSkycoinWalletEntry(p0, p1): - return _skycoin.SKY_wallet_GetSkycoinWalletEntry(p0, p1) -SKY_wallet_GetSkycoinWalletEntry = _skycoin.SKY_wallet_GetSkycoinWalletEntry - -def SKY_wallet_GetBitcoinWalletEntry(p0, p1): - return _skycoin.SKY_wallet_GetBitcoinWalletEntry(p0, p1) -SKY_wallet_GetBitcoinWalletEntry = _skycoin.SKY_wallet_GetBitcoinWalletEntry - -def SKY_secp256k1go_XYZ_Print(p0, p1): - return _skycoin.SKY_secp256k1go_XYZ_Print(p0, p1) -SKY_secp256k1go_XYZ_Print = _skycoin.SKY_secp256k1go_XYZ_Print - -def SKY_secp256k1go_XYZ_SetXY(p0, p1): - return _skycoin.SKY_secp256k1go_XYZ_SetXY(p0, p1) -SKY_secp256k1go_XYZ_SetXY = _skycoin.SKY_secp256k1go_XYZ_SetXY - -def SKY_secp256k1go_XYZ_IsInfinity(p0): - return _skycoin.SKY_secp256k1go_XYZ_IsInfinity(p0) -SKY_secp256k1go_XYZ_IsInfinity = _skycoin.SKY_secp256k1go_XYZ_IsInfinity - -def SKY_secp256k1go_XYZ_IsValid(p0): - return _skycoin.SKY_secp256k1go_XYZ_IsValid(p0) -SKY_secp256k1go_XYZ_IsValid = _skycoin.SKY_secp256k1go_XYZ_IsValid - -def SKY_secp256k1go_XYZ_Normalize(p0): - return _skycoin.SKY_secp256k1go_XYZ_Normalize(p0) -SKY_secp256k1go_XYZ_Normalize = _skycoin.SKY_secp256k1go_XYZ_Normalize - -def SKY_secp256k1go_XYZ_Equals(p0, p1): - return _skycoin.SKY_secp256k1go_XYZ_Equals(p0, p1) -SKY_secp256k1go_XYZ_Equals = _skycoin.SKY_secp256k1go_XYZ_Equals - -def SKY_secp256k1go_XYZ_ECmult(p0, p1, p2, p3): - return _skycoin.SKY_secp256k1go_XYZ_ECmult(p0, p1, p2, p3) -SKY_secp256k1go_XYZ_ECmult = _skycoin.SKY_secp256k1go_XYZ_ECmult - -def SKY_secp256k1go_XYZ_Neg(p0, p1): - return _skycoin.SKY_secp256k1go_XYZ_Neg(p0, p1) -SKY_secp256k1go_XYZ_Neg = _skycoin.SKY_secp256k1go_XYZ_Neg - -def SKY_secp256k1go_XYZ_Double(p0, p1): - return _skycoin.SKY_secp256k1go_XYZ_Double(p0, p1) -SKY_secp256k1go_XYZ_Double = _skycoin.SKY_secp256k1go_XYZ_Double - -def SKY_secp256k1go_XYZ_AddXY(p0, p1, p2): - return _skycoin.SKY_secp256k1go_XYZ_AddXY(p0, p1, p2) -SKY_secp256k1go_XYZ_AddXY = _skycoin.SKY_secp256k1go_XYZ_AddXY - -def SKY_secp256k1go_XYZ_Add(p0, p1, p2): - return _skycoin.SKY_secp256k1go_XYZ_Add(p0, p1, p2) -SKY_secp256k1go_XYZ_Add = _skycoin.SKY_secp256k1go_XYZ_Add - -def SKY_secp256k1go_ECmultGen(p0, p1): - return _skycoin.SKY_secp256k1go_ECmultGen(p0, p1) -SKY_secp256k1go_ECmultGen = _skycoin.SKY_secp256k1go_ECmultGen - -def SKY_encrypt_Sha256Xor_Encrypt(p0, p1): - return _skycoin.SKY_encrypt_Sha256Xor_Encrypt(p0, p1) -SKY_encrypt_Sha256Xor_Encrypt = _skycoin.SKY_encrypt_Sha256Xor_Encrypt - -def SKY_encrypt_Sha256Xor_Decrypt(p0, p1): - return _skycoin.SKY_encrypt_Sha256Xor_Decrypt(p0, p1) -SKY_encrypt_Sha256Xor_Decrypt = _skycoin.SKY_encrypt_Sha256Xor_Decrypt - -def SKY_droplet_FromString(p0): - return _skycoin.SKY_droplet_FromString(p0) -SKY_droplet_FromString = _skycoin.SKY_droplet_FromString - -def SKY_droplet_ToString(p0): - return _skycoin.SKY_droplet_ToString(p0) -SKY_droplet_ToString = _skycoin.SKY_droplet_ToString - -def SKY_wallet_CryptoTypeFromString(p0): - return _skycoin.SKY_wallet_CryptoTypeFromString(p0) -SKY_wallet_CryptoTypeFromString = _skycoin.SKY_wallet_CryptoTypeFromString - -def SKY_handle_close(p0): - return _skycoin.SKY_handle_close(p0) -SKY_handle_close = _skycoin.SKY_handle_close - -def SKY_handle_copy(p0): - return _skycoin.SKY_handle_copy(p0) -SKY_handle_copy = _skycoin.SKY_handle_copy - -def SKY_logging_EnableColors(): - return _skycoin.SKY_logging_EnableColors() -SKY_logging_EnableColors = _skycoin.SKY_logging_EnableColors - -def SKY_logging_DisableColors(): - return _skycoin.SKY_logging_DisableColors() -SKY_logging_DisableColors = _skycoin.SKY_logging_DisableColors - -def SKY_logging_Disable(): - return _skycoin.SKY_logging_Disable() -SKY_logging_Disable = _skycoin.SKY_logging_Disable - -def SKY_map_Get(p1): - return _skycoin.SKY_map_Get(p1) -SKY_map_Get = _skycoin.SKY_map_Get - -def SKY_map_HasKey(p1): - return _skycoin.SKY_map_HasKey(p1) -SKY_map_HasKey = _skycoin.SKY_map_HasKey - -def SKY_map_Close(): - return _skycoin.SKY_map_Close() -SKY_map_Close = _skycoin.SKY_map_Close - -def SKY_cipher_DecodeBase58Address(p0, p1): - return _skycoin.SKY_cipher_DecodeBase58Address(p0, p1) -SKY_cipher_DecodeBase58Address = _skycoin.SKY_cipher_DecodeBase58Address - -def SKY_cipher_AddressFromBytes(p0, p1): - return _skycoin.SKY_cipher_AddressFromBytes(p0, p1) -SKY_cipher_AddressFromBytes = _skycoin.SKY_cipher_AddressFromBytes - -def SKY_cipher_AddressFromPubKey(p0, p1): - return _skycoin.SKY_cipher_AddressFromPubKey(p0, p1) -SKY_cipher_AddressFromPubKey = _skycoin.SKY_cipher_AddressFromPubKey - -def SKY_cipher_AddressFromSecKey(p0, p1): - return _skycoin.SKY_cipher_AddressFromSecKey(p0, p1) -SKY_cipher_AddressFromSecKey = _skycoin.SKY_cipher_AddressFromSecKey - -def SKY_cipher_BitcoinDecodeBase58Address(p0, p1): - return _skycoin.SKY_cipher_BitcoinDecodeBase58Address(p0, p1) -SKY_cipher_BitcoinDecodeBase58Address = _skycoin.SKY_cipher_BitcoinDecodeBase58Address - -def SKY_cipher_Address_Null(p0): - return _skycoin.SKY_cipher_Address_Null(p0) -SKY_cipher_Address_Null = _skycoin.SKY_cipher_Address_Null - -def SKY_cipher_Address_Bytes(p0): - return _skycoin.SKY_cipher_Address_Bytes(p0) -SKY_cipher_Address_Bytes = _skycoin.SKY_cipher_Address_Bytes - -def SKY_cipher_Address_BitcoinBytes(p0): - return _skycoin.SKY_cipher_Address_BitcoinBytes(p0) -SKY_cipher_Address_BitcoinBytes = _skycoin.SKY_cipher_Address_BitcoinBytes - -def SKY_cipher_Address_Verify(p0, p1): - return _skycoin.SKY_cipher_Address_Verify(p0, p1) -SKY_cipher_Address_Verify = _skycoin.SKY_cipher_Address_Verify - -def SKY_cipher_Address_String(p0): - return _skycoin.SKY_cipher_Address_String(p0) -SKY_cipher_Address_String = _skycoin.SKY_cipher_Address_String - -def SKY_cipher_Address_BitcoinString(p0): - return _skycoin.SKY_cipher_Address_BitcoinString(p0) -SKY_cipher_Address_BitcoinString = _skycoin.SKY_cipher_Address_BitcoinString - -def SKY_cipher_Address_Checksum(p0, p1): - return _skycoin.SKY_cipher_Address_Checksum(p0, p1) -SKY_cipher_Address_Checksum = _skycoin.SKY_cipher_Address_Checksum - -def SKY_cipher_Address_BitcoinChecksum(p0, p1): - return _skycoin.SKY_cipher_Address_BitcoinChecksum(p0, p1) -SKY_cipher_Address_BitcoinChecksum = _skycoin.SKY_cipher_Address_BitcoinChecksum - -def SKY_cipher_BitcoinAddressFromPubkey(p0): - return _skycoin.SKY_cipher_BitcoinAddressFromPubkey(p0) -SKY_cipher_BitcoinAddressFromPubkey = _skycoin.SKY_cipher_BitcoinAddressFromPubkey - -def SKY_cipher_BitcoinWalletImportFormatFromSeckey(p0): - return _skycoin.SKY_cipher_BitcoinWalletImportFormatFromSeckey(p0) -SKY_cipher_BitcoinWalletImportFormatFromSeckey = _skycoin.SKY_cipher_BitcoinWalletImportFormatFromSeckey - -def SKY_cipher_BitcoinAddressFromBytes(p0, p1): - return _skycoin.SKY_cipher_BitcoinAddressFromBytes(p0, p1) -SKY_cipher_BitcoinAddressFromBytes = _skycoin.SKY_cipher_BitcoinAddressFromBytes - -def SKY_cipher_SecKeyFromWalletImportFormat(p0, p1): - return _skycoin.SKY_cipher_SecKeyFromWalletImportFormat(p0, p1) -SKY_cipher_SecKeyFromWalletImportFormat = _skycoin.SKY_cipher_SecKeyFromWalletImportFormat - -def SKY_JsonEncode_Handle(p0): - return _skycoin.SKY_JsonEncode_Handle(p0) -SKY_JsonEncode_Handle = _skycoin.SKY_JsonEncode_Handle - -def SKY_Handle_Progress_GetCurrent(p0): - return _skycoin.SKY_Handle_Progress_GetCurrent(p0) -SKY_Handle_Progress_GetCurrent = _skycoin.SKY_Handle_Progress_GetCurrent - -def SKY_Handle_Block_GetHeadSeq(p0): - return _skycoin.SKY_Handle_Block_GetHeadSeq(p0) -SKY_Handle_Block_GetHeadSeq = _skycoin.SKY_Handle_Block_GetHeadSeq - -def SKY_Handle_Block_GetHeadHash(p0): - return _skycoin.SKY_Handle_Block_GetHeadHash(p0) -SKY_Handle_Block_GetHeadHash = _skycoin.SKY_Handle_Block_GetHeadHash - -def SKY_Handle_Block_GetPreviousBlockHash(p0): - return _skycoin.SKY_Handle_Block_GetPreviousBlockHash(p0) -SKY_Handle_Block_GetPreviousBlockHash = _skycoin.SKY_Handle_Block_GetPreviousBlockHash - -def SKY_Handle_Blocks_GetAt(p0, p1): - return _skycoin.SKY_Handle_Blocks_GetAt(p0, p1) -SKY_Handle_Blocks_GetAt = _skycoin.SKY_Handle_Blocks_GetAt - -def SKY_Handle_Blocks_GetCount(p0): - return _skycoin.SKY_Handle_Blocks_GetCount(p0) -SKY_Handle_Blocks_GetCount = _skycoin.SKY_Handle_Blocks_GetCount - -def SKY_Handle_Connections_GetCount(p0): - return _skycoin.SKY_Handle_Connections_GetCount(p0) -SKY_Handle_Connections_GetCount = _skycoin.SKY_Handle_Connections_GetCount - -def SKY_Handle_Strings_GetCount(p0): - return _skycoin.SKY_Handle_Strings_GetCount(p0) -SKY_Handle_Strings_GetCount = _skycoin.SKY_Handle_Strings_GetCount - -def SKY_Handle_Strings_Sort(p0): - return _skycoin.SKY_Handle_Strings_Sort(p0) -SKY_Handle_Strings_Sort = _skycoin.SKY_Handle_Strings_Sort - -def SKY_Handle_Strings_GetAt(p0, p1): - return _skycoin.SKY_Handle_Strings_GetAt(p0, p1) -SKY_Handle_Strings_GetAt = _skycoin.SKY_Handle_Strings_GetAt - -def SKY_api_Handle_Client_GetWalletDir(p0): - return _skycoin.SKY_api_Handle_Client_GetWalletDir(p0) -SKY_api_Handle_Client_GetWalletDir = _skycoin.SKY_api_Handle_Client_GetWalletDir - -def SKY_api_Handle_Client_GetWalletFileName(p0): - return _skycoin.SKY_api_Handle_Client_GetWalletFileName(p0) -SKY_api_Handle_Client_GetWalletFileName = _skycoin.SKY_api_Handle_Client_GetWalletFileName - -def SKY_api_Handle_Client_GetWalletLabel(p0): - return _skycoin.SKY_api_Handle_Client_GetWalletLabel(p0) -SKY_api_Handle_Client_GetWalletLabel = _skycoin.SKY_api_Handle_Client_GetWalletLabel - -def SKY_api_Handle_Client_GetWalletFullPath(p0, p1): - return _skycoin.SKY_api_Handle_Client_GetWalletFullPath(p0, p1) -SKY_api_Handle_Client_GetWalletFullPath = _skycoin.SKY_api_Handle_Client_GetWalletFullPath - -def SKY_api_Handle_GetWalletMeta(p0): - return _skycoin.SKY_api_Handle_GetWalletMeta(p0) -SKY_api_Handle_GetWalletMeta = _skycoin.SKY_api_Handle_GetWalletMeta - -def SKY_api_Handle_GetWalletEntriesCount(p0): - return _skycoin.SKY_api_Handle_GetWalletEntriesCount(p0) -SKY_api_Handle_GetWalletEntriesCount = _skycoin.SKY_api_Handle_GetWalletEntriesCount - -def SKY_api_Handle_Client_GetWalletResponseEntriesCount(p0): - return _skycoin.SKY_api_Handle_Client_GetWalletResponseEntriesCount(p0) -SKY_api_Handle_Client_GetWalletResponseEntriesCount = _skycoin.SKY_api_Handle_Client_GetWalletResponseEntriesCount - -def SKY_api_Handle_WalletGetEntry(p0, p1, p2, p3): - return _skycoin.SKY_api_Handle_WalletGetEntry(p0, p1, p2, p3) -SKY_api_Handle_WalletGetEntry = _skycoin.SKY_api_Handle_WalletGetEntry - -def SKY_api_Handle_WalletResponseGetEntry(p0, p1): - return _skycoin.SKY_api_Handle_WalletResponseGetEntry(p0, p1) -SKY_api_Handle_WalletResponseGetEntry = _skycoin.SKY_api_Handle_WalletResponseGetEntry - -def SKY_api_Handle_WalletResponseIsEncrypted(p0): - return _skycoin.SKY_api_Handle_WalletResponseIsEncrypted(p0) -SKY_api_Handle_WalletResponseIsEncrypted = _skycoin.SKY_api_Handle_WalletResponseIsEncrypted - -def SKY_api_Handle_WalletResponseGetCryptoType(p0): - return _skycoin.SKY_api_Handle_WalletResponseGetCryptoType(p0) -SKY_api_Handle_WalletResponseGetCryptoType = _skycoin.SKY_api_Handle_WalletResponseGetCryptoType - -def SKY_api_Handle_WalletsResponseGetCount(p0): - return _skycoin.SKY_api_Handle_WalletsResponseGetCount(p0) -SKY_api_Handle_WalletsResponseGetCount = _skycoin.SKY_api_Handle_WalletsResponseGetCount - -def SKY_api_Handle_WalletsResponseGetAt(p0, p1): - return _skycoin.SKY_api_Handle_WalletsResponseGetAt(p0, p1) -SKY_api_Handle_WalletsResponseGetAt = _skycoin.SKY_api_Handle_WalletsResponseGetAt - -def SKY_api_Handle_GetWalletFolderAddress(p0): - return _skycoin.SKY_api_Handle_GetWalletFolderAddress(p0) -SKY_api_Handle_GetWalletFolderAddress = _skycoin.SKY_api_Handle_GetWalletFolderAddress - -def SKY_api_Handle_GetWalletSeed(p0): - return _skycoin.SKY_api_Handle_GetWalletSeed(p0) -SKY_api_Handle_GetWalletSeed = _skycoin.SKY_api_Handle_GetWalletSeed - -def SKY_api_Handle_GetWalletLastSeed(p0): - return _skycoin.SKY_api_Handle_GetWalletLastSeed(p0) -SKY_api_Handle_GetWalletLastSeed = _skycoin.SKY_api_Handle_GetWalletLastSeed - -def SKY_api_Handle_GetBuildInfoData(p0): - return _skycoin.SKY_api_Handle_GetBuildInfoData(p0) -SKY_api_Handle_GetBuildInfoData = _skycoin.SKY_api_Handle_GetBuildInfoData - -def SKY_ripemd160_New(p0): - return _skycoin.SKY_ripemd160_New(p0) -SKY_ripemd160_New = _skycoin.SKY_ripemd160_New - -def SKY_ripemd160_Write(p0, p1): - return _skycoin.SKY_ripemd160_Write(p0, p1) -SKY_ripemd160_Write = _skycoin.SKY_ripemd160_Write - -def SKY_ripemd160_Sum(p0, p1): - return _skycoin.SKY_ripemd160_Sum(p0, p1) -SKY_ripemd160_Sum = _skycoin.SKY_ripemd160_Sum - -def SKY_secp256k1go_Number_Create(): - return _skycoin.SKY_secp256k1go_Number_Create() -SKY_secp256k1go_Number_Create = _skycoin.SKY_secp256k1go_Number_Create - -def SKY_secp256k1go_Number_Print(p0, p1): - return _skycoin.SKY_secp256k1go_Number_Print(p0, p1) -SKY_secp256k1go_Number_Print = _skycoin.SKY_secp256k1go_Number_Print - -def SKY_secp256k1go_Number_SetHex(p0, p1): - return _skycoin.SKY_secp256k1go_Number_SetHex(p0, p1) -SKY_secp256k1go_Number_SetHex = _skycoin.SKY_secp256k1go_Number_SetHex - -def SKY_secp256k1go_Number_IsOdd(p0): - return _skycoin.SKY_secp256k1go_Number_IsOdd(p0) -SKY_secp256k1go_Number_IsOdd = _skycoin.SKY_secp256k1go_Number_IsOdd - -def SKY_secp256k1go_Number_IsEqual(p0, p1): - return _skycoin.SKY_secp256k1go_Number_IsEqual(p0, p1) -SKY_secp256k1go_Number_IsEqual = _skycoin.SKY_secp256k1go_Number_IsEqual - -def SKY_coin_UxOut_Hash(p0, p1): - return _skycoin.SKY_coin_UxOut_Hash(p0, p1) -SKY_coin_UxOut_Hash = _skycoin.SKY_coin_UxOut_Hash - -def SKY_coin_UxOut_SnapshotHash(p0, p1): - return _skycoin.SKY_coin_UxOut_SnapshotHash(p0, p1) -SKY_coin_UxOut_SnapshotHash = _skycoin.SKY_coin_UxOut_SnapshotHash - -def SKY_coin_UxBody_Hash(p0, p1): - return _skycoin.SKY_coin_UxBody_Hash(p0, p1) -SKY_coin_UxBody_Hash = _skycoin.SKY_coin_UxBody_Hash - -def SKY_coin_UxOut_CoinHours(p0, p1): - return _skycoin.SKY_coin_UxOut_CoinHours(p0, p1) -SKY_coin_UxOut_CoinHours = _skycoin.SKY_coin_UxOut_CoinHours - -def SKY_coin_UxArray_Hashes(*args): - return _skycoin.SKY_coin_UxArray_Hashes(*args) -SKY_coin_UxArray_Hashes = _skycoin.SKY_coin_UxArray_Hashes - -def SKY_coin_UxArray_HasDupes(*args): - return _skycoin.SKY_coin_UxArray_HasDupes(*args) -SKY_coin_UxArray_HasDupes = _skycoin.SKY_coin_UxArray_HasDupes - -def SKY_coin_UxArray_Sort(*args): - return _skycoin.SKY_coin_UxArray_Sort(*args) -SKY_coin_UxArray_Sort = _skycoin.SKY_coin_UxArray_Sort - -def SKY_coin_UxArray_Len(): - return _skycoin.SKY_coin_UxArray_Len() -SKY_coin_UxArray_Len = _skycoin.SKY_coin_UxArray_Len - -def SKY_coin_UxArray_Less(*args): - return _skycoin.SKY_coin_UxArray_Less(*args) -SKY_coin_UxArray_Less = _skycoin.SKY_coin_UxArray_Less - -def SKY_coin_UxArray_Swap(*args): - return _skycoin.SKY_coin_UxArray_Swap(*args) -SKY_coin_UxArray_Swap = _skycoin.SKY_coin_UxArray_Swap - -def SKY_coin_UxArray_Coins(*args): - return _skycoin.SKY_coin_UxArray_Coins(*args) -SKY_coin_UxArray_Coins = _skycoin.SKY_coin_UxArray_Coins - -def SKY_coin_UxArray_CoinHours(*args): - return _skycoin.SKY_coin_UxArray_CoinHours(*args) -SKY_coin_UxArray_CoinHours = _skycoin.SKY_coin_UxArray_CoinHours - -def SKY_coin_UxArray_Sub(*args): - return _skycoin.SKY_coin_UxArray_Sub(*args) -SKY_coin_UxArray_Sub = _skycoin.SKY_coin_UxArray_Sub - -def SKY_coin_UxArray_Add(*args): - return _skycoin.SKY_coin_UxArray_Add(*args) -SKY_coin_UxArray_Add = _skycoin.SKY_coin_UxArray_Add - -def SKY_coin_NewAddressUxOuts(*args): - return _skycoin.SKY_coin_NewAddressUxOuts(*args) -SKY_coin_NewAddressUxOuts = _skycoin.SKY_coin_NewAddressUxOuts - -def SKY_coin_AddressUxOuts_Keys(*args): - return _skycoin.SKY_coin_AddressUxOuts_Keys(*args) -SKY_coin_AddressUxOuts_Keys = _skycoin.SKY_coin_AddressUxOuts_Keys - -def SKY_coin_AddressUxOuts_Flatten(*args): - return _skycoin.SKY_coin_AddressUxOuts_Flatten(*args) -SKY_coin_AddressUxOuts_Flatten = _skycoin.SKY_coin_AddressUxOuts_Flatten - -def SKY_coin_AddressUxOuts_Sub(p0, p1): - return _skycoin.SKY_coin_AddressUxOuts_Sub(p0, p1) -SKY_coin_AddressUxOuts_Sub = _skycoin.SKY_coin_AddressUxOuts_Sub - -def SKY_coin_AddressUxOuts_Add(p0, p1): - return _skycoin.SKY_coin_AddressUxOuts_Add(p0, p1) -SKY_coin_AddressUxOuts_Add = _skycoin.SKY_coin_AddressUxOuts_Add - -def SKY_coin_AddressUxOuts_Get(*args): - return _skycoin.SKY_coin_AddressUxOuts_Get(*args) -SKY_coin_AddressUxOuts_Get = _skycoin.SKY_coin_AddressUxOuts_Get - -def SKY_coin_AddressUxOuts_HasKey(p0, p1): - return _skycoin.SKY_coin_AddressUxOuts_HasKey(p0, p1) -SKY_coin_AddressUxOuts_HasKey = _skycoin.SKY_coin_AddressUxOuts_HasKey - -def SKY_coin_AddressUxOuts_GetOutputLength(p0, p1): - return _skycoin.SKY_coin_AddressUxOuts_GetOutputLength(p0, p1) -SKY_coin_AddressUxOuts_GetOutputLength = _skycoin.SKY_coin_AddressUxOuts_GetOutputLength - -def SKY_coin_AddressUxOuts_Length(p0): - return _skycoin.SKY_coin_AddressUxOuts_Length(p0) -SKY_coin_AddressUxOuts_Length = _skycoin.SKY_coin_AddressUxOuts_Length - -def SKY_coin_AddressUxOuts_Set(*args): - return _skycoin.SKY_coin_AddressUxOuts_Set(*args) -SKY_coin_AddressUxOuts_Set = _skycoin.SKY_coin_AddressUxOuts_Set - -def SKY_encrypt_ScryptChacha20poly1305_Encrypt(p0, p1, p2): - return _skycoin.SKY_encrypt_ScryptChacha20poly1305_Encrypt(p0, p1, p2) -SKY_encrypt_ScryptChacha20poly1305_Encrypt = _skycoin.SKY_encrypt_ScryptChacha20poly1305_Encrypt - -def SKY_encrypt_ScryptChacha20poly1305_Decrypt(p0, p1, p2): - return _skycoin.SKY_encrypt_ScryptChacha20poly1305_Decrypt(p0, p1, p2) -SKY_encrypt_ScryptChacha20poly1305_Decrypt = _skycoin.SKY_encrypt_ScryptChacha20poly1305_Decrypt - -def SKY_wallet_CreateOptionsHandle(p0, p1, p2, p3, p4, p5, p6): - return _skycoin.SKY_wallet_CreateOptionsHandle(p0, p1, p2, p3, p4, p5, p6) -SKY_wallet_CreateOptionsHandle = _skycoin.SKY_wallet_CreateOptionsHandle - -def SKY_cli_AddPrivateKey(p0, p1): - return _skycoin.SKY_cli_AddPrivateKey(p0, p1) -SKY_cli_AddPrivateKey = _skycoin.SKY_cli_AddPrivateKey - -def SKY_cli_AddPrivateKeyToFile(p0, p1, p2): - return _skycoin.SKY_cli_AddPrivateKeyToFile(p0, p1, p2) -SKY_cli_AddPrivateKeyToFile = _skycoin.SKY_cli_AddPrivateKeyToFile - -def SKY_secp256k1_GenerateKeyPair(): - return _skycoin.SKY_secp256k1_GenerateKeyPair() -SKY_secp256k1_GenerateKeyPair = _skycoin.SKY_secp256k1_GenerateKeyPair - -def SKY_secp256k1_PubkeyFromSeckey(p0): - return _skycoin.SKY_secp256k1_PubkeyFromSeckey(p0) -SKY_secp256k1_PubkeyFromSeckey = _skycoin.SKY_secp256k1_PubkeyFromSeckey - -def SKY_secp256k1_UncompressPubkey(p0): - return _skycoin.SKY_secp256k1_UncompressPubkey(p0) -SKY_secp256k1_UncompressPubkey = _skycoin.SKY_secp256k1_UncompressPubkey - -def SKY_secp256k1_UncompressedPubkeyFromSeckey(p0): - return _skycoin.SKY_secp256k1_UncompressedPubkeyFromSeckey(p0) -SKY_secp256k1_UncompressedPubkeyFromSeckey = _skycoin.SKY_secp256k1_UncompressedPubkeyFromSeckey - -def SKY_secp256k1_Secp256k1Hash(p0): - return _skycoin.SKY_secp256k1_Secp256k1Hash(p0) -SKY_secp256k1_Secp256k1Hash = _skycoin.SKY_secp256k1_Secp256k1Hash - -def SKY_secp256k1_GenerateDeterministicKeyPair(p0): - return _skycoin.SKY_secp256k1_GenerateDeterministicKeyPair(p0) -SKY_secp256k1_GenerateDeterministicKeyPair = _skycoin.SKY_secp256k1_GenerateDeterministicKeyPair - -def SKY_secp256k1_DeterministicKeyPairIterator(p0): - return _skycoin.SKY_secp256k1_DeterministicKeyPairIterator(p0) -SKY_secp256k1_DeterministicKeyPairIterator = _skycoin.SKY_secp256k1_DeterministicKeyPairIterator - -def SKY_secp256k1_Sign(p0, p1): - return _skycoin.SKY_secp256k1_Sign(p0, p1) -SKY_secp256k1_Sign = _skycoin.SKY_secp256k1_Sign - -def SKY_secp256k1_SignDeterministic(p0, p1, p2): - return _skycoin.SKY_secp256k1_SignDeterministic(p0, p1, p2) -SKY_secp256k1_SignDeterministic = _skycoin.SKY_secp256k1_SignDeterministic - -def SKY_secp256k1_VerifySeckey(p0): - return _skycoin.SKY_secp256k1_VerifySeckey(p0) -SKY_secp256k1_VerifySeckey = _skycoin.SKY_secp256k1_VerifySeckey - -def SKY_secp256k1_VerifyPubkey(p0): - return _skycoin.SKY_secp256k1_VerifyPubkey(p0) -SKY_secp256k1_VerifyPubkey = _skycoin.SKY_secp256k1_VerifyPubkey - -def SKY_secp256k1_VerifySignatureValidity(p0): - return _skycoin.SKY_secp256k1_VerifySignatureValidity(p0) -SKY_secp256k1_VerifySignatureValidity = _skycoin.SKY_secp256k1_VerifySignatureValidity - -def SKY_secp256k1_VerifySignature(p0, p1, p2): - return _skycoin.SKY_secp256k1_VerifySignature(p0, p1, p2) -SKY_secp256k1_VerifySignature = _skycoin.SKY_secp256k1_VerifySignature - -def SKY_secp256k1_SignatureErrorString(p0, p1, p2): - return _skycoin.SKY_secp256k1_SignatureErrorString(p0, p1, p2) -SKY_secp256k1_SignatureErrorString = _skycoin.SKY_secp256k1_SignatureErrorString - -def SKY_secp256k1_RecoverPubkey(p0, p1): - return _skycoin.SKY_secp256k1_RecoverPubkey(p0, p1) -SKY_secp256k1_RecoverPubkey = _skycoin.SKY_secp256k1_RecoverPubkey - -def SKY_secp256k1_ECDH(p0, p1): - return _skycoin.SKY_secp256k1_ECDH(p0, p1) -SKY_secp256k1_ECDH = _skycoin.SKY_secp256k1_ECDH - -def SKY_apputil_CatchInterruptPanic(): - return _skycoin.SKY_apputil_CatchInterruptPanic() -SKY_apputil_CatchInterruptPanic = _skycoin.SKY_apputil_CatchInterruptPanic - -def SKY_apputil_CatchDebug(): - return _skycoin.SKY_apputil_CatchDebug() -SKY_apputil_CatchDebug = _skycoin.SKY_apputil_CatchDebug - -def SKY_apputil_PrintProgramStatus(): - return _skycoin.SKY_apputil_PrintProgramStatus() -SKY_apputil_PrintProgramStatus = _skycoin.SKY_apputil_PrintProgramStatus - -def SKY_cert_CreateCertIfNotExists(p0, p1, p2, p3): - return _skycoin.SKY_cert_CreateCertIfNotExists(p0, p1, p2, p3) -SKY_cert_CreateCertIfNotExists = _skycoin.SKY_cert_CreateCertIfNotExists - -def SKY_fee_VerifyTransactionFee(p0, p1): - return _skycoin.SKY_fee_VerifyTransactionFee(p0, p1) -SKY_fee_VerifyTransactionFee = _skycoin.SKY_fee_VerifyTransactionFee - -def SKY_fee_VerifyTransactionFeeForHours(p0, p1): - return _skycoin.SKY_fee_VerifyTransactionFeeForHours(p0, p1) -SKY_fee_VerifyTransactionFeeForHours = _skycoin.SKY_fee_VerifyTransactionFeeForHours - -def SKY_fee_RequiredFee(p0): - return _skycoin.SKY_fee_RequiredFee(p0) -SKY_fee_RequiredFee = _skycoin.SKY_fee_RequiredFee - -def SKY_fee_RemainingHours(p0): - return _skycoin.SKY_fee_RemainingHours(p0) -SKY_fee_RemainingHours = _skycoin.SKY_fee_RemainingHours - -def SKY_fee_TransactionFee(*args): - return _skycoin.SKY_fee_TransactionFee(*args) -SKY_fee_TransactionFee = _skycoin.SKY_fee_TransactionFee - -def SKY_cli_LoadConfig(): - return _skycoin.SKY_cli_LoadConfig() -SKY_cli_LoadConfig = _skycoin.SKY_cli_LoadConfig - -def SKY_cli_Config_FullWalletPath(p0): - return _skycoin.SKY_cli_Config_FullWalletPath(p0) -SKY_cli_Config_FullWalletPath = _skycoin.SKY_cli_Config_FullWalletPath - -def SKY_cli_Config_FullDBPath(p0): - return _skycoin.SKY_cli_Config_FullDBPath(p0) -SKY_cli_Config_FullDBPath = _skycoin.SKY_cli_Config_FullDBPath - -def SKY_cli_NewApp(p0): - return _skycoin.SKY_cli_NewApp(p0) -SKY_cli_NewApp = _skycoin.SKY_cli_NewApp - -def SKY_cli_RPCClientFromContext(p0): - return _skycoin.SKY_cli_RPCClientFromContext(p0) -SKY_cli_RPCClientFromContext = _skycoin.SKY_cli_RPCClientFromContext - -def SKY_cli_ConfigFromContext(p0): - return _skycoin.SKY_cli_ConfigFromContext(p0) -SKY_cli_ConfigFromContext = _skycoin.SKY_cli_ConfigFromContext - -def SKY_cli_PasswordFromBytes_Password(): - return _skycoin.SKY_cli_PasswordFromBytes_Password() -SKY_cli_PasswordFromBytes_Password = _skycoin.SKY_cli_PasswordFromBytes_Password - -def SKY_cli_PasswordFromTerm_Password(): - return _skycoin.SKY_cli_PasswordFromTerm_Password() -SKY_cli_PasswordFromTerm_Password = _skycoin.SKY_cli_PasswordFromTerm_Password - -def SKY_cli_CreateRawTxFromWallet(p0, p1, p2, p3, p4): - return _skycoin.SKY_cli_CreateRawTxFromWallet(p0, p1, p2, p3, p4) -SKY_cli_CreateRawTxFromWallet = _skycoin.SKY_cli_CreateRawTxFromWallet - -def SKY_cli_CreateRawTxFromAddress(p0, p1, p2, p3, p4, p5): - return _skycoin.SKY_cli_CreateRawTxFromAddress(p0, p1, p2, p3, p4, p5) -SKY_cli_CreateRawTxFromAddress = _skycoin.SKY_cli_CreateRawTxFromAddress - -def SKY_cli_CreateRawTx(p0, p1, p2, p3, p4, p5): - return _skycoin.SKY_cli_CreateRawTx(p0, p1, p2, p3, p4, p5) -SKY_cli_CreateRawTx = _skycoin.SKY_cli_CreateRawTx - -def SKY_cli_NewTransaction(p0, p1, p2): - return _skycoin.SKY_cli_NewTransaction(p0, p1, p2) -SKY_cli_NewTransaction = _skycoin.SKY_cli_NewTransaction - -def SKY_file_InitDataDir(p0): - return _skycoin.SKY_file_InitDataDir(p0) -SKY_file_InitDataDir = _skycoin.SKY_file_InitDataDir - -def SKY_file_UserHome(): - return _skycoin.SKY_file_UserHome() -SKY_file_UserHome = _skycoin.SKY_file_UserHome - -def SKY_file_ResolveResourceDirectory(p0): - return _skycoin.SKY_file_ResolveResourceDirectory(p0) -SKY_file_ResolveResourceDirectory = _skycoin.SKY_file_ResolveResourceDirectory - -def SKY_file_DetermineResourcePath(p0, p1, p2): - return _skycoin.SKY_file_DetermineResourcePath(p0, p1, p2) -SKY_file_DetermineResourcePath = _skycoin.SKY_file_DetermineResourcePath - -def SKY_cli_GetWalletOutputsFromFile(p0, p1): - return _skycoin.SKY_cli_GetWalletOutputsFromFile(p0, p1) -SKY_cli_GetWalletOutputsFromFile = _skycoin.SKY_cli_GetWalletOutputsFromFile - -def SKY_cli_GetWalletOutputs(p0): - return _skycoin.SKY_cli_GetWalletOutputs(p0) -SKY_cli_GetWalletOutputs = _skycoin.SKY_cli_GetWalletOutputs - -def SKY_testutil_MakeAddress(p0): - return _skycoin.SKY_testutil_MakeAddress(p0) -SKY_testutil_MakeAddress = _skycoin.SKY_testutil_MakeAddress - -def SKY_secp256k1go_Field_String(p0): - return _skycoin.SKY_secp256k1go_Field_String(p0) -SKY_secp256k1go_Field_String = _skycoin.SKY_secp256k1go_Field_String - -def SKY_secp256k1go_Field_Print(p0, p1): - return _skycoin.SKY_secp256k1go_Field_Print(p0, p1) -SKY_secp256k1go_Field_Print = _skycoin.SKY_secp256k1go_Field_Print - -def SKY_secp256k1go_Field_SetB32(p0, p1): - return _skycoin.SKY_secp256k1go_Field_SetB32(p0, p1) -SKY_secp256k1go_Field_SetB32 = _skycoin.SKY_secp256k1go_Field_SetB32 - -def SKY_secp256k1go_Field_SetBytes(p0, p1): - return _skycoin.SKY_secp256k1go_Field_SetBytes(p0, p1) -SKY_secp256k1go_Field_SetBytes = _skycoin.SKY_secp256k1go_Field_SetBytes - -def SKY_secp256k1go_Field_SetHex(p0, p1): - return _skycoin.SKY_secp256k1go_Field_SetHex(p0, p1) -SKY_secp256k1go_Field_SetHex = _skycoin.SKY_secp256k1go_Field_SetHex - -def SKY_secp256k1go_Field_IsOdd(p0): - return _skycoin.SKY_secp256k1go_Field_IsOdd(p0) -SKY_secp256k1go_Field_IsOdd = _skycoin.SKY_secp256k1go_Field_IsOdd - -def SKY_secp256k1go_Field_IsZero(p0): - return _skycoin.SKY_secp256k1go_Field_IsZero(p0) -SKY_secp256k1go_Field_IsZero = _skycoin.SKY_secp256k1go_Field_IsZero - -def SKY_secp256k1go_Field_SetInt(p0, p1): - return _skycoin.SKY_secp256k1go_Field_SetInt(p0, p1) -SKY_secp256k1go_Field_SetInt = _skycoin.SKY_secp256k1go_Field_SetInt - -def SKY_secp256k1go_Field_Normalize(p0): - return _skycoin.SKY_secp256k1go_Field_Normalize(p0) -SKY_secp256k1go_Field_Normalize = _skycoin.SKY_secp256k1go_Field_Normalize - -def SKY_secp256k1go_Field_GetB32(p0, p1): - return _skycoin.SKY_secp256k1go_Field_GetB32(p0, p1) -SKY_secp256k1go_Field_GetB32 = _skycoin.SKY_secp256k1go_Field_GetB32 - -def SKY_secp256k1go_Field_Equals(p0, p1): - return _skycoin.SKY_secp256k1go_Field_Equals(p0, p1) -SKY_secp256k1go_Field_Equals = _skycoin.SKY_secp256k1go_Field_Equals - -def SKY_secp256k1go_Field_SetAdd(p0, p1): - return _skycoin.SKY_secp256k1go_Field_SetAdd(p0, p1) -SKY_secp256k1go_Field_SetAdd = _skycoin.SKY_secp256k1go_Field_SetAdd - -def SKY_secp256k1go_Field_MulInt(p0, p1): - return _skycoin.SKY_secp256k1go_Field_MulInt(p0, p1) -SKY_secp256k1go_Field_MulInt = _skycoin.SKY_secp256k1go_Field_MulInt - -def SKY_secp256k1go_Field_Negate(p0, p1, p2): - return _skycoin.SKY_secp256k1go_Field_Negate(p0, p1, p2) -SKY_secp256k1go_Field_Negate = _skycoin.SKY_secp256k1go_Field_Negate - -def SKY_secp256k1go_Field_Inv(p0, p1): - return _skycoin.SKY_secp256k1go_Field_Inv(p0, p1) -SKY_secp256k1go_Field_Inv = _skycoin.SKY_secp256k1go_Field_Inv - -def SKY_secp256k1go_Field_Sqrt(p0, p1): - return _skycoin.SKY_secp256k1go_Field_Sqrt(p0, p1) -SKY_secp256k1go_Field_Sqrt = _skycoin.SKY_secp256k1go_Field_Sqrt - -def SKY_secp256k1go_Field_InvVar(p0, p1): - return _skycoin.SKY_secp256k1go_Field_InvVar(p0, p1) -SKY_secp256k1go_Field_InvVar = _skycoin.SKY_secp256k1go_Field_InvVar - -def SKY_secp256k1go_Field_Mul(p0, p1, p2): - return _skycoin.SKY_secp256k1go_Field_Mul(p0, p1, p2) -SKY_secp256k1go_Field_Mul = _skycoin.SKY_secp256k1go_Field_Mul - -def SKY_secp256k1go_Field_Sqr(p0, p1): - return _skycoin.SKY_secp256k1go_Field_Sqr(p0, p1) -SKY_secp256k1go_Field_Sqr = _skycoin.SKY_secp256k1go_Field_Sqr - -def SKY_scrypt_Key(p0, p1, p2, p3, p4, p5): - return _skycoin.SKY_scrypt_Key(p0, p1, p2, p3, p4, p5) -SKY_scrypt_Key = _skycoin.SKY_scrypt_Key - -def SKY_cipher_Ripemd160_Set(p0, p1): - return _skycoin.SKY_cipher_Ripemd160_Set(p0, p1) -SKY_cipher_Ripemd160_Set = _skycoin.SKY_cipher_Ripemd160_Set - -def SKY_cipher_HashRipemd160(p0, p1): - return _skycoin.SKY_cipher_HashRipemd160(p0, p1) -SKY_cipher_HashRipemd160 = _skycoin.SKY_cipher_HashRipemd160 - -def SKY_cipher_SHA256_Set(p0, p1): - return _skycoin.SKY_cipher_SHA256_Set(p0, p1) -SKY_cipher_SHA256_Set = _skycoin.SKY_cipher_SHA256_Set - -def SKY_cipher_SHA256_Hex(p0): - return _skycoin.SKY_cipher_SHA256_Hex(p0) -SKY_cipher_SHA256_Hex = _skycoin.SKY_cipher_SHA256_Hex - -def SKY_cipher_SHA256_Xor(p0, p1, p2): - return _skycoin.SKY_cipher_SHA256_Xor(p0, p1, p2) -SKY_cipher_SHA256_Xor = _skycoin.SKY_cipher_SHA256_Xor - -def SKY_cipher_SumSHA256(p0, p1): - return _skycoin.SKY_cipher_SumSHA256(p0, p1) -SKY_cipher_SumSHA256 = _skycoin.SKY_cipher_SumSHA256 - -def SKY_cipher_SHA256FromHex(p0, p1): - return _skycoin.SKY_cipher_SHA256FromHex(p0, p1) -SKY_cipher_SHA256FromHex = _skycoin.SKY_cipher_SHA256FromHex - -def SKY_cipher_DoubleSHA256(p0, p1): - return _skycoin.SKY_cipher_DoubleSHA256(p0, p1) -SKY_cipher_DoubleSHA256 = _skycoin.SKY_cipher_DoubleSHA256 - -def SKY_cipher_AddSHA256(p0, p1, p2): - return _skycoin.SKY_cipher_AddSHA256(p0, p1, p2) -SKY_cipher_AddSHA256 = _skycoin.SKY_cipher_AddSHA256 - -def SKY_cipher_Merkle(p0, p1): - return _skycoin.SKY_cipher_Merkle(p0, p1) -SKY_cipher_Merkle = _skycoin.SKY_cipher_Merkle - -def SKY_cipher_SHA256_Null(p0): - return _skycoin.SKY_cipher_SHA256_Null(p0) -SKY_cipher_SHA256_Null = _skycoin.SKY_cipher_SHA256_Null - -def SKY_coin_Create_Transaction(): - return _skycoin.SKY_coin_Create_Transaction() -SKY_coin_Create_Transaction = _skycoin.SKY_coin_Create_Transaction - -def SKY_coin_Transaction_Copy(p0): - return _skycoin.SKY_coin_Transaction_Copy(p0) -SKY_coin_Transaction_Copy = _skycoin.SKY_coin_Transaction_Copy - -def SKY_coin_GetTransactionObject(p0): - return _skycoin.SKY_coin_GetTransactionObject(p0) -SKY_coin_GetTransactionObject = _skycoin.SKY_coin_GetTransactionObject - -def SKY_coin_Transaction_ResetInputs(p0, p1): - return _skycoin.SKY_coin_Transaction_ResetInputs(p0, p1) -SKY_coin_Transaction_ResetInputs = _skycoin.SKY_coin_Transaction_ResetInputs - -def SKY_coin_Transaction_GetInputsCount(p0): - return _skycoin.SKY_coin_Transaction_GetInputsCount(p0) -SKY_coin_Transaction_GetInputsCount = _skycoin.SKY_coin_Transaction_GetInputsCount - -def SKY_coin_Transaction_GetInputAt(p0, p1, p2): - return _skycoin.SKY_coin_Transaction_GetInputAt(p0, p1, p2) -SKY_coin_Transaction_GetInputAt = _skycoin.SKY_coin_Transaction_GetInputAt - -def SKY_coin_Transaction_SetInputAt(p0, p1, p2): - return _skycoin.SKY_coin_Transaction_SetInputAt(p0, p1, p2) -SKY_coin_Transaction_SetInputAt = _skycoin.SKY_coin_Transaction_SetInputAt - -def SKY_coin_Transaction_GetOutputsCount(p0): - return _skycoin.SKY_coin_Transaction_GetOutputsCount(p0) -SKY_coin_Transaction_GetOutputsCount = _skycoin.SKY_coin_Transaction_GetOutputsCount - -def SKY_coin_Transaction_GetOutputAt(p0, p1, p2): - return _skycoin.SKY_coin_Transaction_GetOutputAt(p0, p1, p2) -SKY_coin_Transaction_GetOutputAt = _skycoin.SKY_coin_Transaction_GetOutputAt - -def SKY_coin_Transaction_SetOutputAt(p0, p1, p2): - return _skycoin.SKY_coin_Transaction_SetOutputAt(p0, p1, p2) -SKY_coin_Transaction_SetOutputAt = _skycoin.SKY_coin_Transaction_SetOutputAt - -def SKY_coin_Transaction_GetSignaturesCount(p0): - return _skycoin.SKY_coin_Transaction_GetSignaturesCount(p0) -SKY_coin_Transaction_GetSignaturesCount = _skycoin.SKY_coin_Transaction_GetSignaturesCount - -def SKY_coin_Transaction_GetSignatureAt(p0, p1, p2): - return _skycoin.SKY_coin_Transaction_GetSignatureAt(p0, p1, p2) -SKY_coin_Transaction_GetSignatureAt = _skycoin.SKY_coin_Transaction_GetSignatureAt - -def SKY_coin_Transaction_SetSignatureAt(p0, p1, p2): - return _skycoin.SKY_coin_Transaction_SetSignatureAt(p0, p1, p2) -SKY_coin_Transaction_SetSignatureAt = _skycoin.SKY_coin_Transaction_SetSignatureAt - -def SKY_coin_Transaction_PushSignature(p0, p1): - return _skycoin.SKY_coin_Transaction_PushSignature(p0, p1) -SKY_coin_Transaction_PushSignature = _skycoin.SKY_coin_Transaction_PushSignature - -def SKY_coin_Transaction_ResetOutputs(p0, p1): - return _skycoin.SKY_coin_Transaction_ResetOutputs(p0, p1) -SKY_coin_Transaction_ResetOutputs = _skycoin.SKY_coin_Transaction_ResetOutputs - -def SKY_coin_Transaction_ResetSignatures(p0, p1): - return _skycoin.SKY_coin_Transaction_ResetSignatures(p0, p1) -SKY_coin_Transaction_ResetSignatures = _skycoin.SKY_coin_Transaction_ResetSignatures - -def SKY_coin_Transaction_Verify(p0): - return _skycoin.SKY_coin_Transaction_Verify(p0) -SKY_coin_Transaction_Verify = _skycoin.SKY_coin_Transaction_Verify - -def SKY_coin_Transaction_VerifyInput(*args): - return _skycoin.SKY_coin_Transaction_VerifyInput(*args) -SKY_coin_Transaction_VerifyInput = _skycoin.SKY_coin_Transaction_VerifyInput - -def SKY_coin_Transaction_PushInput(p0, p1): - return _skycoin.SKY_coin_Transaction_PushInput(p0, p1) -SKY_coin_Transaction_PushInput = _skycoin.SKY_coin_Transaction_PushInput - -def SKY_coin_TransactionOutput_UxID(p0, p1, p2): - return _skycoin.SKY_coin_TransactionOutput_UxID(p0, p1, p2) -SKY_coin_TransactionOutput_UxID = _skycoin.SKY_coin_TransactionOutput_UxID - -def SKY_coin_Transaction_PushOutput(p0, p1, p2, p3): - return _skycoin.SKY_coin_Transaction_PushOutput(p0, p1, p2, p3) -SKY_coin_Transaction_PushOutput = _skycoin.SKY_coin_Transaction_PushOutput - -def SKY_coin_Transaction_SignInputs(*args): - return _skycoin.SKY_coin_Transaction_SignInputs(*args) -SKY_coin_Transaction_SignInputs = _skycoin.SKY_coin_Transaction_SignInputs - -def SKY_coin_Transaction_Size(p0): - return _skycoin.SKY_coin_Transaction_Size(p0) -SKY_coin_Transaction_Size = _skycoin.SKY_coin_Transaction_Size - -def SKY_coin_Transaction_Hash(p0, p1): - return _skycoin.SKY_coin_Transaction_Hash(p0, p1) -SKY_coin_Transaction_Hash = _skycoin.SKY_coin_Transaction_Hash - -def SKY_coin_Transaction_SizeHash(p0, p2): - return _skycoin.SKY_coin_Transaction_SizeHash(p0, p2) -SKY_coin_Transaction_SizeHash = _skycoin.SKY_coin_Transaction_SizeHash - -def SKY_coin_Transaction_TxID(p0): - return _skycoin.SKY_coin_Transaction_TxID(p0) -SKY_coin_Transaction_TxID = _skycoin.SKY_coin_Transaction_TxID - -def SKY_coin_Transaction_TxIDHex(p0): - return _skycoin.SKY_coin_Transaction_TxIDHex(p0) -SKY_coin_Transaction_TxIDHex = _skycoin.SKY_coin_Transaction_TxIDHex - -def SKY_coin_Transaction_UpdateHeader(p0): - return _skycoin.SKY_coin_Transaction_UpdateHeader(p0) -SKY_coin_Transaction_UpdateHeader = _skycoin.SKY_coin_Transaction_UpdateHeader - -def SKY_coin_Transaction_HashInner(p0, p1): - return _skycoin.SKY_coin_Transaction_HashInner(p0, p1) -SKY_coin_Transaction_HashInner = _skycoin.SKY_coin_Transaction_HashInner - -def SKY_coin_Transaction_Serialize(p0): - return _skycoin.SKY_coin_Transaction_Serialize(p0) -SKY_coin_Transaction_Serialize = _skycoin.SKY_coin_Transaction_Serialize - -def SKY_coin_TransactionDeserialize(p0): - return _skycoin.SKY_coin_TransactionDeserialize(p0) -SKY_coin_TransactionDeserialize = _skycoin.SKY_coin_TransactionDeserialize - -def SKY_coin_Transaction_OutputHours(p0): - return _skycoin.SKY_coin_Transaction_OutputHours(p0) -SKY_coin_Transaction_OutputHours = _skycoin.SKY_coin_Transaction_OutputHours - -def SKY_coin_Create_Transactions(): - return _skycoin.SKY_coin_Create_Transactions() -SKY_coin_Create_Transactions = _skycoin.SKY_coin_Create_Transactions - -def SKY_coin_GetTransactionsObject(p0, p1): - return _skycoin.SKY_coin_GetTransactionsObject(p0, p1) -SKY_coin_GetTransactionsObject = _skycoin.SKY_coin_GetTransactionsObject - -def SKY_coin_Transactions_Length(p0): - return _skycoin.SKY_coin_Transactions_Length(p0) -SKY_coin_Transactions_Length = _skycoin.SKY_coin_Transactions_Length - -def SKY_coin_Transactions_Add(p0, p1): - return _skycoin.SKY_coin_Transactions_Add(p0, p1) -SKY_coin_Transactions_Add = _skycoin.SKY_coin_Transactions_Add - -def SKY_coin_Transactions_Fees(p0, p1): - return _skycoin.SKY_coin_Transactions_Fees(p0, p1) -SKY_coin_Transactions_Fees = _skycoin.SKY_coin_Transactions_Fees - -def SKY_coin_Transactions_GetAt(p0, p1): - return _skycoin.SKY_coin_Transactions_GetAt(p0, p1) -SKY_coin_Transactions_GetAt = _skycoin.SKY_coin_Transactions_GetAt - -def SKY_coin_Transactions_Hashes(*args): - return _skycoin.SKY_coin_Transactions_Hashes(*args) -SKY_coin_Transactions_Hashes = _skycoin.SKY_coin_Transactions_Hashes - -def SKY_coin_Transactions_Size(p0): - return _skycoin.SKY_coin_Transactions_Size(p0) -SKY_coin_Transactions_Size = _skycoin.SKY_coin_Transactions_Size - -def SKY_coin_Transactions_TruncateBytesTo(p0, p1): - return _skycoin.SKY_coin_Transactions_TruncateBytesTo(p0, p1) -SKY_coin_Transactions_TruncateBytesTo = _skycoin.SKY_coin_Transactions_TruncateBytesTo - -def SKY_coin_SortTransactions(p0, p1): - return _skycoin.SKY_coin_SortTransactions(p0, p1) -SKY_coin_SortTransactions = _skycoin.SKY_coin_SortTransactions - -def SKY_coin_NewSortableTransactions(p0, p1, p2): - return _skycoin.SKY_coin_NewSortableTransactions(p0, p1, p2) -SKY_coin_NewSortableTransactions = _skycoin.SKY_coin_NewSortableTransactions - -def SKY_coin_SortableTransactions_Sort(p0): - return _skycoin.SKY_coin_SortableTransactions_Sort(p0) -SKY_coin_SortableTransactions_Sort = _skycoin.SKY_coin_SortableTransactions_Sort - -def SKY_coin_SortableTransactions_Len(p0): - return _skycoin.SKY_coin_SortableTransactions_Len(p0) -SKY_coin_SortableTransactions_Len = _skycoin.SKY_coin_SortableTransactions_Len - -def SKY_coin_SortableTransactions_Less(p0, p1, p2): - return _skycoin.SKY_coin_SortableTransactions_Less(p0, p1, p2) -SKY_coin_SortableTransactions_Less = _skycoin.SKY_coin_SortableTransactions_Less - -def SKY_coin_SortableTransactions_Swap(p0, p1, p2): - return _skycoin.SKY_coin_SortableTransactions_Swap(p0, p1, p2) -SKY_coin_SortableTransactions_Swap = _skycoin.SKY_coin_SortableTransactions_Swap - -def SKY_coin_VerifyTransactionCoinsSpending(*args): - return _skycoin.SKY_coin_VerifyTransactionCoinsSpending(*args) -SKY_coin_VerifyTransactionCoinsSpending = _skycoin.SKY_coin_VerifyTransactionCoinsSpending - -def SKY_coin_VerifyTransactionHoursSpending(*args): - return _skycoin.SKY_coin_VerifyTransactionHoursSpending(*args) -SKY_coin_VerifyTransactionHoursSpending = _skycoin.SKY_coin_VerifyTransactionHoursSpending -class cipher__Address(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cipher__Address, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cipher__Address, name) - __repr__ = _swig_repr - - def __eq__(self, a): - return _skycoin.cipher__Address___eq__(self, a) - - def toStr(self): - return _skycoin.cipher__Address_toStr(self) - __swig_setmethods__["Version"] = _skycoin.cipher__Address_Version_set - __swig_getmethods__["Version"] = _skycoin.cipher__Address_Version_get - if _newclass: - Version = _swig_property(_skycoin.cipher__Address_Version_get, _skycoin.cipher__Address_Version_set) - __swig_setmethods__["Key"] = _skycoin.cipher__Address_Key_set - __swig_getmethods__["Key"] = _skycoin.cipher__Address_Key_get - if _newclass: - Key = _swig_property(_skycoin.cipher__Address_Key_get, _skycoin.cipher__Address_Key_set) - - def __init__(self): - this = _skycoin.new_cipher__Address() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cipher__Address - __del__ = lambda self: None -cipher__Address_swigregister = _skycoin.cipher__Address_swigregister -cipher__Address_swigregister(cipher__Address) - -class encoder__StructField(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, encoder__StructField, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, encoder__StructField, name) - __repr__ = _swig_repr - __swig_setmethods__["Name"] = _skycoin.encoder__StructField_Name_set - __swig_getmethods__["Name"] = _skycoin.encoder__StructField_Name_get - if _newclass: - Name = _swig_property(_skycoin.encoder__StructField_Name_get, _skycoin.encoder__StructField_Name_set) - __swig_setmethods__["Kind"] = _skycoin.encoder__StructField_Kind_set - __swig_getmethods__["Kind"] = _skycoin.encoder__StructField_Kind_get - if _newclass: - Kind = _swig_property(_skycoin.encoder__StructField_Kind_get, _skycoin.encoder__StructField_Kind_set) - __swig_setmethods__["Type"] = _skycoin.encoder__StructField_Type_set - __swig_getmethods__["Type"] = _skycoin.encoder__StructField_Type_get - if _newclass: - Type = _swig_property(_skycoin.encoder__StructField_Type_get, _skycoin.encoder__StructField_Type_set) - __swig_setmethods__["Tag"] = _skycoin.encoder__StructField_Tag_set - __swig_getmethods__["Tag"] = _skycoin.encoder__StructField_Tag_get - if _newclass: - Tag = _swig_property(_skycoin.encoder__StructField_Tag_get, _skycoin.encoder__StructField_Tag_set) - - def __init__(self): - this = _skycoin.new_encoder__StructField() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_encoder__StructField - __del__ = lambda self: None -encoder__StructField_swigregister = _skycoin.encoder__StructField_swigregister -encoder__StructField_swigregister(encoder__StructField) - -class encrypt__ScryptChacha20poly1305(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, encrypt__ScryptChacha20poly1305, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, encrypt__ScryptChacha20poly1305, name) - __repr__ = _swig_repr - __swig_setmethods__["N"] = _skycoin.encrypt__ScryptChacha20poly1305_N_set - __swig_getmethods__["N"] = _skycoin.encrypt__ScryptChacha20poly1305_N_get - if _newclass: - N = _swig_property(_skycoin.encrypt__ScryptChacha20poly1305_N_get, _skycoin.encrypt__ScryptChacha20poly1305_N_set) - __swig_setmethods__["R"] = _skycoin.encrypt__ScryptChacha20poly1305_R_set - __swig_getmethods__["R"] = _skycoin.encrypt__ScryptChacha20poly1305_R_get - if _newclass: - R = _swig_property(_skycoin.encrypt__ScryptChacha20poly1305_R_get, _skycoin.encrypt__ScryptChacha20poly1305_R_set) - __swig_setmethods__["P"] = _skycoin.encrypt__ScryptChacha20poly1305_P_set - __swig_getmethods__["P"] = _skycoin.encrypt__ScryptChacha20poly1305_P_get - if _newclass: - P = _swig_property(_skycoin.encrypt__ScryptChacha20poly1305_P_get, _skycoin.encrypt__ScryptChacha20poly1305_P_set) - __swig_setmethods__["KeyLen"] = _skycoin.encrypt__ScryptChacha20poly1305_KeyLen_set - __swig_getmethods__["KeyLen"] = _skycoin.encrypt__ScryptChacha20poly1305_KeyLen_get - if _newclass: - KeyLen = _swig_property(_skycoin.encrypt__ScryptChacha20poly1305_KeyLen_get, _skycoin.encrypt__ScryptChacha20poly1305_KeyLen_set) - - def __init__(self): - this = _skycoin.new_encrypt__ScryptChacha20poly1305() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_encrypt__ScryptChacha20poly1305 - __del__ = lambda self: None -encrypt__ScryptChacha20poly1305_swigregister = _skycoin.encrypt__ScryptChacha20poly1305_swigregister -encrypt__ScryptChacha20poly1305_swigregister(encrypt__ScryptChacha20poly1305) - -class secp256k1go__Field(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, secp256k1go__Field, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, secp256k1go__Field, name) - __repr__ = _swig_repr - __swig_setmethods__["n"] = _skycoin.secp256k1go__Field_n_set - __swig_getmethods__["n"] = _skycoin.secp256k1go__Field_n_get - if _newclass: - n = _swig_property(_skycoin.secp256k1go__Field_n_get, _skycoin.secp256k1go__Field_n_set) - - def __init__(self): - this = _skycoin.new_secp256k1go__Field() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_secp256k1go__Field - __del__ = lambda self: None -secp256k1go__Field_swigregister = _skycoin.secp256k1go__Field_swigregister -secp256k1go__Field_swigregister(secp256k1go__Field) - -class secp256k1go__XY(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, secp256k1go__XY, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, secp256k1go__XY, name) - __repr__ = _swig_repr - __swig_setmethods__["X"] = _skycoin.secp256k1go__XY_X_set - __swig_getmethods__["X"] = _skycoin.secp256k1go__XY_X_get - if _newclass: - X = _swig_property(_skycoin.secp256k1go__XY_X_get, _skycoin.secp256k1go__XY_X_set) - __swig_setmethods__["Y"] = _skycoin.secp256k1go__XY_Y_set - __swig_getmethods__["Y"] = _skycoin.secp256k1go__XY_Y_get - if _newclass: - Y = _swig_property(_skycoin.secp256k1go__XY_Y_get, _skycoin.secp256k1go__XY_Y_set) - __swig_setmethods__["Infinity"] = _skycoin.secp256k1go__XY_Infinity_set - __swig_getmethods__["Infinity"] = _skycoin.secp256k1go__XY_Infinity_get - if _newclass: - Infinity = _swig_property(_skycoin.secp256k1go__XY_Infinity_get, _skycoin.secp256k1go__XY_Infinity_set) - - def __init__(self): - this = _skycoin.new_secp256k1go__XY() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_secp256k1go__XY - __del__ = lambda self: None -secp256k1go__XY_swigregister = _skycoin.secp256k1go__XY_swigregister -secp256k1go__XY_swigregister(secp256k1go__XY) - -class secp256k1go__XYZ(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, secp256k1go__XYZ, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, secp256k1go__XYZ, name) - __repr__ = _swig_repr - __swig_setmethods__["X"] = _skycoin.secp256k1go__XYZ_X_set - __swig_getmethods__["X"] = _skycoin.secp256k1go__XYZ_X_get - if _newclass: - X = _swig_property(_skycoin.secp256k1go__XYZ_X_get, _skycoin.secp256k1go__XYZ_X_set) - __swig_setmethods__["Y"] = _skycoin.secp256k1go__XYZ_Y_set - __swig_getmethods__["Y"] = _skycoin.secp256k1go__XYZ_Y_get - if _newclass: - Y = _swig_property(_skycoin.secp256k1go__XYZ_Y_get, _skycoin.secp256k1go__XYZ_Y_set) - __swig_setmethods__["Z"] = _skycoin.secp256k1go__XYZ_Z_set - __swig_getmethods__["Z"] = _skycoin.secp256k1go__XYZ_Z_get - if _newclass: - Z = _swig_property(_skycoin.secp256k1go__XYZ_Z_get, _skycoin.secp256k1go__XYZ_Z_set) - __swig_setmethods__["Infinity"] = _skycoin.secp256k1go__XYZ_Infinity_set - __swig_getmethods__["Infinity"] = _skycoin.secp256k1go__XYZ_Infinity_get - if _newclass: - Infinity = _swig_property(_skycoin.secp256k1go__XYZ_Infinity_get, _skycoin.secp256k1go__XYZ_Infinity_set) - - def __init__(self): - this = _skycoin.new_secp256k1go__XYZ() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_secp256k1go__XYZ - __del__ = lambda self: None -secp256k1go__XYZ_swigregister = _skycoin.secp256k1go__XYZ_swigregister -secp256k1go__XYZ_swigregister(secp256k1go__XYZ) - -class coin__SortableTransactions(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__SortableTransactions, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__SortableTransactions, name) - __repr__ = _swig_repr - __swig_setmethods__["Txns"] = _skycoin.coin__SortableTransactions_Txns_set - __swig_getmethods__["Txns"] = _skycoin.coin__SortableTransactions_Txns_get - if _newclass: - Txns = _swig_property(_skycoin.coin__SortableTransactions_Txns_get, _skycoin.coin__SortableTransactions_Txns_set) - __swig_setmethods__["Fees"] = _skycoin.coin__SortableTransactions_Fees_set - __swig_getmethods__["Fees"] = _skycoin.coin__SortableTransactions_Fees_get - if _newclass: - Fees = _swig_property(_skycoin.coin__SortableTransactions_Fees_get, _skycoin.coin__SortableTransactions_Fees_set) - __swig_setmethods__["Hashes"] = _skycoin.coin__SortableTransactions_Hashes_set - __swig_getmethods__["Hashes"] = _skycoin.coin__SortableTransactions_Hashes_get - if _newclass: - Hashes = _swig_property(_skycoin.coin__SortableTransactions_Hashes_get, _skycoin.coin__SortableTransactions_Hashes_set) - - def __init__(self): - this = _skycoin.new_coin__SortableTransactions() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__SortableTransactions - __del__ = lambda self: None -coin__SortableTransactions_swigregister = _skycoin.coin__SortableTransactions_swigregister -coin__SortableTransactions_swigregister(coin__SortableTransactions) - -class coin__Transaction(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__Transaction, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__Transaction, name) - __repr__ = _swig_repr - - def __eq__(self, t): - return _skycoin.coin__Transaction___eq__(self, t) - __swig_setmethods__["Length"] = _skycoin.coin__Transaction_Length_set - __swig_getmethods__["Length"] = _skycoin.coin__Transaction_Length_get - if _newclass: - Length = _swig_property(_skycoin.coin__Transaction_Length_get, _skycoin.coin__Transaction_Length_set) - __swig_setmethods__["Type"] = _skycoin.coin__Transaction_Type_set - __swig_getmethods__["Type"] = _skycoin.coin__Transaction_Type_get - if _newclass: - Type = _swig_property(_skycoin.coin__Transaction_Type_get, _skycoin.coin__Transaction_Type_set) - __swig_setmethods__["InnerHash"] = _skycoin.coin__Transaction_InnerHash_set - __swig_getmethods__["InnerHash"] = _skycoin.coin__Transaction_InnerHash_get - if _newclass: - InnerHash = _swig_property(_skycoin.coin__Transaction_InnerHash_get, _skycoin.coin__Transaction_InnerHash_set) - __swig_setmethods__["Sigs"] = _skycoin.coin__Transaction_Sigs_set - __swig_getmethods__["Sigs"] = _skycoin.coin__Transaction_Sigs_get - if _newclass: - Sigs = _swig_property(_skycoin.coin__Transaction_Sigs_get, _skycoin.coin__Transaction_Sigs_set) - __swig_setmethods__["In"] = _skycoin.coin__Transaction_In_set - __swig_getmethods__["In"] = _skycoin.coin__Transaction_In_get - if _newclass: - In = _swig_property(_skycoin.coin__Transaction_In_get, _skycoin.coin__Transaction_In_set) - __swig_setmethods__["Out"] = _skycoin.coin__Transaction_Out_set - __swig_getmethods__["Out"] = _skycoin.coin__Transaction_Out_get - if _newclass: - Out = _swig_property(_skycoin.coin__Transaction_Out_get, _skycoin.coin__Transaction_Out_set) - - def __init__(self): - this = _skycoin.new_coin__Transaction() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__Transaction - __del__ = lambda self: None -coin__Transaction_swigregister = _skycoin.coin__Transaction_swigregister -coin__Transaction_swigregister(coin__Transaction) - -class coin__TransactionOutput(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__TransactionOutput, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__TransactionOutput, name) - __repr__ = _swig_repr - - def __eq__(self, t): - return _skycoin.coin__TransactionOutput___eq__(self, t) - __swig_setmethods__["Address"] = _skycoin.coin__TransactionOutput_Address_set - __swig_getmethods__["Address"] = _skycoin.coin__TransactionOutput_Address_get - if _newclass: - Address = _swig_property(_skycoin.coin__TransactionOutput_Address_get, _skycoin.coin__TransactionOutput_Address_set) - __swig_setmethods__["Coins"] = _skycoin.coin__TransactionOutput_Coins_set - __swig_getmethods__["Coins"] = _skycoin.coin__TransactionOutput_Coins_get - if _newclass: - Coins = _swig_property(_skycoin.coin__TransactionOutput_Coins_get, _skycoin.coin__TransactionOutput_Coins_set) - __swig_setmethods__["Hours"] = _skycoin.coin__TransactionOutput_Hours_set - __swig_getmethods__["Hours"] = _skycoin.coin__TransactionOutput_Hours_get - if _newclass: - Hours = _swig_property(_skycoin.coin__TransactionOutput_Hours_get, _skycoin.coin__TransactionOutput_Hours_set) - - def __init__(self): - this = _skycoin.new_coin__TransactionOutput() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__TransactionOutput - __del__ = lambda self: None -coin__TransactionOutput_swigregister = _skycoin.coin__TransactionOutput_swigregister -coin__TransactionOutput_swigregister(coin__TransactionOutput) - -class coin__BlockHeader(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__BlockHeader, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__BlockHeader, name) - __repr__ = _swig_repr - - def __eq__(self, bh): - return _skycoin.coin__BlockHeader___eq__(self, bh) - __swig_setmethods__["Version"] = _skycoin.coin__BlockHeader_Version_set - __swig_getmethods__["Version"] = _skycoin.coin__BlockHeader_Version_get - if _newclass: - Version = _swig_property(_skycoin.coin__BlockHeader_Version_get, _skycoin.coin__BlockHeader_Version_set) - __swig_setmethods__["Time"] = _skycoin.coin__BlockHeader_Time_set - __swig_getmethods__["Time"] = _skycoin.coin__BlockHeader_Time_get - if _newclass: - Time = _swig_property(_skycoin.coin__BlockHeader_Time_get, _skycoin.coin__BlockHeader_Time_set) - __swig_setmethods__["BkSeq"] = _skycoin.coin__BlockHeader_BkSeq_set - __swig_getmethods__["BkSeq"] = _skycoin.coin__BlockHeader_BkSeq_get - if _newclass: - BkSeq = _swig_property(_skycoin.coin__BlockHeader_BkSeq_get, _skycoin.coin__BlockHeader_BkSeq_set) - __swig_setmethods__["Fee"] = _skycoin.coin__BlockHeader_Fee_set - __swig_getmethods__["Fee"] = _skycoin.coin__BlockHeader_Fee_get - if _newclass: - Fee = _swig_property(_skycoin.coin__BlockHeader_Fee_get, _skycoin.coin__BlockHeader_Fee_set) - __swig_setmethods__["PrevHash"] = _skycoin.coin__BlockHeader_PrevHash_set - __swig_getmethods__["PrevHash"] = _skycoin.coin__BlockHeader_PrevHash_get - if _newclass: - PrevHash = _swig_property(_skycoin.coin__BlockHeader_PrevHash_get, _skycoin.coin__BlockHeader_PrevHash_set) - __swig_setmethods__["BodyHash"] = _skycoin.coin__BlockHeader_BodyHash_set - __swig_getmethods__["BodyHash"] = _skycoin.coin__BlockHeader_BodyHash_get - if _newclass: - BodyHash = _swig_property(_skycoin.coin__BlockHeader_BodyHash_get, _skycoin.coin__BlockHeader_BodyHash_set) - __swig_setmethods__["UxHash"] = _skycoin.coin__BlockHeader_UxHash_set - __swig_getmethods__["UxHash"] = _skycoin.coin__BlockHeader_UxHash_get - if _newclass: - UxHash = _swig_property(_skycoin.coin__BlockHeader_UxHash_get, _skycoin.coin__BlockHeader_UxHash_set) - - def __init__(self): - this = _skycoin.new_coin__BlockHeader() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__BlockHeader - __del__ = lambda self: None -coin__BlockHeader_swigregister = _skycoin.coin__BlockHeader_swigregister -coin__BlockHeader_swigregister(coin__BlockHeader) - -class coin__BlockBody(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__BlockBody, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__BlockBody, name) - __repr__ = _swig_repr - - def __eq__(self, b): - return _skycoin.coin__BlockBody___eq__(self, b) - __swig_setmethods__["Transactions"] = _skycoin.coin__BlockBody_Transactions_set - __swig_getmethods__["Transactions"] = _skycoin.coin__BlockBody_Transactions_get - if _newclass: - Transactions = _swig_property(_skycoin.coin__BlockBody_Transactions_get, _skycoin.coin__BlockBody_Transactions_set) - - def __init__(self): - this = _skycoin.new_coin__BlockBody() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__BlockBody - __del__ = lambda self: None -coin__BlockBody_swigregister = _skycoin.coin__BlockBody_swigregister -coin__BlockBody_swigregister(coin__BlockBody) - -class coin__Block(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__Block, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__Block, name) - __repr__ = _swig_repr - __swig_setmethods__["Head"] = _skycoin.coin__Block_Head_set - __swig_getmethods__["Head"] = _skycoin.coin__Block_Head_get - if _newclass: - Head = _swig_property(_skycoin.coin__Block_Head_get, _skycoin.coin__Block_Head_set) - __swig_setmethods__["Body"] = _skycoin.coin__Block_Body_set - __swig_getmethods__["Body"] = _skycoin.coin__Block_Body_get - if _newclass: - Body = _swig_property(_skycoin.coin__Block_Body_get, _skycoin.coin__Block_Body_set) - - def __init__(self): - this = _skycoin.new_coin__Block() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__Block - __del__ = lambda self: None -coin__Block_swigregister = _skycoin.coin__Block_swigregister -coin__Block_swigregister(coin__Block) - -class coin__SignedBlock(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__SignedBlock, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__SignedBlock, name) - __repr__ = _swig_repr - __swig_setmethods__["_unnamed"] = _skycoin.coin__SignedBlock__unnamed_set - __swig_getmethods__["_unnamed"] = _skycoin.coin__SignedBlock__unnamed_get - if _newclass: - _unnamed = _swig_property(_skycoin.coin__SignedBlock__unnamed_get, _skycoin.coin__SignedBlock__unnamed_set) - __swig_setmethods__["Sig"] = _skycoin.coin__SignedBlock_Sig_set - __swig_getmethods__["Sig"] = _skycoin.coin__SignedBlock_Sig_get - if _newclass: - Sig = _swig_property(_skycoin.coin__SignedBlock_Sig_get, _skycoin.coin__SignedBlock_Sig_set) - - def __init__(self): - this = _skycoin.new_coin__SignedBlock() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__SignedBlock - __del__ = lambda self: None -coin__SignedBlock_swigregister = _skycoin.coin__SignedBlock_swigregister -coin__SignedBlock_swigregister(coin__SignedBlock) - -class coin__UxHead(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__UxHead, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__UxHead, name) - __repr__ = _swig_repr - __swig_setmethods__["Time"] = _skycoin.coin__UxHead_Time_set - __swig_getmethods__["Time"] = _skycoin.coin__UxHead_Time_get - if _newclass: - Time = _swig_property(_skycoin.coin__UxHead_Time_get, _skycoin.coin__UxHead_Time_set) - __swig_setmethods__["BkSeq"] = _skycoin.coin__UxHead_BkSeq_set - __swig_getmethods__["BkSeq"] = _skycoin.coin__UxHead_BkSeq_get - if _newclass: - BkSeq = _swig_property(_skycoin.coin__UxHead_BkSeq_get, _skycoin.coin__UxHead_BkSeq_set) - - def __init__(self): - this = _skycoin.new_coin__UxHead() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__UxHead - __del__ = lambda self: None -coin__UxHead_swigregister = _skycoin.coin__UxHead_swigregister -coin__UxHead_swigregister(coin__UxHead) - -class coin__UxBody(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__UxBody, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__UxBody, name) - __repr__ = _swig_repr - - def GetSrcTransaction(self): - return _skycoin.coin__UxBody_GetSrcTransaction(self) - - def SetSrcTransaction(self, o): - return _skycoin.coin__UxBody_SetSrcTransaction(self, o) - __swig_setmethods__["SrcTransaction"] = _skycoin.coin__UxBody_SrcTransaction_set - __swig_getmethods__["SrcTransaction"] = _skycoin.coin__UxBody_SrcTransaction_get - if _newclass: - SrcTransaction = _swig_property(_skycoin.coin__UxBody_SrcTransaction_get, _skycoin.coin__UxBody_SrcTransaction_set) - __swig_setmethods__["Address"] = _skycoin.coin__UxBody_Address_set - __swig_getmethods__["Address"] = _skycoin.coin__UxBody_Address_get - if _newclass: - Address = _swig_property(_skycoin.coin__UxBody_Address_get, _skycoin.coin__UxBody_Address_set) - __swig_setmethods__["Coins"] = _skycoin.coin__UxBody_Coins_set - __swig_getmethods__["Coins"] = _skycoin.coin__UxBody_Coins_get - if _newclass: - Coins = _swig_property(_skycoin.coin__UxBody_Coins_get, _skycoin.coin__UxBody_Coins_set) - __swig_setmethods__["Hours"] = _skycoin.coin__UxBody_Hours_set - __swig_getmethods__["Hours"] = _skycoin.coin__UxBody_Hours_get - if _newclass: - Hours = _swig_property(_skycoin.coin__UxBody_Hours_get, _skycoin.coin__UxBody_Hours_set) - - def __init__(self): - this = _skycoin.new_coin__UxBody() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__UxBody - __del__ = lambda self: None -coin__UxBody_swigregister = _skycoin.coin__UxBody_swigregister -coin__UxBody_swigregister(coin__UxBody) - -class coin__UxOut(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, coin__UxOut, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, coin__UxOut, name) - __repr__ = _swig_repr - - def __eq__(self, u): - return _skycoin.coin__UxOut___eq__(self, u) - __swig_setmethods__["Head"] = _skycoin.coin__UxOut_Head_set - __swig_getmethods__["Head"] = _skycoin.coin__UxOut_Head_get - if _newclass: - Head = _swig_property(_skycoin.coin__UxOut_Head_get, _skycoin.coin__UxOut_Head_set) - __swig_setmethods__["Body"] = _skycoin.coin__UxOut_Body_set - __swig_getmethods__["Body"] = _skycoin.coin__UxOut_Body_get - if _newclass: - Body = _swig_property(_skycoin.coin__UxOut_Body_get, _skycoin.coin__UxOut_Body_set) - - def __init__(self): - this = _skycoin.new_coin__UxOut() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_coin__UxOut - __del__ = lambda self: None -coin__UxOut_swigregister = _skycoin.coin__UxOut_swigregister -coin__UxOut_swigregister(coin__UxOut) - -class wallet__Balance(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, wallet__Balance, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, wallet__Balance, name) - __repr__ = _swig_repr - __swig_setmethods__["Coins"] = _skycoin.wallet__Balance_Coins_set - __swig_getmethods__["Coins"] = _skycoin.wallet__Balance_Coins_get - if _newclass: - Coins = _swig_property(_skycoin.wallet__Balance_Coins_get, _skycoin.wallet__Balance_Coins_set) - __swig_setmethods__["Hours"] = _skycoin.wallet__Balance_Hours_set - __swig_getmethods__["Hours"] = _skycoin.wallet__Balance_Hours_get - if _newclass: - Hours = _swig_property(_skycoin.wallet__Balance_Hours_get, _skycoin.wallet__Balance_Hours_set) - - def __init__(self): - this = _skycoin.new_wallet__Balance() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_wallet__Balance - __del__ = lambda self: None -wallet__Balance_swigregister = _skycoin.wallet__Balance_swigregister -wallet__Balance_swigregister(wallet__Balance) - -class wallet__BalancePair(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, wallet__BalancePair, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, wallet__BalancePair, name) - __repr__ = _swig_repr - __swig_setmethods__["Confirmed"] = _skycoin.wallet__BalancePair_Confirmed_set - __swig_getmethods__["Confirmed"] = _skycoin.wallet__BalancePair_Confirmed_get - if _newclass: - Confirmed = _swig_property(_skycoin.wallet__BalancePair_Confirmed_get, _skycoin.wallet__BalancePair_Confirmed_set) - __swig_setmethods__["Predicted"] = _skycoin.wallet__BalancePair_Predicted_set - __swig_getmethods__["Predicted"] = _skycoin.wallet__BalancePair_Predicted_get - if _newclass: - Predicted = _swig_property(_skycoin.wallet__BalancePair_Predicted_get, _skycoin.wallet__BalancePair_Predicted_set) - - def __init__(self): - this = _skycoin.new_wallet__BalancePair() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_wallet__BalancePair - __del__ = lambda self: None -wallet__BalancePair_swigregister = _skycoin.wallet__BalancePair_swigregister -wallet__BalancePair_swigregister(wallet__BalancePair) - -class wallet__Entry(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, wallet__Entry, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, wallet__Entry, name) - __repr__ = _swig_repr - __swig_setmethods__["Address"] = _skycoin.wallet__Entry_Address_set - __swig_getmethods__["Address"] = _skycoin.wallet__Entry_Address_get - if _newclass: - Address = _swig_property(_skycoin.wallet__Entry_Address_get, _skycoin.wallet__Entry_Address_set) - __swig_setmethods__["Public"] = _skycoin.wallet__Entry_Public_set - __swig_getmethods__["Public"] = _skycoin.wallet__Entry_Public_get - if _newclass: - Public = _swig_property(_skycoin.wallet__Entry_Public_get, _skycoin.wallet__Entry_Public_set) - __swig_setmethods__["Secret"] = _skycoin.wallet__Entry_Secret_set - __swig_getmethods__["Secret"] = _skycoin.wallet__Entry_Secret_get - if _newclass: - Secret = _swig_property(_skycoin.wallet__Entry_Secret_get, _skycoin.wallet__Entry_Secret_set) - - def __init__(self): - this = _skycoin.new_wallet__Entry() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_wallet__Entry - __del__ = lambda self: None -wallet__Entry_swigregister = _skycoin.wallet__Entry_swigregister -wallet__Entry_swigregister(wallet__Entry) - -class wallet__Note(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, wallet__Note, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, wallet__Note, name) - __repr__ = _swig_repr - __swig_setmethods__["TxID"] = _skycoin.wallet__Note_TxID_set - __swig_getmethods__["TxID"] = _skycoin.wallet__Note_TxID_get - if _newclass: - TxID = _swig_property(_skycoin.wallet__Note_TxID_get, _skycoin.wallet__Note_TxID_set) - __swig_setmethods__["Value"] = _skycoin.wallet__Note_Value_set - __swig_getmethods__["Value"] = _skycoin.wallet__Note_Value_get - if _newclass: - Value = _swig_property(_skycoin.wallet__Note_Value_get, _skycoin.wallet__Note_Value_set) - - def __init__(self): - this = _skycoin.new_wallet__Note() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_wallet__Note - __del__ = lambda self: None -wallet__Note_swigregister = _skycoin.wallet__Note_swigregister -wallet__Note_swigregister(wallet__Note) - -class wallet__ReadableNote(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, wallet__ReadableNote, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, wallet__ReadableNote, name) - __repr__ = _swig_repr - __swig_setmethods__["TransactionID"] = _skycoin.wallet__ReadableNote_TransactionID_set - __swig_getmethods__["TransactionID"] = _skycoin.wallet__ReadableNote_TransactionID_get - if _newclass: - TransactionID = _swig_property(_skycoin.wallet__ReadableNote_TransactionID_get, _skycoin.wallet__ReadableNote_TransactionID_set) - __swig_setmethods__["ActualNote"] = _skycoin.wallet__ReadableNote_ActualNote_set - __swig_getmethods__["ActualNote"] = _skycoin.wallet__ReadableNote_ActualNote_get - if _newclass: - ActualNote = _swig_property(_skycoin.wallet__ReadableNote_ActualNote_get, _skycoin.wallet__ReadableNote_ActualNote_set) - - def __init__(self): - this = _skycoin.new_wallet__ReadableNote() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_wallet__ReadableNote - __del__ = lambda self: None -wallet__ReadableNote_swigregister = _skycoin.wallet__ReadableNote_swigregister -wallet__ReadableNote_swigregister(wallet__ReadableNote) - -class wallet__Wallet(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, wallet__Wallet, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, wallet__Wallet, name) - __repr__ = _swig_repr - __swig_setmethods__["Meta"] = _skycoin.wallet__Wallet_Meta_set - __swig_getmethods__["Meta"] = _skycoin.wallet__Wallet_Meta_get - if _newclass: - Meta = _swig_property(_skycoin.wallet__Wallet_Meta_get, _skycoin.wallet__Wallet_Meta_set) - __swig_setmethods__["Entries"] = _skycoin.wallet__Wallet_Entries_set - __swig_getmethods__["Entries"] = _skycoin.wallet__Wallet_Entries_get - if _newclass: - Entries = _swig_property(_skycoin.wallet__Wallet_Entries_get, _skycoin.wallet__Wallet_Entries_set) - - def __init__(self): - this = _skycoin.new_wallet__Wallet() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_wallet__Wallet - __del__ = lambda self: None -wallet__Wallet_swigregister = _skycoin.wallet__Wallet_swigregister -wallet__Wallet_swigregister(wallet__Wallet) - -class wallet__UxBalance(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, wallet__UxBalance, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, wallet__UxBalance, name) - __repr__ = _swig_repr - __swig_setmethods__["Hash"] = _skycoin.wallet__UxBalance_Hash_set - __swig_getmethods__["Hash"] = _skycoin.wallet__UxBalance_Hash_get - if _newclass: - Hash = _swig_property(_skycoin.wallet__UxBalance_Hash_get, _skycoin.wallet__UxBalance_Hash_set) - __swig_setmethods__["BkSeq"] = _skycoin.wallet__UxBalance_BkSeq_set - __swig_getmethods__["BkSeq"] = _skycoin.wallet__UxBalance_BkSeq_get - if _newclass: - BkSeq = _swig_property(_skycoin.wallet__UxBalance_BkSeq_get, _skycoin.wallet__UxBalance_BkSeq_set) - __swig_setmethods__["Address"] = _skycoin.wallet__UxBalance_Address_set - __swig_getmethods__["Address"] = _skycoin.wallet__UxBalance_Address_get - if _newclass: - Address = _swig_property(_skycoin.wallet__UxBalance_Address_get, _skycoin.wallet__UxBalance_Address_set) - __swig_setmethods__["Coins"] = _skycoin.wallet__UxBalance_Coins_set - __swig_getmethods__["Coins"] = _skycoin.wallet__UxBalance_Coins_get - if _newclass: - Coins = _swig_property(_skycoin.wallet__UxBalance_Coins_get, _skycoin.wallet__UxBalance_Coins_set) - __swig_setmethods__["Hours"] = _skycoin.wallet__UxBalance_Hours_set - __swig_getmethods__["Hours"] = _skycoin.wallet__UxBalance_Hours_get - if _newclass: - Hours = _swig_property(_skycoin.wallet__UxBalance_Hours_get, _skycoin.wallet__UxBalance_Hours_set) - - def __init__(self): - this = _skycoin.new_wallet__UxBalance() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_wallet__UxBalance - __del__ = lambda self: None -wallet__UxBalance_swigregister = _skycoin.wallet__UxBalance_swigregister -wallet__UxBalance_swigregister(wallet__UxBalance) - -class api__RichlistParams(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, api__RichlistParams, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, api__RichlistParams, name) - __repr__ = _swig_repr - __swig_setmethods__["N"] = _skycoin.api__RichlistParams_N_set - __swig_getmethods__["N"] = _skycoin.api__RichlistParams_N_get - if _newclass: - N = _swig_property(_skycoin.api__RichlistParams_N_get, _skycoin.api__RichlistParams_N_set) - __swig_setmethods__["IncludeDistribution"] = _skycoin.api__RichlistParams_IncludeDistribution_set - __swig_getmethods__["IncludeDistribution"] = _skycoin.api__RichlistParams_IncludeDistribution_get - if _newclass: - IncludeDistribution = _swig_property(_skycoin.api__RichlistParams_IncludeDistribution_get, _skycoin.api__RichlistParams_IncludeDistribution_set) - - def __init__(self): - this = _skycoin.new_api__RichlistParams() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_api__RichlistParams - __del__ = lambda self: None -api__RichlistParams_swigregister = _skycoin.api__RichlistParams_swigregister -api__RichlistParams_swigregister(api__RichlistParams) - -class cli__SendAmount(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, cli__SendAmount, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, cli__SendAmount, name) - __repr__ = _swig_repr - __swig_setmethods__["Addr"] = _skycoin.cli__SendAmount_Addr_set - __swig_getmethods__["Addr"] = _skycoin.cli__SendAmount_Addr_get - if _newclass: - Addr = _swig_property(_skycoin.cli__SendAmount_Addr_get, _skycoin.cli__SendAmount_Addr_set) - __swig_setmethods__["Coins"] = _skycoin.cli__SendAmount_Coins_set - __swig_getmethods__["Coins"] = _skycoin.cli__SendAmount_Coins_get - if _newclass: - Coins = _swig_property(_skycoin.cli__SendAmount_Coins_get, _skycoin.cli__SendAmount_Coins_set) - - def __init__(self): - this = _skycoin.new_cli__SendAmount() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_cli__SendAmount - __del__ = lambda self: None -cli__SendAmount_swigregister = _skycoin.cli__SendAmount_swigregister -cli__SendAmount_swigregister(cli__SendAmount) - -class httphelper__Address(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, httphelper__Address, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, httphelper__Address, name) - __repr__ = _swig_repr - __swig_setmethods__["_unnamed"] = _skycoin.httphelper__Address__unnamed_set - __swig_getmethods__["_unnamed"] = _skycoin.httphelper__Address__unnamed_get - if _newclass: - _unnamed = _swig_property(_skycoin.httphelper__Address__unnamed_get, _skycoin.httphelper__Address__unnamed_set) - - def __init__(self): - this = _skycoin.new_httphelper__Address() - try: - self.this.append(this) - except __builtin__.Exception: - self.this = this - __swig_destroy__ = _skycoin.delete_httphelper__Address - __del__ = lambda self: None -httphelper__Address_swigregister = _skycoin.httphelper__Address_swigregister -httphelper__Address_swigregister(httphelper__Address) - -# This file is compatible with both classic and new-style classes. - - diff --git a/tests/test_cipher_crypto.py b/tests/test_cipher_crypto.py index c9dbbebf..26143be8 100644 --- a/tests/test_cipher_crypto.py +++ b/tests/test_cipher_crypto.py @@ -1,312 +1,336 @@ import skycoin -import tests.utils - def test_TestNewPubKey(): - public_key = skycoin.cipher_PubKey() - _, data = skycoin.SKY_cipher_RandByte(31) - assert skycoin.SKY_cipher_NewPubKey(data, public_key) == skycoin.SKY_ErrInvalidLengthPubKey - _, data = skycoin.SKY_cipher_RandByte(32) - assert skycoin.SKY_cipher_NewPubKey(data, public_key) == skycoin.SKY_ErrInvalidLengthPubKey - _, data = skycoin.SKY_cipher_RandByte(34) - assert skycoin.SKY_cipher_NewPubKey(data, public_key) == skycoin.SKY_ErrInvalidLengthPubKey - _, data = skycoin.SKY_cipher_RandByte(0) - assert skycoin.SKY_cipher_NewPubKey(data, public_key) == skycoin.SKY_ErrInvalidLengthPubKey - _, data = skycoin.SKY_cipher_RandByte(100) - assert skycoin.SKY_cipher_NewPubKey(data, public_key) == skycoin.SKY_ErrInvalidLengthPubKey - _, data = skycoin.SKY_cipher_RandByte(33) - assert skycoin.SKY_cipher_NewPubKey(data, public_key) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + _, data = skycoin.cipher.RandByte(31) + err = skycoin.cipher.NewPubKey(data, public_key) + assert err == skycoin.SKY_ErrInvalidLengthPubKey + _, data = skycoin.cipher.RandByte(32) + err = skycoin.cipher.NewPubKey(data, public_key) + assert err == skycoin.SKY_ErrInvalidLengthPubKey + _, data = skycoin.cipher.RandByte(34) + err = skycoin.cipher.NewPubKey(data, public_key) + assert err == skycoin.SKY_ErrInvalidLengthPubKey + _, data = skycoin.cipher.RandByte(0) + err = skycoin.cipher.NewPubKey(data, public_key) + assert err == skycoin.SKY_ErrInvalidLengthPubKey + _, data = skycoin.cipher.RandByte(100) + assert skycoin.cipher.NewPubKey(data, public_key) == skycoin.SKY_ErrInvalidLengthPubKey + _, data = skycoin.cipher.RandByte(33) + assert skycoin.cipher.NewPubKey(data, public_key) == skycoin.SKY_OK assert public_key.toStr() == data - - def test_TestPubKeyVerify(): # Random bytes should not be valid, most of the time failed = False for _ in range(10): - public_key = skycoin.cipher_PubKey() - _, data = skycoin.SKY_cipher_RandByte(33) - skycoin.SKY_cipher_NewPubKey(data, public_key) - if skycoin.SKY_cipher_PubKey_Verify(public_key) != None: + public_key = skycoin.cipher.PubKey() + _, data = skycoin.cipher.RandByte(33) + skycoin.cipher.NewPubKey(data, public_key) + if skycoin.cipher.PubKeyVerify(public_key) != None: failed = True break assert failed is True def test_TestPubKeyVerifyNil(): # Empty public key should not be valid - public_key = skycoin.cipher_PubKey() - assert skycoin.SKY_cipher_PubKey_Verify(public_key) == skycoin.SKY_ErrInvalidPubKey + public_key = skycoin.cipher.PubKey() + err = skycoin.cipher.PubKeyVerify(public_key) + assert err == skycoin.SKY_ErrInvalidPubKey def test_TestPubKeyVerifyDefault1(): # Generated pub key should be valid - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - assert skycoin.SKY_cipher_PubKey_Verify(public_key) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + assert skycoin.cipher.PubKeyVerify(public_key) == skycoin.SKY_OK def test_TestPubKeyVerifyDefault2(): for _ in range(1024): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - assert skycoin.SKY_cipher_PubKey_Verify(public_key) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + assert skycoin.cipher.PubKeyVerify(public_key) == skycoin.SKY_OK def test_TestPubKeyToAddress(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - addres = skycoin.cipher__Address() - skycoin.SKY_cipher_AddressFromPubKey(public_key, addres) - # func (self Address) Verify(key PubKey) error - assert skycoin.SKY_cipher_Address_Verify(addres, public_key) == skycoin.SKY_OK - # func DecodeBase58Address(addr string) (Address, error) - _, addres_str = skycoin.SKY_cipher_Address_String(addres) - assert skycoin.SKY_cipher_DecodeBase58Address(addres_str, addres) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + addres = skycoin.cipher.Address() + skycoin.cipher.AddressFromPubKey(public_key, addres) + err = skycoin.cipher.AddressVerify(addres, public_key) + assert err == skycoin.SKY_OK + _, addres_str = skycoin.cipher.AddressString(addres) + err = skycoin.cipher.DecodeBase58Address(addres_str, addres) + assert err == skycoin.SKY_OK def test_TestPubKeyToAddress2(): for _ in range(1024): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - addres = skycoin.cipher__Address() - skycoin.SKY_cipher_AddressFromPubKey(public_key, addres) - # func (self Address) Verify(key PubKey) error - assert skycoin.SKY_cipher_Address_Verify(addres, public_key) == skycoin.SKY_OK - # func DecodeBase58Address(addr string) (Address, error) - _, addres_str = skycoin.SKY_cipher_Address_String(addres) - assert skycoin.SKY_cipher_DecodeBase58Address(addres_str, addres) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + addres = skycoin.cipher.Address() + skycoin.cipher.AddressFromPubKey(public_key, addres) + assert skycoin.cipher.AddressVerify(addres, public_key) == skycoin.SKY_OK + _, addres_str = skycoin.cipher.AddressString(addres) + assert skycoin.cipher.DecodeBase58Address(addres_str, addres) == skycoin.SKY_OK def test_TestMustNewSecKey(): - secret_key = skycoin.cipher_SecKey() - _, data = skycoin.SKY_cipher_RandByte(31) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey - _, data = skycoin.SKY_cipher_RandByte(33) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey - _, data = skycoin.SKY_cipher_RandByte(34) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey - _, data = skycoin.SKY_cipher_RandByte(0) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey - _, data = skycoin.SKY_cipher_RandByte(100) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey - _, data = skycoin.SKY_cipher_RandByte(32) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_OK + secret_key = skycoin.cipher.SecKey() + _, data = skycoin.cipher.RandByte(31) + assert skycoin.cipher.NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey + _, data = skycoin.cipher.RandByte(33) + assert skycoin.cipher.NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey + _, data = skycoin.cipher.RandByte(34) + assert skycoin.cipher.NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey + _, data = skycoin.cipher.RandByte(0) + assert skycoin.cipher.NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey + _, data = skycoin.cipher.RandByte(100) + assert skycoin.cipher.NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey + _, data = skycoin.cipher.RandByte(32) + assert skycoin.cipher.NewSecKey(data, secret_key) == skycoin.SKY_OK assert secret_key.toStr() == data def test_TestSecKeyVerify(): # Empty secret key should not be valid - secret_key = skycoin.cipher_SecKey() - public_key = skycoin.cipher_PubKey() - assert skycoin.SKY_cipher_SecKey_Verify(secret_key) != None + secret_key = skycoin.cipher.SecKey() + public_key = skycoin.cipher.PubKey() + err = skycoin.cipher.SecKeyVerify(secret_key) + assert err != None # Generated sec key should be valid - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - assert skycoin.SKY_cipher_PubKey_Verify(public_key) == skycoin.SKY_OK + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + err = skycoin.cipher.PubKeyVerify(public_key) + assert err == skycoin.SKY_OK def test_TestECDHonce(): - secret_key_1 = skycoin.cipher_SecKey() - public_key_1 = skycoin.cipher_PubKey() - secret_key_2 = skycoin.cipher_SecKey() - public_key_2 = skycoin.cipher_PubKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key_1, secret_key_1) - skycoin.SKY_cipher_GenerateKeyPair(public_key_2, secret_key_2) - _, data_1 = skycoin.SKY_cipher_ECDH(public_key_2, secret_key_1) - _, data_2 = skycoin.SKY_cipher_ECDH(public_key_1, secret_key_2) + secret_key_1 = skycoin.cipher.SecKey() + public_key_1 = skycoin.cipher.PubKey() + secret_key_2 = skycoin.cipher.SecKey() + public_key_2 = skycoin.cipher.PubKey() + skycoin.cipher.GenerateKeyPair(public_key_1, secret_key_1) + skycoin.cipher.GenerateKeyPair(public_key_2, secret_key_2) + _, data_1 = skycoin.cipher.ECDH(public_key_2, secret_key_1) + _, data_2 = skycoin.cipher.ECDH(public_key_1, secret_key_2) assert data_1 == data_2 def test_TestECDHloop(): for _ in range(128): - secret_key_1 = skycoin.cipher_SecKey() - public_key_1 = skycoin.cipher_PubKey() - secret_key_2 = skycoin.cipher_SecKey() - public_key_2 = skycoin.cipher_PubKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key_1, secret_key_1) - skycoin.SKY_cipher_GenerateKeyPair(public_key_2, secret_key_2) - _, data_1 = skycoin.SKY_cipher_ECDH(public_key_2, secret_key_1) - _, data_2 = skycoin.SKY_cipher_ECDH(public_key_1, secret_key_2) + secret_key_1 = skycoin.cipher.SecKey() + public_key_1 = skycoin.cipher.PubKey() + secret_key_2 = skycoin.cipher.SecKey() + public_key_2 = skycoin.cipher.PubKey() + skycoin.cipher.GenerateKeyPair(public_key_1, secret_key_1) + skycoin.cipher.GenerateKeyPair(public_key_2, secret_key_2) + _, data_1 = skycoin.cipher.ECDH(public_key_2, secret_key_1) + _, data_2 = skycoin.cipher.ECDH(public_key_1, secret_key_2) assert data_1 == data_2 def test_TestNewSig(): - sig = skycoin.cipher_Sig() - _, data = skycoin.SKY_cipher_RandByte(64) - assert skycoin.SKY_cipher_NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig - _, data = skycoin.SKY_cipher_RandByte(66) - assert skycoin.SKY_cipher_NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig - _, data = skycoin.SKY_cipher_RandByte(67) - assert skycoin.SKY_cipher_NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig - _, data = skycoin.SKY_cipher_RandByte(0) - assert skycoin.SKY_cipher_NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig - _, data = skycoin.SKY_cipher_RandByte(100) - assert skycoin.SKY_cipher_NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig - _, data = skycoin.SKY_cipher_RandByte(65) - assert skycoin.SKY_cipher_NewSig(data, sig) == skycoin.SKY_OK + sig = skycoin.cipher.Sig() + _, data = skycoin.cipher.RandByte(64) + err = skycoin.cipher.NewSig(data, sig) + assert err == skycoin.SKY_ErrInvalidLengthSig + _, data = skycoin.cipher.RandByte(66) + assert skycoin.cipher.NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig + _, data = skycoin.cipher.RandByte(67) + assert skycoin.cipher.NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig + _, data = skycoin.cipher.RandByte(0) + assert skycoin.cipher.NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig + _, data = skycoin.cipher.RandByte(100) + assert skycoin.cipher.NewSig(data, sig) == skycoin.SKY_ErrInvalidLengthSig + _, data = skycoin.cipher.RandByte(65) + assert skycoin.cipher.NewSig(data, sig) == skycoin.SKY_OK assert sig.toStr() == data def test_TestChkSig(): - secret_key_1 = skycoin.cipher_SecKey() - secret_key_2 = skycoin.cipher_SecKey() - public_key_1 = skycoin.cipher_PubKey() - public_key_2 = skycoin.cipher_PubKey() - addres = skycoin.cipher__Address() - addres_2 = skycoin.cipher__Address() - sig_1 = skycoin.cipher_Sig() - sig_2 = skycoin.cipher_Sig() - sha_sum = skycoin.cipher_SHA256() - sha_sum_2 = skycoin.cipher_SHA256() - skycoin.SKY_cipher_GenerateKeyPair(public_key_1, secret_key_1) - skycoin.SKY_cipher_PubKey_Verify(public_key_1) - skycoin.SKY_cipher_SecKey_Verify(secret_key_1) - skycoin.SKY_cipher_AddressFromPubKey(public_key_1, addres) - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum) - skycoin.SKY_cipher_SignHash(sha_sum, secret_key_1, sig_1) - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_1) == skycoin.SKY_OK + secret_key_1 = skycoin.cipher.SecKey() + secret_key_2 = skycoin.cipher.SecKey() + public_key_1 = skycoin.cipher.PubKey() + public_key_2 = skycoin.cipher.PubKey() + addres = skycoin.cipher.Address() + addres_2 = skycoin.cipher.Address() + sig_1 = skycoin.cipher.Sig() + sig_2 = skycoin.cipher.Sig() + sha_sum = skycoin.cipher.SHA256() + sha_sum_2 = skycoin.cipher.SHA256() + skycoin.cipher.GenerateKeyPair(public_key_1, secret_key_1) + skycoin.cipher.PubKeyVerify(public_key_1) + skycoin.cipher.SecKeyVerify(secret_key_1) + skycoin.cipher.AddressFromPubKey(public_key_1, addres) + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum) + skycoin.cipher.SignHash(sha_sum, secret_key_1, sig_1) + err = skycoin.cipher.ChkSig(addres, sha_sum, sig_1) + assert err == skycoin.SKY_OK # Empty sig should be invalid - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_2) == skycoin.SKY_ErrInvalidSigForPubKey + err = skycoin.cipher.ChkSig(addres, sha_sum, sig_2) + assert err == skycoin.SKY_ErrInvalidSigForPubKey # Random sigs should not pass for _ in range(100): - _, data = skycoin.SKY_cipher_RandByte(65) - skycoin.SKY_cipher_NewSig(data, sig_1) - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_1) != skycoin.SKY_OK + _, data = skycoin.cipher.RandByte(65) + skycoin.cipher.NewSig(data, sig_1) + assert skycoin.cipher.ChkSig(addres, sha_sum, sig_1) != skycoin.SKY_OK # Sig for one hash does not work for another hash - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum_2) - skycoin.SKY_cipher_SignHash(sha_sum_2, secret_key_1, sig_2) - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum_2, sig_2) == skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_2) != skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum_2, sig_1) != skycoin.SKY_OK + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum_2) + skycoin.cipher.SignHash(sha_sum_2, secret_key_1, sig_2) + err = skycoin.cipher.ChkSig(addres, sha_sum_2, sig_2) + assert err == skycoin.SKY_OK + err = skycoin.cipher.ChkSig(addres, sha_sum, sig_2) + assert err != skycoin.SKY_OK + err = skycoin.cipher.ChkSig(addres, sha_sum_2, sig_1) + assert err != skycoin.SKY_OK # Different secret keys should not create same sig - skycoin.SKY_cipher_GenerateKeyPair(public_key_2, secret_key_2) - skycoin.SKY_cipher_AddressFromPubKey(public_key_2, addres_2) - sha_sum = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SignHash(sha_sum, secret_key_1, sig_1) - skycoin.SKY_cipher_SignHash(sha_sum, secret_key_2, sig_2) - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(addres_2, sha_sum, sig_2) == skycoin.SKY_OK + skycoin.cipher.GenerateKeyPair(public_key_2, secret_key_2) + skycoin.cipher.AddressFromPubKey(public_key_2, addres_2) + sha_sum = skycoin.cipher.SHA256() + skycoin.cipher.SignHash(sha_sum, secret_key_1, sig_1) + skycoin.cipher.SignHash(sha_sum, secret_key_2, sig_2) + err = skycoin.cipher.ChkSig(addres, sha_sum, sig_1) + assert err == skycoin.SKY_OK + err = skycoin.cipher.ChkSig(addres_2, sha_sum, sig_2) + assert err == skycoin.SKY_OK assert sig_1 != sig_2 - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum) - skycoin.SKY_cipher_SignHash(sha_sum, secret_key_1, sig_1) - skycoin.SKY_cipher_SignHash(sha_sum, secret_key_2, sig_2) - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(addres_2, sha_sum, sig_2) == skycoin.SKY_OK + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum) + skycoin.cipher.SignHash(sha_sum, secret_key_1, sig_1) + skycoin.cipher.SignHash(sha_sum, secret_key_2, sig_2) + assert skycoin.cipher.ChkSig(addres, sha_sum, sig_1) == skycoin.SKY_OK + assert skycoin.cipher.ChkSig(addres_2, sha_sum, sig_2) == skycoin.SKY_OK assert sig_1 != sig_2 # Bad address should be invalid - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_2) != skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(addres_2, sha_sum, sig_1) != skycoin.SKY_OK + err = skycoin.cipher.ChkSig(addres, sha_sum, sig_2) + assert err != skycoin.SKY_OK + err = skycoin.cipher.ChkSig(addres_2, sha_sum, sig_1) + assert err != skycoin.SKY_OK def test_TestSignHash(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - addres = skycoin.cipher__Address() - sha_sum = skycoin.cipher_SHA256() - sig_1 = skycoin.cipher_Sig() - sig_2 = skycoin.cipher_Sig() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - skycoin.SKY_cipher_AddressFromPubKey(public_key, addres) - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum) - skycoin.SKY_cipher_SignHash(sha_sum, secret_key, sig_1) + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + addres = skycoin.cipher.Address() + sha_sum = skycoin.cipher.SHA256() + sig_1 = skycoin.cipher.Sig() + sig_2 = skycoin.cipher.Sig() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + skycoin.cipher.AddressFromPubKey(public_key, addres) + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum) + skycoin.cipher.SignHash(sha_sum, secret_key, sig_1) assert sig_1 != sig_2 - assert skycoin.SKY_cipher_ChkSig(addres, sha_sum, sig_1) == skycoin.SKY_OK + assert skycoin.cipher.ChkSig(addres, sha_sum, sig_1) == skycoin.SKY_OK def test_TestPubKeyFromSecKey(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - public_key_2 = skycoin.cipher_PubKey() - skycoin.SKY_cipher_PubKeyFromSecKey(secret_key, public_key_2) + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + public_key_2 = skycoin.cipher.PubKey() + skycoin.cipher.PubKeyFromSecKey(secret_key, public_key_2) assert public_key == public_key_2 - secret_key_2 = skycoin.cipher_SecKey() - assert skycoin.SKY_cipher_PubKeyFromSecKey(secret_key_2, public_key) == skycoin.SKY_ErrPubKeyFromNullSecKey - _, data = skycoin.SKY_cipher_RandByte(99) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey - _, data = skycoin.SKY_cipher_RandByte(31) - assert skycoin.SKY_cipher_NewSecKey(data, secret_key) == skycoin.SKY_ErrInvalidLengthSecKey + secret_key_2 = skycoin.cipher.SecKey() + err = skycoin.cipher.PubKeyFromSecKey(secret_key_2, public_key) + assert err == skycoin.SKY_ErrPubKeyFromNullSecKey + _, data = skycoin.cipher.RandByte(99) + err = skycoin.cipher.NewSecKey(data, secret_key) + assert err == skycoin.SKY_ErrInvalidLengthSecKey + _, data = skycoin.cipher.RandByte(31) + err = skycoin.cipher.NewSecKey(data, secret_key) + assert err == skycoin.SKY_ErrInvalidLengthSecKey def test_TestPubKeyFromSig(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - sha_sum = skycoin.cipher_SHA256() - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum) - sig_1 = skycoin.cipher_Sig() - skycoin.SKY_cipher_SignHash(sha_sum, secret_key, sig_1) - public_key_2 = skycoin.cipher_PubKey() - assert skycoin.SKY_cipher_PubKeyFromSig(sig_1, sha_sum, public_key_2) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + sha_sum = skycoin.cipher.SHA256() + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum) + sig_1 = skycoin.cipher.Sig() + skycoin.cipher.SignHash(sha_sum, secret_key, sig_1) + public_key_2 = skycoin.cipher.PubKey() + assert skycoin.cipher.PubKeyFromSig(sig_1, sha_sum, public_key_2) == skycoin.SKY_OK assert public_key == public_key_2 - sig_2 = skycoin.cipher_Sig() - assert skycoin.SKY_cipher_PubKeyFromSig(sig_2, sha_sum, public_key_2) == skycoin.SKY_ErrInvalidSigForPubKey + sig_2 = skycoin.cipher.Sig() + assert skycoin.cipher.PubKeyFromSig(sig_2, sha_sum, public_key_2) == skycoin.SKY_ErrInvalidSigForPubKey def test_TestVerifySignature(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - sha_sum_1 = skycoin.cipher_SHA256() - sha_sum_2 = skycoin.cipher_SHA256() - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum_1) - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum_2) - sig_1 = skycoin.cipher_Sig() - sig_2 = skycoin.cipher_Sig() - skycoin.SKY_cipher_SignHash(sha_sum_1, secret_key, sig_1) - assert skycoin.SKY_cipher_VerifySignature(public_key, sig_1, sha_sum_1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_VerifySignature(public_key, sig_2, sha_sum_1) == skycoin.SKY_ErrInvalidSigForPubKey - assert skycoin.SKY_cipher_VerifySignature(public_key, sig_1, sha_sum_2) == skycoin.SKY_ErrPubKeyRecoverMismatch - public_key_2 = skycoin.cipher_PubKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key_2, secret_key) - assert skycoin.SKY_cipher_VerifySignature(public_key_2, sig_1, sha_sum_1) == skycoin.SKY_ErrPubKeyRecoverMismatch - public_key_3 = skycoin.cipher_PubKey() - assert skycoin.SKY_cipher_VerifySignature(public_key_3, sig_1, sha_sum_1) == skycoin.SKY_ErrPubKeyRecoverMismatch + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + sha_sum_1 = skycoin.cipher.SHA256() + sha_sum_2 = skycoin.cipher.SHA256() + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum_1) + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum_2) + sig_1 = skycoin.cipher.Sig() + sig_2 = skycoin.cipher.Sig() + skycoin.cipher.SignHash(sha_sum_1, secret_key, sig_1) + assert skycoin.cipher.VerifySignature(public_key, sig_1, sha_sum_1) == skycoin.SKY_OK + assert skycoin.cipher.VerifySignature(public_key, sig_2, sha_sum_1) == skycoin.SKY_ErrInvalidSigForPubKey + assert skycoin.cipher.VerifySignature(public_key, sig_1, sha_sum_2) == skycoin.SKY_ErrPubKeyRecoverMismatch + public_key_2 = skycoin.cipher.PubKey() + skycoin.cipher.GenerateKeyPair(public_key_2, secret_key) + assert skycoin.cipher.VerifySignature(public_key_2, sig_1, sha_sum_1) == skycoin.SKY_ErrPubKeyRecoverMismatch + public_key_3 = skycoin.cipher.PubKey() + assert skycoin.cipher.VerifySignature(public_key_3, sig_1, sha_sum_1) == skycoin.SKY_ErrPubKeyRecoverMismatch def test_TestGenerateKeyPair(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - assert skycoin.SKY_cipher_PubKey_Verify(public_key) == skycoin.SKY_OK - assert skycoin.SKY_cipher_SecKey_Verify(secret_key) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + err = skycoin.cipher.PubKeyVerify(public_key) + assert err == skycoin.SKY_OK + err = skycoin.cipher.SecKeyVerify(secret_key) + assert err == skycoin.SKY_OK def test_TestGenerateDeterministicKeyPair(): # deterministic key pairs are useless as is because we can't # generate pair n+1, only pair 0 - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - _, seed = skycoin.SKY_cipher_RandByte(32) - skycoin.SKY_cipher_GenerateDeterministicKeyPair(seed, public_key, secret_key) - assert skycoin.SKY_cipher_PubKey_Verify(public_key) == skycoin.SKY_OK - assert skycoin.SKY_cipher_SecKey_Verify(secret_key) == skycoin.SKY_OK - skycoin.SKY_cipher_GenerateDeterministicKeyPair(seed, public_key, secret_key) - assert skycoin.SKY_cipher_PubKey_Verify(public_key) == skycoin.SKY_OK - assert skycoin.SKY_cipher_SecKey_Verify(secret_key) == skycoin.SKY_OK + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + _, seed = skycoin.cipher.RandByte(32) + skycoin.cipher.GenerateDeterministicKeyPair(seed, public_key, secret_key) + err = skycoin.cipher.PubKeyVerify(public_key) + assert err == skycoin.SKY_OK + err = skycoin.cipher.SecKeyVerify(secret_key) + assert err == skycoin.SKY_OK + skycoin.cipher.GenerateDeterministicKeyPair(seed, public_key, secret_key) + err = skycoin.cipher.PubKeyVerify(public_key) + assert err == skycoin.SKY_OK + err = skycoin.cipher.SecKeyVerify(secret_key) + assert err == skycoin.SKY_OK def test_TestSecKeTest(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - secret_key_2 = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - assert skycoin.SKY_cipher_TestSecKey(secret_key) == skycoin.SKY_OK - assert skycoin.SKY_cipher_TestSecKey(secret_key_2) == skycoin.SKY_ErrInvalidSecKyVerification + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + secret_key_2 = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + err = skycoin.cipher.TestSecKey(secret_key) + assert err == skycoin.SKY_OK + err = skycoin.cipher.TestSecKey(secret_key_2) + assert err == skycoin.SKY_ErrInvalidSecKyVerification def test_TestSecKeyHashTest(): - public_key = skycoin.cipher_PubKey() - secret_key = skycoin.cipher_SecKey() - secret_key_2 = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(public_key, secret_key) - sha_sum_1 = skycoin.cipher_SHA256() - _, data = skycoin.SKY_cipher_RandByte(256) - skycoin.SKY_cipher_SumSHA256(data, sha_sum_1) - assert skycoin.SKY_cipher_TestSecKeyHash(secret_key, sha_sum_1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_TestSecKeyHash(secret_key_2, sha_sum_1) == skycoin.SKY_ErrInvalidSecKyVerification + public_key = skycoin.cipher.PubKey() + secret_key = skycoin.cipher.SecKey() + secret_key_2 = skycoin.cipher.SecKey() + skycoin.cipher.GenerateKeyPair(public_key, secret_key) + sha_sum_1 = skycoin.cipher.SHA256() + _, data = skycoin.cipher.RandByte(256) + skycoin.cipher.SumSHA256(data, sha_sum_1) + err = skycoin.cipher.TestSecKeyHash(secret_key, sha_sum_1) + assert err == skycoin.SKY_OK + err = skycoin.cipher.TestSecKeyHash(secret_key_2, sha_sum_1) + assert err == skycoin.SKY_ErrInvalidSecKyVerification def test_TestGenerateDeterministicKeyPairsUsesAllBytes(): # Tests that if a seed >128 bits is used, the generator does not ignore bits > 128 seed = b"property diet little foster provide disagree witness mountain alley weekend kitten general" - secret_keys = skycoin.SKY_cipher_GenerateDeterministicKeyPairsSeed(seed, 3)[1:] - secret_keys_2 = skycoin.SKY_cipher_GenerateDeterministicKeyPairsSeed(seed[:16], 3)[1:] + secret_keys = skycoin.cipher.GenerateDeterministicKeyPairsSeed(seed, 3)[1:] + secret_keys_2 = skycoin.cipher.GenerateDeterministicKeyPairsSeed(seed[:16], 3)[1:] assert secret_keys != secret_keys_2 diff --git a/tests/test_cipher_encrypt_sha256xor.py b/tests/test_cipher_encrypt_sha256xor.py index c9ad9300..f1de84f0 100644 --- a/tests/test_cipher_encrypt_sha256xor.py +++ b/tests/test_cipher_encrypt_sha256xor.py @@ -9,51 +9,51 @@ tt = [ [ b"data length=1 password is empty=true", - skycoin.SKY_cipher_RandByte(1)[1], + skycoin.cipher.RandByte(1)[1], b"", skycoin.SKY_ErrSHA256orMissingPassword, ], [ b"data length=1 password is empty=false", - skycoin.SKY_cipher_RandByte(1)[1], + skycoin.cipher.RandByte(1)[1], b"key", skycoin.SKY_OK, ], [ b"data length<32 password is empty=false", - skycoin.SKY_cipher_RandByte(2)[1], + skycoin.cipher.RandByte(2)[1], b"pwd", skycoin.SKY_OK, ], [ b"data length=32 password is empty=false", - skycoin.SKY_cipher_RandByte(32)[1], + skycoin.cipher.RandByte(32)[1], b"pwd", skycoin.SKY_OK, ], [ b"data length=2*32 password is empty=false", - skycoin.SKY_cipher_RandByte(64)[1], + skycoin.cipher.RandByte(64)[1], b"9JMkCPphe73NQvGhmab", skycoin.SKY_OK, ], [ b"data length>2*32 password is empty=false", - skycoin.SKY_cipher_RandByte(65)[1], + skycoin.cipher.RandByte(65)[1], b"9JMkCPphe73NQvGhmab", skycoin.SKY_OK, ], ] def makeEncryptedData(data, dataLength = 32 ): - err, encrypted = skycoin.SKY_encrypt_Sha256Xor_Encrypt(data, b"pwd") - assert err == skycoin.SKY_OK - encrypted += skycoin.SKY_cipher_RandByte(dataLength)[1] - return encrypted + err, encrypted = skycoin.encrypt.Sha256XorEncrypt(data, b"pwd") + assert err == skycoin.SKY_OK + encrypted += skycoin.cipher.RandByte(dataLength)[1] + return encrypted def test_TestEncrypt(): for t in tt: - err, encrypted = skycoin.SKY_encrypt_Sha256Xor_Encrypt(t[1], t[2]) + err, encrypted = skycoin.encrypt.Sha256XorEncrypt(t[1], t[2]) assert err == t[3] if t[3] == skycoin.SKY_ErrSHA256orMissingPassword: continue @@ -68,15 +68,15 @@ def test_TestEncrypt(): totalEncryptedDataLen = sha256XorBlockSize + sha256XorNonceSize + 32 + n * sha256XorBlockSize assert len(rdata) == totalEncryptedDataLen checksum = rdata[:sha256XorChecksumSize] - sha_sum = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(rdata[sha256XorChecksumSize:], sha_sum) + sha_sum = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(rdata[sha256XorChecksumSize:], sha_sum) assert sha_sum.toStr() == checksum pwd = b"pwd" for i in range(33, 64): - err, data = skycoin.SKY_cipher_RandByte(i) + err, data = skycoin.cipher.RandByte(i) assert err == skycoin.SKY_OK - err, encrypted = skycoin.SKY_encrypt_Sha256Xor_Encrypt(data, pwd) + err, encrypted = skycoin.encrypt.Sha256XorEncrypt(data, pwd) assert err == skycoin.SKY_OK n = (sha256XorDataLengthSize + len(data)) // sha256XorBlockSize @@ -89,15 +89,15 @@ def test_TestEncrypt(): totalEncryptedDataLen = sha256XorBlockSize + sha256XorNonceSize + 32 + n * sha256XorBlockSize assert len(rdata) == totalEncryptedDataLen checksum = rdata[:sha256XorChecksumSize] - sha_sum = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(rdata[sha256XorChecksumSize:], sha_sum) + sha_sum = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(rdata[sha256XorChecksumSize:], sha_sum) assert sha_sum.toStr() == checksum def test_TestDecrypt(): - err, data = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK + err, data = skycoin.cipher.RandByte(32) + assert err == skycoin.SKY_OK - tt2 = [ + tt2 = [ [ b"invalid data length", makeEncryptedData(data, 65), @@ -117,22 +117,20 @@ def test_TestDecrypt(): skycoin.SKY_ERROR, ], ] - for t in tt2: - err, decrypted = skycoin.SKY_encrypt_Sha256Xor_Decrypt(t[1], t[2]) - assert err == t[3] - if err != skycoin.SKY_OK: - continue - assert data == decrypted - - for i in range(64): - err, data = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - assert len(data) == 32 - pwd = b"pwd" - err, encrypted = skycoin.SKY_encrypt_Sha256Xor_Encrypt( - data, pwd) - assert err == skycoin.SKY_OK - err, decrypted = skycoin.SKY_encrypt_Sha256Xor_Decrypt( - encrypted, pwd) - assert err == skycoin.SKY_OK - assert data == decrypted + for t in tt2: + err, decrypted = skycoin.encrypt.Sha256XorDecrypt(t[1], t[2]) + assert err == t[3] + if err != skycoin.SKY_OK: + continue + assert data == decrypted + + for _ in range(64): + err, data = skycoin.cipher.RandByte(32) + assert err == skycoin.SKY_OK + assert len(data) == 32 + pwd = b"pwd" + err, encrypted = skycoin.encrypt.Sha256XorEncrypt(data, pwd) + assert err == skycoin.SKY_OK + err, decrypted = skycoin.encrypt.Sha256XorDecrypt(encrypted, pwd) + assert err == skycoin.SKY_OK + assert data == decrypted diff --git a/tests/test_cipher_field.py b/tests/test_cipher_field.py index 3ae8c89c..d9915b41 100644 --- a/tests/test_cipher_field.py +++ b/tests/test_cipher_field.py @@ -1,15 +1,18 @@ import skycoin -import tests.utils def test_TestFeInv(): - in_ = out_ = exp = skycoin.secp256k1go__Field() + in_ = out_ = exp = skycoin.secp256k1go.Field() in_hex = b"813925AF112AAB8243F8CCBADE4CC7F63DF387263028DE6E679232A73A7F3C31" exp_hex = b"7F586430EA30F914965770F6098E492699C62EE1DF6CAFFA77681C179FDF3117" - assert skycoin.SKY_secp256k1go_Field_SetHex(in_, in_hex) == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_SetHex(exp, exp_hex) == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_Inv(in_, out_) == skycoin.SKY_OK + err = skycoin.secp256k1go.FieldSetHex(in_, in_hex) + assert err == skycoin.SKY_OK + err = skycoin.secp256k1go.FieldSetHex(exp, exp_hex) + assert err == skycoin.SKY_OK + err = skycoin.secp256k1go.FieldInv(in_, out_) + assert err == skycoin.SKY_OK assert out_ == exp - assert skycoin.SKY_secp256k1go_Field_Equals(out_,exp)[1] and True + err = skycoin.secp256k1go.FieldEquals(out_,exp)[1] + assert err and True diff --git a/tests/test_cipher_hash.py b/tests/test_cipher_hash.py index 9b8e8920..2eae975e 100644 --- a/tests/test_cipher_hash.py +++ b/tests/test_cipher_hash.py @@ -1,79 +1,87 @@ import skycoin -import tests.utils -import base64 def freshSumRipemd160(b): - rp160 = skycoin.cipher_Ripemd160() - skycoin.SKY_cipher_HashRipemd160(b, rp160) + rp160 = skycoin.cipher.Ripemd160() + skycoin.cipher.HashRipemd160(b, rp160) return rp160 def freshSumSHA256(b): - sha256 = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(b, sha256) + sha256 = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(b, sha256) return sha256 def test_TestHashRipemd160(): - r160 = skycoin.cipher_Ripemd160() - _, b = skycoin.SKY_cipher_RandByte(128) - assert skycoin.SKY_cipher_HashRipemd160(b, r160) == skycoin.SKY_OK - _, b = skycoin.SKY_cipher_RandByte(160) - r = skycoin.cipher_Ripemd160() - skycoin.SKY_cipher_HashRipemd160(b, r) - assert r != skycoin.cipher_Ripemd160() - - _, b = skycoin.SKY_cipher_RandByte(256) - r2 = skycoin.cipher_Ripemd160() - skycoin.SKY_cipher_HashRipemd160(b, r2) - assert r2 != skycoin.cipher_Ripemd160() + r160 = skycoin.cipher.Ripemd160() + _, b = skycoin.cipher.RandByte(128) + assert skycoin.cipher.HashRipemd160(b, r160) == skycoin.SKY_OK + _, b = skycoin.cipher.RandByte(160) + r = skycoin.cipher.Ripemd160() + skycoin.cipher.HashRipemd160(b, r) + assert r != skycoin.cipher.Ripemd160() + + _, b = skycoin.cipher.RandByte(256) + r2 = skycoin.cipher.Ripemd160() + skycoin.cipher.HashRipemd160(b, r2) + assert r2 != skycoin.cipher.Ripemd160() assert r2 == freshSumRipemd160(b) def test_TestRipemd160Set(): - h = skycoin.cipher_Ripemd160() - _, b = skycoin.SKY_cipher_RandByte(21) - assert skycoin.SKY_cipher_Ripemd160_Set(h, b) == skycoin.SKY_ErrInvalidLengthRipemd160 - _, b = skycoin.SKY_cipher_RandByte(100) - assert skycoin.SKY_cipher_Ripemd160_Set(h, b) == skycoin.SKY_ErrInvalidLengthRipemd160 - _, b = skycoin.SKY_cipher_RandByte(19) - assert skycoin.SKY_cipher_Ripemd160_Set(h, b) == skycoin.SKY_ErrInvalidLengthRipemd160 - _, b = skycoin.SKY_cipher_RandByte(0) - assert skycoin.SKY_cipher_Ripemd160_Set(h, b) == skycoin.SKY_ErrInvalidLengthRipemd160 - _, b = skycoin.SKY_cipher_RandByte(20) - assert skycoin.SKY_cipher_Ripemd160_Set(h, b) == skycoin.SKY_OK - _, b1 = skycoin.SKY_cipher_RandByte(20) - skycoin.SKY_cipher_Ripemd160_Set(h, b1) + h = skycoin.cipher.Ripemd160() + _, b = skycoin.cipher.RandByte(21) + err = skycoin.cipher.Ripemd160Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthRipemd160 + _, b = skycoin.cipher.RandByte(100) + err = skycoin.cipher.Ripemd160Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthRipemd160 + _, b = skycoin.cipher.RandByte(19) + err = skycoin.cipher.Ripemd160Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthRipemd160 + _, b = skycoin.cipher.RandByte(0) + err = skycoin.cipher.Ripemd160Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthRipemd160 + _, b = skycoin.cipher.RandByte(20) + err = skycoin.cipher.Ripemd160Set(h, b) + assert err == skycoin.SKY_OK + _, b1 = skycoin.cipher.RandByte(20) + skycoin.cipher.Ripemd160Set(h, b1) assert h.compareToString(str(b)) def test_TestSHA256Set(): - h = skycoin.cipher_SHA256() - _, b = skycoin.SKY_cipher_RandByte(33) - assert skycoin.SKY_cipher_SHA256_Set(h, b) == skycoin.SKY_ErrInvalidLengthSHA256 - _, b = skycoin.SKY_cipher_RandByte(100) - assert skycoin.SKY_cipher_SHA256_Set(h, b) == skycoin.SKY_ErrInvalidLengthSHA256 - _, b = skycoin.SKY_cipher_RandByte(31) - assert skycoin.SKY_cipher_SHA256_Set(h, b) == skycoin.SKY_ErrInvalidLengthSHA256 - _, b = skycoin.SKY_cipher_RandByte(0) - assert skycoin.SKY_cipher_SHA256_Set(h, b) == skycoin.SKY_ErrInvalidLengthSHA256 - _, b = skycoin.SKY_cipher_RandByte(32) - assert skycoin.SKY_cipher_SHA256_Set(h, b) == skycoin.SKY_OK - _, b = skycoin.SKY_cipher_RandByte(32) - skycoin.SKY_cipher_SHA256_Set(h, b) + h = skycoin.cipher.SHA256() + _, b = skycoin.cipher.RandByte(33) + err = skycoin.cipher.SHA256Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthSHA256 + _, b = skycoin.cipher.RandByte(100) + err = skycoin.cipher.SHA256Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthSHA256 + _, b = skycoin.cipher.RandByte(31) + err = skycoin.cipher.SHA256Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthSHA256 + _, b = skycoin.cipher.RandByte(0) + err = skycoin.cipher.SHA256Set(h, b) + assert err == skycoin.SKY_ErrInvalidLengthSHA256 + _, b = skycoin.cipher.RandByte(32) + err = skycoin.cipher.SHA256Set(h, b) + assert err == skycoin.SKY_OK + _, b = skycoin.cipher.RandByte(32) + skycoin.cipher.SHA256Set(h, b) assert h.toStr()[:] == b def test_TestSHA256Hex(): - h = skycoin.cipher_SHA256() - _, b = skycoin.SKY_cipher_RandByte(32) - skycoin.SKY_cipher_SHA256_Set(h, b) - _, s = skycoin.SKY_cipher_SHA256_Hex(h) - h2 = skycoin.cipher_SHA256() - err = skycoin.SKY_cipher_SHA256FromHex(s, h2) + h = skycoin.cipher.SHA256() + _, b = skycoin.cipher.RandByte(32) + skycoin.cipher.SHA256Set(h, b) + _, s = skycoin.cipher.SHA256Hex(h) + h2 = skycoin.cipher.SHA256() + err = skycoin.cipher.SHA256FromHex(s, h2) assert err == skycoin.SKY_OK assert h == h2 - _, s2 = skycoin.SKY_cipher_SHA256_Hex(h2) + _, s2 = skycoin.cipher.SHA256Hex(h2) assert s2 == s @@ -96,165 +104,110 @@ def test_TestSHA256KnownValue(): for v in vals: b = v.inputs - h = skycoin.cipher_SHA256() - err = skycoin.SKY_cipher_SumSHA256(b, h) + h = skycoin.cipher.SHA256() + err = skycoin.cipher.SumSHA256(b, h) assert err == skycoin.SKY_OK - _, h = skycoin.SKY_cipher_SHA256_Hex(h) + _, h = skycoin.cipher.SHA256Hex(h) assert h == v.outputs def test_TestSumSHA256(): - _, b = skycoin.SKY_cipher_RandByte(256) - h1 = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(b, h1) - assert h1 != skycoin.cipher_SHA256() - - _, c = skycoin.SKY_cipher_RandByte(256) - h2 = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(c, h2) - assert h2 != skycoin.cipher_SHA256() + _, b = skycoin.cipher.RandByte(256) + h1 = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(b, h1) + assert h1 != skycoin.cipher.SHA256() + + _, c = skycoin.cipher.RandByte(256) + h2 = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(c, h2) + assert h2 != skycoin.cipher.SHA256() assert h2 == freshSumSHA256(c) def test_TestSHA256FromHex(): # Invalid hex hash - h = skycoin.cipher_SHA256() - err = skycoin.SKY_cipher_SHA256FromHex(b"cawcad", h) + h = skycoin.cipher.SHA256() + err = skycoin.cipher.SHA256FromHex(b"cawcad", h) assert err == skycoin.SKY_ERROR # Truncated hex hash - _, b = skycoin.SKY_cipher_RandByte(128) - h = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(b, h) + _, b = skycoin.cipher.RandByte(128) + h = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(b, h) h_bytes = h.toStr() - h1 = skycoin.cipher_SHA256() - err = skycoin.SKY_cipher_SHA256FromHex(h_bytes[:int(len(h_bytes) / 2)], h1) + h1 = skycoin.cipher.SHA256() + err = skycoin.cipher.SHA256FromHex(h_bytes[:int(len(h_bytes) / 2)], h1) assert err == skycoin.SKY_ERROR # Valid hex hash - h2 = skycoin.cipher_SHA256() - err, b = skycoin.SKY_cipher_SHA256_Hex(h) - err = skycoin.SKY_cipher_SHA256FromHex(b, h2) + h2 = skycoin.cipher.SHA256() + err, b = skycoin.cipher.SHA256Hex(h) + err = skycoin.cipher.SHA256FromHex(b, h2) assert h == h2 assert err == skycoin.SKY_OK def test_TestDoubleSHA256(): - _, b = skycoin.SKY_cipher_RandByte(128) - h = skycoin.cipher_SHA256() - skycoin.SKY_cipher_DoubleSHA256(b, h) - assert h != skycoin.cipher_SHA256() + _, b = skycoin.cipher.RandByte(128) + h = skycoin.cipher.SHA256() + skycoin.cipher.DoubleSHA256(b, h) + assert h != skycoin.cipher.SHA256() assert h != freshSumSHA256(b) def test_TestAddSHA256(): - _, b = skycoin.SKY_cipher_RandByte(128) - h = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(b, h) - _, c = skycoin.SKY_cipher_RandByte(64) - i = skycoin.cipher_SHA256() - skycoin.SKY_cipher_SumSHA256(c, i) - add = skycoin.cipher_SHA256() - err = skycoin.SKY_cipher_AddSHA256(h, i, add) + _, b = skycoin.cipher.RandByte(128) + h = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(b, h) + _, c = skycoin.cipher.RandByte(64) + i = skycoin.cipher.SHA256() + skycoin.cipher.SumSHA256(c, i) + add = skycoin.cipher.SHA256() + err = skycoin.cipher.AddSHA256(h, i, add) assert err == skycoin.SKY_OK - assert add != skycoin.cipher_SHA256() + assert add != skycoin.cipher.SHA256() assert add != h assert add != i def test_TestXorSHA256(): - _, b = skycoin.SKY_cipher_RandByte(128) - _, c = skycoin.SKY_cipher_RandByte(128) - h = skycoin.cipher_SHA256() - i = skycoin.cipher_SHA256() - err = skycoin.SKY_cipher_SumSHA256(b, h) + _, b = skycoin.cipher.RandByte(128) + _, c = skycoin.cipher.RandByte(128) + h = skycoin.cipher.SHA256() + i = skycoin.cipher.SHA256() + err = skycoin.cipher.SumSHA256(b, h) + assert err == skycoin.SKY_OK + err = skycoin.cipher.SumSHA256(c, i) assert err == skycoin.SKY_OK - err = skycoin.SKY_cipher_SumSHA256(c, i) + temp = skycoin.cipher.SHA256() + temp2 = skycoin.cipher.SHA256() + err = skycoin.cipher.SHA256Xor(h, i, temp) + assert err == skycoin.SKY_OK + err = skycoin.cipher.SHA256Xor(i, h, temp2) assert err == skycoin.SKY_OK - temp = skycoin.cipher_SHA256() - temp2 = skycoin.cipher_SHA256() - assert skycoin.SKY_cipher_SHA256_Xor(h, i, temp) == skycoin.SKY_OK - assert skycoin.SKY_cipher_SHA256_Xor(i, h, temp2) == skycoin.SKY_OK assert temp != h assert temp != i - assert temp != skycoin.cipher_SHA256() + assert temp != skycoin.cipher.SHA256() assert temp == temp2 def test_TestSHA256Null(): - x = skycoin.cipher_SHA256() - _, isNull = skycoin.SKY_cipher_SHA256_Null(x) + x = skycoin.cipher.SHA256() + _, isNull = skycoin.cipher.SHA256Null(x) assert isNull - _, b = skycoin.SKY_cipher_RandByte(128) - skycoin.SKY_cipher_SumSHA256(b, x) - _, isNull = skycoin.SKY_cipher_SHA256_Null(x) + _, b = skycoin.cipher.RandByte(128) + skycoin.cipher.SumSHA256(b, x) + _, isNull = skycoin.cipher.SHA256Null(x) assert not isNull def test_TestMerkle(): hashlist = [] - h = skycoin.cipher_SHA256() + h = skycoin.cipher.SHA256() for _ in range(5): hashlist.append(h) for i in range(5): - err, data = skycoin.SKY_cipher_RandByte(128) + err, data = skycoin.cipher.RandByte(128) assert err == skycoin.SKY_OK - err = skycoin.SKY_cipher_SumSHA256(data, hashlist[i]) + err = skycoin.cipher.SumSHA256(data, hashlist[i]) assert err == skycoin.SKY_OK - - # assert skycoin.SKY_cipher_Merkle(hashlist,h) == 45 - - - -# err, data = skycoin.SKY_cipher_RandByte(128) -# assert err == skycoin.SKY_OK -# h = skycoin.cipher_SHA256() -# err = skycoin.SKY_cipher_SumSHA256(data, h) -# assert err == skycoin.SKY_OK -# Single hash input returns hash -# a = [x for x in h] -# assert skycoin.SKY_cipher_Merkle(a,h) == 45 -# DoubleSHA256 double SHA256 -# func DoubleSHA256(b []byte) SHA256 { -# h1 := SumSHA256(b) -# h2 := SumSHA256(h1[:]) -# return h2 -# } - -# // AddSHA256 returns the SHA256 hash of to two concatenated hashes -# func AddSHA256(a SHA256, b SHA256) SHA256 { -# c := append(a[:], b[:]...) -# return SumSHA256(c) -# } - -# // Returns the next highest power of 2 above n, if n is not already a -# // power of 2 -# func nextPowerOfTwo(n uint64) uint64 { -# var k uint64 = 1 -# for k < n { -# k *= 2 -# } -# return k -# } - -# // Merkle computes the merkle root of a hash array -# // Array of hashes is padded with 0 hashes until next power of 2 -# func Merkle(h0 []SHA256) SHA256 { -# lh := uint64(len(h0)) -# np := nextPowerOfTwo(lh) -# h1 := append(h0, make([]SHA256, np-lh)...) -# for len(h1) != 1 { -# h2 := make([]SHA256, len(h1)/2) -# for i := 0; i < len(h2); i++ { -# h2[i] = AddSHA256(h1[2*i], h1[2*i+1]) -# } -# h1 = h2 -# } -# return h1[0] -# } - -# def merkle(h0): -# lh = base64.standard_b64decode(len(h0)) -# np = - -# def nextPowerOfTwo(): diff --git a/tests/test_cipher_scrypt.py b/tests/test_cipher_scrypt.py index f5982f73..7d931c18 100644 --- a/tests/test_cipher_scrypt.py +++ b/tests/test_cipher_scrypt.py @@ -1,5 +1,4 @@ import skycoin -import tests.utils # Vector: [0] -> password,[1] -> salt, [2] -> N, [3] -> r, [4] -> p, [5] -> out_put @@ -96,12 +95,12 @@ def test_TestKey(): for v in good: - err, key =skycoin.SKY_scrypt_Key(v[0], v[1], v[2], v[3], v[4], len(v[5])) + err, key = skycoin.scrypt.Key(v[0], v[1], v[2], v[3], v[4], len(v[5])) assert err == skycoin.SKY_OK assert key != str(v[5]).encode("utf-8") for v in bad: - assert skycoin.SKY_scrypt_Key(v[0], v[1], v[2], v[3], v[4], len(v[5]))[0] != 0 + assert skycoin.scrypt.Key(v[0], v[1], v[2], v[3], v[4], len(v[5]))[0] != 0 def test_BenchmarkKey(): - assert skycoin.SKY_scrypt_Key(b"password", b"salt", 16384, 8, 1, 64)[0] == 0 + assert skycoin.scrypt.Key(b"password", b"salt", 16384, 8, 1, 64)[0] == 0 \ No newline at end of file diff --git a/tests/test_cipher_scrypt_chacha20poly1305_test.py b/tests/test_cipher_scrypt_chacha20poly1305_test.py index 9c6fdfdb..e2d5af78 100644 --- a/tests/test_cipher_scrypt_chacha20poly1305_test.py +++ b/tests/test_cipher_scrypt_chacha20poly1305_test.py @@ -1,7 +1,6 @@ import skycoin import json import base64 -import tests.utils define = { "PLAINTEXT" : b"plaintext", @@ -12,12 +11,12 @@ def test_TestScryptChacha20poly1305Encrypt(): for i in range(20)[1:]: - crypto = skycoin.encrypt__ScryptChacha20poly1305() + crypto = skycoin.encrypt.ScryptChacha20poly1305() crypto.R = 8 crypto.P = 1 crypto.KeyLen = 32 crypto.N = 1 << i - _, encData = skycoin.SKY_encrypt_ScryptChacha20poly1305_Encrypt(crypto, define["PLAINTEXT"], define["PASSWORD"]) + _, encData = skycoin.encrypt.ScryptChacha20poly1305Encrypt(crypto, define["PLAINTEXT"], define["PASSWORD"]) assert _ == skycoin.SKY_OK Data = base64.standard_b64decode(encData) ml_ = [x for x in Data] @@ -42,17 +41,17 @@ def test_TestScryptChacha20poly1305Decrypt(): encrypto = b"dQB7Im4iOjUyNDI4OCwiciI6OCwicCI6MSwia2V5TGVuIjozMiwic2FsdCI6ImpiejUrSFNjTFFLWkI5T0tYblNNRmt2WDBPY3JxVGZ0ZFpDNm9KUFpaeHc9Iiwibm9uY2UiOiJLTlhOQmRQa1ZUWHZYNHdoIn3PQFmOot0ETxTuv//skTG7Q57UVamGCgG5" password = b"pwd" invalid_passwd = b"wrong password" - crypto = skycoin.encrypt__ScryptChacha20poly1305() + crypto = skycoin.encrypt.ScryptChacha20poly1305() crypto.R = 8 crypto.P = 1 crypto.KeyLen = 32 crypto.N = 1 << 19 - err, decrypted = skycoin.SKY_encrypt_ScryptChacha20poly1305_Decrypt(crypto, encrypto, password) + err, decrypted = skycoin.encrypt.ScryptChacha20poly1305Decrypt(crypto, encrypto, password) assert err == skycoin.SKY_OK and decrypted == define["PLAINTEXT"] # Wrong Password - err, decrypted = skycoin.SKY_encrypt_ScryptChacha20poly1305_Decrypt(crypto, encrypto, invalid_passwd) + err, decrypted = skycoin.encrypt.ScryptChacha20poly1305Decrypt(crypto, encrypto, invalid_passwd) assert err == skycoin.SKY_ERROR # Missing Password - err, decrypted = skycoin.SKY_encrypt_ScryptChacha20poly1305_Decrypt(crypto, encrypto, b"") + err, decrypted = skycoin.encrypt.ScryptChacha20poly1305Decrypt(crypto, encrypto, b"") assert err == skycoin.SKY_ERROR diff --git a/tests/test_cipher_secp256k1_secp256.py b/tests/test_cipher_secp256k1_secp256.py deleted file mode 100644 index b3f1d94a..00000000 --- a/tests/test_cipher_secp256k1_secp256.py +++ /dev/null @@ -1,409 +0,0 @@ -import skycoin -import operator -import random - -TESTS = 1 - - -def test_Test_Secp256_00(): - err , nonce = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - assert len(nonce) == 32 - - -def test_Test_Secp256_01(): - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - assert skycoin.SKY_cipher_GenerateKeyPair(pubkey, seckey) == skycoin.SKY_OK - assert skycoin.SKY_cipher_PubKey_Verify(pubkey) == skycoin.SKY_OK - assert skycoin.SKY_cipher_SecKey_Verify(seckey) == skycoin.SKY_OK - - -def test_Test_PubkeyFromSeckey(): - _, privkey = skycoin.SKY_base58_String2Hex(b"f19c523315891e6e15ae0608a35eec2e00ebd6d1984cf167f46336dabd9b2de4") - _, desiredPubKey = skycoin.SKY_base58_String2Hex(b"04fe43d0c2c3daab30f9472beb5b767be020b81c7cc940ed7a7e910f0c1d9feef10fe85eb3ce193405c2dd8453b7aeb6c1752361efdbf4f52ea8bf8f304aab37ab") - - err, pubkey = skycoin.SKY_secp256k1_UncompressedPubkeyFromSeckey(privkey) - assert err == skycoin.SKY_OK - assert pubkey != None - assert pubkey == desiredPubKey - - -def RandX(): - err, pubkey, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - err, msg = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - err, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) - assert err == skycoin.SKY_OK - return pubkey, seckey, msg, sig - - -def test_Test_SignatureVerifyPubkey(): - err, pubkey1, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - err, msg = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - err, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) - assert err == skycoin.SKY_OK - err, value = skycoin.SKY_secp256k1_VerifyPubkey(pubkey1) - assert err == skycoin.SKY_OK - assert value != 0 - err , pubkey2 = skycoin.SKY_secp256k1_RecoverPubkey(msg, sig) - assert pubkey1 == pubkey2 - - -def test_Test_verify_functions(): - pubkey, seckey, hashs, sig = RandX() - err, value = skycoin.SKY_secp256k1_VerifySeckey(seckey) - assert err == skycoin.SKY_OK - assert value != 0 - err, value = skycoin.SKY_secp256k1_VerifyPubkey(pubkey) - assert err == skycoin.SKY_OK - assert value != 0 - err, value = skycoin.SKY_secp256k1_VerifySignature(hashs, sig, pubkey) - assert err == skycoin.SKY_OK - assert value != 0 - _ = sig - - -def test_Test_SignatureVerifySecKey(): - err , pubkey, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - err, value = skycoin.SKY_secp256k1_VerifySeckey(seckey) - assert err == skycoin.SKY_OK - assert value != 0 - err, value = skycoin.SKY_secp256k1_VerifyPubkey(pubkey) - assert err == skycoin.SKY_OK - assert value != 0 - - -def test_Test_Secp256_02s(): - err , pubkey, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - err, msg = skycoin.SKY_secp256k1_RandByte(32) - assert err == skycoin.SKY_OK - err, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) - assert err == skycoin.SKY_OK - assert sig != None - assert len(pubkey) == 33 - assert len(seckey) == 32 - assert len(sig) == (64 + 1) - assert bytes(sig[64]) < bytes(4) - - -def test_Test_Secp256_02(): - err, pubkey, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - err, msg = skycoin.SKY_secp256k1_RandByte(32) - assert err == skycoin.SKY_OK - err, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) - assert err == skycoin.SKY_OK - assert sig != None - err, pubkey2 = skycoin.SKY_secp256k1_RecoverPubkey(msg, sig) - assert err == skycoin.SKY_OK - assert pubkey2 != None - assert pubkey == pubkey2 - err, value = skycoin.SKY_secp256k1_VerifySignature(msg, sig, pubkey) - assert err == skycoin.SKY_OK - assert value == 1 - - -def test_Test_Secp256_02a(): - err, pubkey1, seckey1 = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - err , msg = skycoin.SKY_secp256k1_RandByte(32) - assert err == skycoin.SKY_OK - err, sig = skycoin.SKY_secp256k1_Sign(msg, seckey1) - assert err == skycoin.SKY_OK - assert sig != None - err, value = skycoin.SKY_secp256k1_VerifySignature(msg, sig, pubkey1) - assert err == skycoin.SKY_OK - assert value == 1 - err, pubkey2 = skycoin.SKY_secp256k1_RecoverPubkey(msg, sig) - assert err == skycoin.SKY_OK - assert len(pubkey1) == len(pubkey2) - for i in range(len(pubkey1)): - assert pubkey1[i] == pubkey2[i] - assert pubkey1 == pubkey2 - - -def test_Test_Secp256_03(): - err , _, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - for i in range(TESTS): - _, msg = skycoin.SKY_secp256k1_RandByte(32) - _, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) - err , pubkey2 = skycoin.SKY_secp256k1_RecoverPubkey(msg, sig) - assert err == skycoin.SKY_OK - assert pubkey2 != None - - -def test_Test_Secp256_04(): - for i in range(TESTS): - err, pubkey, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - _, msg = skycoin.SKY_secp256k1_RandByte(32) - _, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) - last = sig[len(sig) - 1] - assert operator.ge(bytes(last), bytes(4)) == False - err , pubkey2 = skycoin.SKY_secp256k1_RecoverPubkey(msg, sig) - assert err == skycoin.SKY_OK - assert pubkey2 != None - assert pubkey == pubkey2 - -# def randSig(): -# err, sig = skycoin.SKY_secp256k1_RandByte(65) -# assert err == skycoin.SKY_OK -# assert len(sig) == 65 -# operator.and_(sig[32], str(0x70)) -# sig[64] %= 4 -# return sig - -# def test_Test_Secp256_06a_alt0(): -# err, pubkey, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() -# assert err == skycoin.SKY_OK -# _, msg = skycoin.SKY_secp256k1_RandByte(32) -# err, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) -# assert err == skycoin.SKY_OK -# assert sig != None -# assert len(sig) == 65 -# for i in range(TESTS): -# sig = randSig() -# err, pubkey2 = skycoin.SKY_secp256k1_RecoverPubkey(msg, sig) -# assert pubkey != pubkey2 -# err, value = skycoin.SKY_secp256k1_VerifySignature(msg, sig, pubkey2) -# assert err == skycoin.SKY_OK -# assert pubkey2 == None , value == 1 -# err. value = skycoin.SKY_secp256k1_VerifySignature(msg, sig, pubkey) -# assert err == skycoin.SKY_OK -# assert value != 1 - - -def test_Test_Secp256_06b(): - err, pubkey1, seckey = skycoin.SKY_secp256k1_GenerateKeyPair() - assert err == skycoin.SKY_OK - _, msg = skycoin.SKY_secp256k1_RandByte(32) - _, sig = skycoin.SKY_secp256k1_Sign(msg, seckey) - failCount = 0 - for i in range(TESTS): - _, msg = skycoin.SKY_secp256k1_RandByte(32) - err, pubkey2 = skycoin.SKY_secp256k1_RecoverPubkey(msg, sig) - assert err == skycoin.SKY_OK - assert pubkey1 != pubkey2 - err, value = skycoin.SKY_secp256k1_VerifySignature(msg, sig, pubkey2) - assert err == skycoin.SKY_OK - assert value == 1 - err, value = skycoin.SKY_secp256k1_VerifySignature(msg, sig, pubkey1) - assert err == skycoin.SKY_OK - assert value != 1 - - -def test_Test_Deterministic_Keypairs_00(): - for i in range(64): - _, seed = skycoin.SKY_secp256k1_RandByte(64) - err, _, pub1, sec1 = skycoin.SKY_secp256k1_DeterministicKeyPairIterator(seed) - assert err == skycoin.SKY_OK - err, pub2, sec2 = skycoin.SKY_secp256k1_GenerateDeterministicKeyPair(seed) - assert err == skycoin.SKY_OK - assert pub1 == pub2 - assert sec1 == sec2 - - -def test_Test_Deterministic_Keypairs_01(): - for i in range(64): - _, seed = skycoin.SKY_secp256k1_RandByte(32) - err, _, pub1, sec1 = skycoin.SKY_secp256k1_DeterministicKeyPairIterator(seed) - assert err == skycoin.SKY_OK - err, pub2, sec2 = skycoin.SKY_secp256k1_GenerateDeterministicKeyPair(seed) - assert err == skycoin.SKY_OK - assert pub1 == pub2 - assert sec1 == sec2 - - -def test_Test_Deterministic_Keypairs_02(): - for i in range(64): - _, seed = skycoin.SKY_secp256k1_RandByte(32) - err, _, pub1, sec1 = skycoin.SKY_secp256k1_DeterministicKeyPairIterator(seed) - assert err == skycoin.SKY_OK - err, pub2, sec2 = skycoin.SKY_secp256k1_GenerateDeterministicKeyPair(seed) - assert err == skycoin.SKY_OK - assert pub1 == pub2 - assert sec1 == sec2 - - -def Decode(str1): - err, byt = skycoin.SKY_base58_String2Hex(str1) - assert err == skycoin.SKY_OK - return byt - - -def test_Test_Deterministic_Keypairs_03(): - testArray = [ - b"tQ93w5Aqcunm9SGUfnmF4fJv", b"9b8c3e36adce64dedc80d6dfe51ff1742cc1d755bbad457ac01177c5a18a789f", - b"DC7qdQQtbWSSaekXnFmvQgse", b"d2deaf4a9ff7a5111fe1d429d6976cbde78811fdd075371a2a4449bb0f4d8bf9", - b"X8EkuUZC7Td7PAXeS7Duc7vR", b"cad79b6dcf7bd21891cbe20a51c57d59689ae6e3dc482cd6ec22898ac00cd86b", - b"tVqPYHHNVPRWyEed62v7f23u", b"2a386e94e9ffaa409517cbed81b9b2d4e1c5fb4afe3cbd67ce8aba11af0b02fa", - b"kCy4R57HDfLqF3pVhBWxuMcg", b"26a7c6d8809c476a56f7455209f58b5ff3f16435fcf208ff2931ece60067f305", - b"j8bjv86ZNjKqzafR6mtSUVCE", b"ea5c0f8c9f091a70bf38327adb9b2428a9293e7a7a75119920d759ecfa03a995", - b"qShryAzVY8EtsuD3dsAc7qnG", b"331206176509bcae31c881dc51e90a4e82ec33cd7208a5fb4171ed56602017fa", - b"5FGG7ZBa8wVMBJkmzpXj5ESX", b"4ea2ad82e7730d30c0c21d01a328485a0cf5543e095139ba613929be7739b52c", - b"f46TZG4xJHXUGWx8ekbNqa9F", b"dcddd403d3534c4ef5703cc07a771c107ed49b7e0643c6a2985a96149db26108", - b"XkZdQJ5LT96wshN8JBH8rvEt", b"3e276219081f072dff5400ca29a9346421eaaf3c419ff1474ac1c81ad8a9d6e1", - b"GFDqXU4zYymhJJ9UGqRgS8ty", b"95be4163085b571e725edeffa83fff8e7a7db3c1ccab19d0f3c6e105859b5e10", - b"tmwZksH2XyvuamnddYxyJ5Lp", b"2666dd54e469df56c02e82dffb4d3ea067daafe72c54dc2b4f08c4fb3a7b7e42", - b"EuqZFsbAV5amTzkhgAMgjr7W", b"40c325c01f2e4087fcc97fcdbea6c35c88a12259ebf1bce0b14a4d77f075abbf", - b"TW6j8rMffZfmhyDEt2JUCrLB", b"e676e0685c5d1afd43ad823b83db5c6100135c35485146276ee0b0004bd6689e", - b"8rvkBnygfhWP8kjX9aXq68CY", b"21450a646eed0d4aa50a1736e6c9bf99fff006a470aab813a2eff3ee4d460ae4", - b"phyRfPDuf9JMRFaWdGh7NXPX", b"ca7bc04196c504d0e815e125f7f1e086c8ae8c10d5e9df984aeab4b41bf9e398", - ] - - for i in range(int(len(testArray) / 2)): - seed = bytes(testArray[2 * i + 0]) - sec1 = Decode(testArray[2 * i + 1]) - err, _, sec2 = skycoin.SKY_secp256k1_GenerateDeterministicKeyPair(seed) - assert err == skycoin.SKY_OK - assert sec2 == sec1 - - -def test_Test_DeterministicWallets1(): - testArray = [ - b"90c56f5b8d78a46fb4cddf6fd9c6d88d6d2d7b0ec35917c7dac12c03b04e444e", b"94dd1a9de9ffd57b5516b8a7f090da67f142f7d22356fa5d1b894ee4d4fba95b", - b"a3b08ccf8cbae4955c02f223be1f97d2bb41d92b7f0c516eb8467a17da1e6057", b"82fba4cc2bc29eef122f116f45d01d82ff488d7ee713f8a95c162a64097239e0", - b"7048eb8fa93cec992b93dc8e93c5543be34aad05239d4c036cf9e587bbcf7654", b"44c059496aac871ac168bb6889b9dd3decdb9e1fa082442a95fcbca982643425", - b"6d25375591bbfce7f601fc5eb40e4f3dde2e453dc4bf31595d8ec29e4370cd80", b"d709ceb1a6fb906de506ea091c844ca37c65e52778b8d257d1dd3a942ab367fb", - b"7214b4c09f584c5ddff971d469df130b9a3c03e0277e92be159279de39462120", b"5fe4986fa964773041e119d2b6549acb392b2277a72232af75cbfb62c357c1a7", - b"b13e78392d5446ae304b5fc9d45b85f26996982b2c0c86138afdac8d2ea9016e", b"f784abc2e7f11ee84b4adb72ea4730a6aabe27b09604c8e2b792d8a1a31881ac", - b"9403bff4240a5999e17e0ab4a645d6942c3a7147c7834e092e461a4580249e6e", b"d495174b8d3f875226b9b939121ec53f9383bd560d34aa5ca3ac6b257512adf4", - b"2665312a3e3628f4df0b9bc6334f530608a9bcdd4d1eef174ecda99f51a6db94", b"1fdc9fbfc6991b9416b3a8385c9942e2db59009aeb2d8de349b73d9f1d389374", - b"6cb37532c80765b7c07698502a49d69351036f57a45a5143e33c57c236d841ca", b"c87c85a6f482964db7f8c31720981925b1e357a9fdfcc585bc2164fdef1f54d0", - b"8654a32fa120bfdb7ca02c487469070eba4b5a81b03763a2185fdf5afd756f3c", b"e2767d788d1c5620f3ef21d57f2d64559ab203c044f0a5f0730b21984e77019c", - b"66d1945ceb6ef8014b1b6703cb624f058913e722f15d03225be27cb9d8aabe4a", b"3fcb80eb1d5b91c491408447ac4e221fcb2254c861adbb5a178337c2750b0846", - b"22c7623bf0e850538329e3e6d9a6f9b1235350824a3feaad2580b7a853550deb", b"5577d4be25f1b44487140a626c8aeca2a77507a1fc4fd466dd3a82234abb6785", - b"a5eebe3469d68c8922a1a8b5a0a2b55293b7ff424240c16feb9f51727f734516", b"c07275582d0681eb07c7b51f0bca0c48c056d571b7b83d84980ab40ac7d7d720", - b"479ec3b589b14aa7290b48c2e64072e4e5b15ce395d2072a5a18b0a2cf35f3fd", b"f10e2b7675dfa557d9e3188469f12d3e953c2d46dce006cd177b6ae7f465cfc0", - b"63952334b731ec91d88c54614925576f82e3610d009657368fc866e7b1efbe73", b"0bcbebb39d8fe1cb3eab952c6f701656c234e462b945e2f7d4be2c80b8f2d974", - b"256472ee754ef6af096340ab1e161f58e85fb0cc7ae6e6866b9359a1657fa6c1", b"88ba6f6c66fc0ef01c938569c2dd1f05475cb56444f4582d06828e77d54ffbe6", - ] - for i in range(int(len(testArray) / 2)): - seed = Decode(testArray[2 * i + 0]) - seckey1 = Decode(testArray[2 * i + 1]) - err, _, _, seckey2 = skycoin.SKY_secp256k1_DeterministicKeyPairIterator(seed) - assert err == skycoin.SKY_OK - assert seckey2 == seckey1 - - -def test_Test_Secp256k1_Hash(): - testArray = [ - b"90c56f5b8d78a46fb4cddf6fd9c6d88d6d2d7b0ec35917c7dac12c03b04e444e", b"a70c36286be722d8111e69e910ce4490005bbf9135b0ce8e7a59f84eee24b88b", - b"a3b08ccf8cbae4955c02f223be1f97d2bb41d92b7f0c516eb8467a17da1e6057", b"e9db072fe5817325504174253a056be7b53b512f1e588f576f1f5a82cdcad302", - b"7048eb8fa93cec992b93dc8e93c5543be34aad05239d4c036cf9e587bbcf7654", b"5e9133e83c4add2b0420d485e1dcda5c00e283c6509388ab8ceb583b0485c13b", - b"6d25375591bbfce7f601fc5eb40e4f3dde2e453dc4bf31595d8ec29e4370cd80", b"8d5579cd702c06c40fb98e1d55121ea0d29f3a6c42f5582b902ac243f29b571a", - b"7214b4c09f584c5ddff971d469df130b9a3c03e0277e92be159279de39462120", b"3a4e8c72921099a0e6a4e7f979df4c8bced63063097835cdfd5ee94548c9c41a", - b"b13e78392d5446ae304b5fc9d45b85f26996982b2c0c86138afdac8d2ea9016e", b"462efa1bf4f639ffaedb170d6fb8ba363efcb1bdf0c5aef0c75afb59806b8053", - b"9403bff4240a5999e17e0ab4a645d6942c3a7147c7834e092e461a4580249e6e", b"68dd702ea7c7352632876e9dc2333142fce857a542726e402bb480cad364f260", - b"2665312a3e3628f4df0b9bc6334f530608a9bcdd4d1eef174ecda99f51a6db94", b"5db72c31d575c332e60f890c7e68d59bd3d0ac53a832e06e821d819476e1f010", - b"6cb37532c80765b7c07698502a49d69351036f57a45a5143e33c57c236d841ca", b"0deb20ec503b4c678213979fd98018c56f24e9c1ec99af3cd84b43c161a9bb5c", - b"8654a32fa120bfdb7ca02c487469070eba4b5a81b03763a2185fdf5afd756f3c", b"36f3ede761aa683813013ffa84e3738b870ce7605e0a958ed4ffb540cd3ea504", - b"66d1945ceb6ef8014b1b6703cb624f058913e722f15d03225be27cb9d8aabe4a", b"6bcb4819a96508efa7e32ee52b0227ccf5fbe5539687aae931677b24f6d0bbbd", - b"22c7623bf0e850538329e3e6d9a6f9b1235350824a3feaad2580b7a853550deb", b"8bb257a1a17fd2233935b33441d216551d5ff1553d02e4013e03f14962615c16", - b"a5eebe3469d68c8922a1a8b5a0a2b55293b7ff424240c16feb9f51727f734516", b"d6b780983a63a3e4bcf643ee68b686421079c835a99eeba6962fe41bb355f8da", - b"479ec3b589b14aa7290b48c2e64072e4e5b15ce395d2072a5a18b0a2cf35f3fd", b"39c5f108e7017e085fe90acfd719420740e57768ac14c94cb020d87e36d06752", - b"63952334b731ec91d88c54614925576f82e3610d009657368fc866e7b1efbe73", b"79f654976732106c0e4a97ab3b6d16f343a05ebfcc2e1d679d69d396e6162a77", - b"256472ee754ef6af096340ab1e161f58e85fb0cc7ae6e6866b9359a1657fa6c1", b"387883b86e2acc153aa334518cea48c0c481b573ccaacf17c575623c392f78b2", - ] - - for i in range(int(len(testArray) / 2)): - hash1 = Decode(testArray[2 * i + 0]) - hash2 = Decode(testArray[2 * i + 1]) - err, hash3 = skycoin.SKY_secp256k1_Secp256k1Hash(hash1) - assert err == skycoin.SKY_OK - assert hash2 == hash3 - - -def test_Test_Secp256k1_Equal(): - for i in range(64): - _, seed = skycoin.SKY_secp256k1_RandByte(128) - err , hash1 = skycoin.SKY_secp256k1_Secp256k1Hash(seed) - assert err == skycoin.SKY_OK - err, hash2, _, _ = skycoin.SKY_secp256k1_DeterministicKeyPairIterator(seed) - assert hash1 == hash2 - - -def test_Test_DeterministicWalletGeneration(): - ins = b"8654a32fa120bfdb7ca02c487469070eba4b5a81b03763a2185fdf5afd756f3c" - secOut = b"10ba0325f1b8633ca463542950b5cd5f97753a9829ba23477c584e7aee9cfbd5" - pubOut = b"0249964ac7e3fe1b2c182a2f10abe031784e374cc0c665a63bc76cc009a05bc7c6" - - seed = bytes(ins) - pubkey = bytes() - seckey = bytes() - - for i in range(1024): - err, seed, pubkey, seckey = skycoin.SKY_secp256k1_DeterministicKeyPairIterator(seed) - assert err == skycoin.SKY_OK - assert seckey == Decode(secOut) - assert pubkey == Decode(pubOut) - - -def test_Test_ECDH(): - _, pubkey1, seckey1 = skycoin.SKY_secp256k1_GenerateKeyPair() - _, pubkey2, seckey2 = skycoin.SKY_secp256k1_GenerateKeyPair() - - err, puba = skycoin.SKY_secp256k1_ECDH(pubkey1, seckey2) - assert err == skycoin.SKY_OK - err, pubb = skycoin.SKY_secp256k1_ECDH(pubkey2, seckey1) - assert err == skycoin.SKY_OK - assert puba != None - assert pubb != None - assert puba == pubb - - -def test_Test_ECDH2(): - for i in range(16 * 1024): - _, pubkey1, seckey1 = skycoin.SKY_secp256k1_GenerateKeyPair() - _, pubkey2, seckey2 = skycoin.SKY_secp256k1_GenerateKeyPair() - err, puba = skycoin.SKY_secp256k1_ECDH(pubkey1, seckey2) - assert err == skycoin.SKY_OK - err, pubb = skycoin.SKY_secp256k1_ECDH(pubkey2, seckey1) - assert err == skycoin.SKY_OK - assert puba != None - assert pubb != None - assert puba == pubb - - -_testSeckey = [ b"08efb79385c9a8b0d1c6f5f6511be0c6f6c2902963d874a3a4bacc18802528d3", b"78298d9ecdc0640c9ae6883201a53f4518055442642024d23c45858f45d0c3e6", b"04e04fe65bfa6ded50a12769a3bd83d7351b2dbff08c9bac14662b23a3294b9e", b"2f5141f1b75747996c5de77c911dae062d16ae48799052c04ead20ccd5afa113"] - - -def test_Test_Abnormal_Keys2(): - for i in range(len(_testSeckey)): - err, seckey1 = skycoin.SKY_base58_String2Hex(_testSeckey[i]) - assert err == skycoin.SKY_OK - err, pubkey1 = skycoin.SKY_secp256k1_PubkeyFromSeckey(seckey1) - assert err == skycoin.SKY_OK - assert pubkey1 != None - assert seckey1 != None - assert pubkey1 != None - err, value = skycoin.SKY_secp256k1_VerifyPubkey(pubkey1) - assert err == skycoin.SKY_OK - assert value == 1 - - -def test_Test_Abnormal_Keys3(): - for i in range(len(_testSeckey)): - err, seckey1 = skycoin.SKY_base58_String2Hex(_testSeckey[i]) - assert err == skycoin.SKY_OK - err, pubkey1 = skycoin.SKY_secp256k1_PubkeyFromSeckey(seckey1) - assert err == skycoin.SKY_OK - err, seckey2 = skycoin.SKY_base58_String2Hex(_testSeckey[random.randint(0, len(_testSeckey) - 1)]) - assert err == skycoin.SKY_OK - err, pubkey2 = skycoin.SKY_secp256k1_PubkeyFromSeckey(seckey2) - assert err == skycoin.SKY_OK - assert pubkey1 != None - assert pubkey2 != None - err, puba = skycoin.SKY_secp256k1_ECDH(pubkey1, seckey2) - assert err == skycoin.SKY_OK - err, pubb = skycoin.SKY_secp256k1_ECDH(pubkey2, seckey1) - assert err == skycoin.SKY_OK - assert puba != None, pubb != None - assert pubb == puba - diff --git a/tests/test_cipher_secp256k1_secp256k1-go2_xyz.py b/tests/test_cipher_secp256k1_secp256k1-go2_xyz.py deleted file mode 100644 index 7d4e75a2..00000000 --- a/tests/test_cipher_secp256k1_secp256k1-go2_xyz.py +++ /dev/null @@ -1,21 +0,0 @@ -import skycoin -import tests.utils - - -def test_TestGejDouble(): - a = skycoin.secp256k1go__XYZ() - aExp = skycoin.secp256k1go__XYZ() - r = skycoin.secp256k1go__XYZ() - assert skycoin.SKY_secp256k1go_Field_SetHex( - a.X, b"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_SetHex( - a.Y, b"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8") == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_SetHex(a.X, b"01") == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_SetHex( - aExp.X, b"7D152C041EA8E1DC2191843D1FA9DB55B68F88FEF695E2C791D40444B365AFC2") == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_SetHex( - aExp.Y, b"56915849F52CC8F76F5FD7E4BF60DB4A43BF633E1B1383F85FE89164BFADCBDB") == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_SetHex( - aExp.Z, b"9075B4EE4D4788CABB49F7F81C221151FA2F68914D0AA833388FA11FF621A970") == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_XYZ_Double(a, r) == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_XYZ_Equals(aExp, a) diff --git a/tests/test_cipher_sig.py b/tests/test_cipher_sig.py deleted file mode 100644 index a388e5bc..00000000 --- a/tests/test_cipher_sig.py +++ /dev/null @@ -1,99 +0,0 @@ -import skycoin -import tests.utils -forceLowS = True - - -def test_TestSigRecover(): - vs = [ - [ - b"6028b9e3a31c9e725fcbd7d5d16736aaaafcc9bf157dfb4be62bcbcf0969d488", - b"036d4a36fa235b8f9f815aa6f5457a607f956a71a035bf0970d8578bf218bb5a", - b"9cff3da1a4f86caf3683f865232c64992b5ed002af42b321b8d8a48420680487", - b"0", - b"56dc5df245955302893d8dda0677cc9865d8011bc678c7803a18b5f6faafec08", - b"54b5fbdcd8fac6468dac2de88fadce6414f5f3afbb103753e25161bef77705a6", - ], - [ - b"b470e02f834a3aaafa27bd2b49e07269e962a51410f364e9e195c31351a05e50", - b"560978aed76de9d5d781f87ed2068832ed545f2b21bf040654a2daff694c8b09", - b"9ce428d58e8e4caf619dc6fc7b2c2c28f0561654d1f80f322c038ad5e67ff8a6", - b"1", - b"15b7e7d00f024bffcd2e47524bb7b7d3a6b251e23a3a43191ed7f0a418d9a578", - b"bf29a25e2d1f32c5afb18b41ae60112723278a8af31275965a6ec1d95334e840", - ], - ] - - xp = public_key = skycoin.secp256k1go__XY() - _, sig = skycoin.SKY_secp256k1go_Signature_Create() - _, msg = skycoin.SKY_secp256k1go_Number_Create() - for v in vs: - _, r = skycoin.SKY_secp256k1go_Signature_GetR(sig) - skycoin.SKY_secp256k1go_Number_SetHex(r , v[0]) - _, s = skycoin.SKY_secp256k1go_Signature_GetR(sig) - skycoin.SKY_secp256k1go_Number_SetHex(s , v[1]) - skycoin.SKY_secp256k1go_Number_SetHex(msg , v[2]) - rid = int(v[3]) - skycoin.SKY_secp256k1go_Field_SetHex(xp.X , v[4]) - skycoin.SKY_secp256k1go_Field_SetHex(xp.Y , v[5]) - - err, val = skycoin.SKY_secp256k1go_Signature_Recover(sig, public_key, msg, rid) - assert err == skycoin.SKY_OK and val - assert skycoin.SKY_secp256k1go_Field_Equals(xp.X, public_key.X)[0] == skycoin.SKY_OK - assert skycoin.SKY_secp256k1go_Field_Equals(xp.Y, public_key.Y)[0] == skycoin.SKY_OK - - -def test_TestSigVerify(): - key = skycoin.secp256k1go__XY() - _, sig = skycoin.SKY_secp256k1go_Signature_Create() - _, msg = skycoin.SKY_secp256k1go_Number_Create() - skycoin.SKY_secp256k1go_Number_SetHex(msg , b"D474CBF2203C1A55A411EEC4404AF2AFB2FE942C434B23EFE46E9F04DA8433CA") - _, r = skycoin.SKY_secp256k1go_Signature_GetR(sig) - skycoin.SKY_secp256k1go_Number_SetHex(r , b"98F9D784BA6C5C77BB7323D044C0FC9F2B27BAA0A5B0718FE88596CC56681980") - _, s = skycoin.SKY_secp256k1go_Signature_GetS(sig) - skycoin.SKY_secp256k1go_Number_SetHex(s , b"E3599D551029336A745B9FB01566624D870780F363356CEE1425ED67D1294480") - skycoin.SKY_secp256k1go_Field_SetHex(key.X , b"7d709f85a331813f9ae6046c56b3a42737abf4eb918b2e7afee285070e968b93") - skycoin.SKY_secp256k1go_Field_SetHex(key.Y , b"26150d1a63b342986c373977b00131950cb5fc194643cad6ea36b5157eba4602") - err, val = skycoin.SKY_secp256k1go_Signature_Verify(sig, key, msg) - assert err == skycoin.SKY_OK and val - - skycoin.SKY_secp256k1go_Number_SetHex(msg , b"2c43a883f4edc2b66c67a7a355b9312a565bb3d33bb854af36a06669e2028377") - _, r = skycoin.SKY_secp256k1go_Signature_GetR(sig) - skycoin.SKY_secp256k1go_Number_SetHex(r , b"6b2fa9344462c958d4a674c2a42fbedf7d6159a5276eb658887e2e1b3915329b") - _, s = skycoin.SKY_secp256k1go_Signature_GetS(sig) - skycoin.SKY_secp256k1go_Number_SetHex(s , b"eddc6ea7f190c14a0aa74e41519d88d2681314f011d253665f301425caf86b86") - - _, xy = skycoin.SKY_base58_String2Hex(b"02a60d70cfba37177d8239d018185d864b2bdd0caf5e175fd4454cc006fd2d75ac") - skycoin.SKY_secp256k1go_XY_ParsePubkey(key, xy) - err, val = skycoin.SKY_secp256k1go_Signature_Verify(sig, key, msg) - assert err == skycoin.SKY_OK and val - - -def test_TestSigSign(): - _, sig = skycoin.SKY_secp256k1go_Signature_Create() - _, sec = skycoin.SKY_secp256k1go_Number_Create() - _, msg = skycoin.SKY_secp256k1go_Number_Create() - _, non = skycoin.SKY_secp256k1go_Number_Create() - skycoin.SKY_secp256k1go_Number_SetHex(sec , b"73641C99F7719F57D8F4BEB11A303AFCD190243A51CED8782CA6D3DBE014D146") - skycoin.SKY_secp256k1go_Number_SetHex(msg , b"D474CBF2203C1A55A411EEC4404AF2AFB2FE942C434B23EFE46E9F04DA8433CA") - skycoin.SKY_secp256k1go_Number_SetHex(non , b"9E3CD9AB0F32911BFDE39AD155F527192CE5ED1F51447D63C4F154C118DA598E") - err, recid, res = skycoin.SKY_secp256k1go_Signature_Sign(sig, sec, msg, non) - assert err == skycoin.SKY_OK and res == 1 - - if forceLowS: - assert recid == 0 - else: - assert recid == 1 - - skycoin.SKY_secp256k1go_Number_SetHex(non , b"98f9d784ba6c5c77bb7323d044c0fc9f2b27baa0a5b0718fe88596cc56681980") - _, r = skycoin.SKY_secp256k1go_Signature_GetR(sig) - err, val = skycoin.SKY_secp256k1go_Number_IsEqual(r, non) - assert err == skycoin.SKY_OK and val - - if forceLowS: - assert skycoin.SKY_secp256k1go_Number_SetHex(non , b"1ca662aaefd6cc958ba4604fea999db133a75bf34c13334dabac7124ff0cfcc1") == skycoin.SKY_OK - else: - assert skycoin.SKY_secp256k1go_Number_SetHex(non , b"E3599D551029336A745B9FB01566624D870780F363356CEE1425ED67D1294480") == skycoin.SKY_OK - - _, s = skycoin.SKY_secp256k1go_Signature_GetS(sig) - err, val = skycoin.SKY_secp256k1go_Number_IsEqual(s, non) - assert err == skycoin.SKY_OK and val \ No newline at end of file diff --git a/tests/test_coin_block.py b/tests/test_coin_block.py deleted file mode 100644 index 9f7fdd5a..00000000 --- a/tests/test_coin_block.py +++ /dev/null @@ -1,167 +0,0 @@ -import skycoin -import tests.utils as utils -import time - - -def makeTestTransactions(): - err, txns = skycoin.SKY_coin_Create_Transactions() - assert err == skycoin.SKY_OK - txn = utils.makeEmptyTransaction() - assert skycoin.SKY_coin_Transactions_Add(txns, txn) == skycoin.SKY_OK - return txns - - -def makeNewBlock(uxHash): - bodyhash = skycoin.cipher_SHA256() - transactions = makeTestTransactions() - err, block = skycoin.SKY_coin_NewEmptyBlock(transactions) - assert err == skycoin.SKY_OK - err, pBlock = skycoin.SKY_coin_GetBlockObject(block) - assert err == skycoin.SKY_OK - pBlock.Head.Version = 0x02 - pBlock.Head.Time = 100 - pBlock.Head.BkSeq = 0 - pBlock.Head.Fee = 10 - err, body = skycoin.SKY_coin_GetBlockBody(block) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_BlockBody_Hash(body, bodyhash) - assert err == skycoin.SKY_OK - return skycoin.SKY_coin_NewBlock(block, int(100 + 200), uxHash, transactions, utils.feeCalc) - - -def addTransactionToBlock(b): - tx = utils.makeTransaction() - b.Body.Transactions.append(tx) - return tx - - -def test_TestNewBlock(): - txns = makeTestTransactions() - err, block = skycoin.SKY_coin_NewEmptyBlock(txns) - assert err == skycoin.SKY_OK - err, pBlock = skycoin.SKY_coin_GetBlockObject(block) - assert err == skycoin.SKY_OK - pBlock.Head.Version = 0x02 - pBlock.Head.Time = 100 - pBlock.Head.BkSeq = 98 - uxHash = utils.RandSHA256() - err, _ = skycoin.SKY_coin_NewBlock(block, 133, uxHash, txns, utils.badFeeCalculator) - assert err == skycoin.SKY_ERROR - err, txns1 = skycoin.SKY_coin_Create_Transactions() - assert err == skycoin.SKY_OK - err, _ = skycoin.SKY_coin_NewBlock(block, 133, uxHash, txns1, utils.feeCalc) - assert err == skycoin.SKY_ERROR - fee = int(121) - currentTime = int(133) - err, b = skycoin.SKY_coin_NewBlock(block, currentTime, uxHash, txns, utils.fix121FeeCalculator) - assert err == skycoin.SKY_OK - err, pBlock = skycoin.SKY_coin_GetBlockObject(b) - assert err == skycoin.SKY_OK - - -def test_TestBlockHashHeader(): - uxHash = utils.RandSHA256() - err, block = makeNewBlock(uxHash) - assert err == skycoin.SKY_OK - err, pBlock = skycoin.SKY_coin_GetBlockObject(block) - assert err == skycoin.SKY_OK - hash1 = skycoin.cipher_SHA256() - hash2 = skycoin.cipher_SHA256() - err = skycoin.SKY_coin_Block_HashHeader(block, hash1) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_BlockHeader_Hash(pBlock.Head, hash2) - assert err == skycoin.SKY_OK - assert hash1.toStr() == hash2.toStr() - hash2 = skycoin.cipher_SHA256() - assert hash1 != hash2 - - -def test_TestBlockHashBody(): - uxHash = utils.RandSHA256() - err, block = makeNewBlock(uxHash) - assert err == skycoin.SKY_OK - err, pBlock = skycoin.SKY_coin_GetBlockObject(block) - assert err == skycoin.SKY_OK - - hash1 = skycoin.cipher_SHA256() - hash2 = skycoin.cipher_SHA256() - err = skycoin.SKY_coin_Block_HashBody(block, hash1) - assert err == skycoin.SKY_OK - err, blockBody = skycoin.SKY_coin_GetBlockBody(block) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_BlockBody_Hash(blockBody, hash2) - assert err == skycoin.SKY_OK - assert hash1 == hash2 - - -def test_TestNewGenesisBlock(): - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - genTime = 1000 - genCoins = int(1000 * 1000 * 1000) - genCoinHours = int(1000 * 1000) - - err , pubkey, seckey, address = utils.makeKeysAndAddress() - assert err == skycoin.SKY_OK - err , block = skycoin.SKY_coin_NewGenesisBlock(address, genCoins, genTime) - assert err == skycoin.SKY_OK - err, pBlock = skycoin.SKY_coin_GetBlockObject(block) - assert err == skycoin.SKY_OK - - nullHash = skycoin.cipher_SHA256() - err, pHead = skycoin.SKY_coin_BlockHeader_Bytes(pBlock.Head) - assert err == skycoin.SKY_OK - assert nullHash.compareToString(str(pHead)) - assert genTime == pBlock.Head.Time - assert 0 == pBlock.Head.BkSeq - assert 0 == pBlock.Head.Version - assert 0 == pBlock.Head.Fee - - -class testcase: - index = 0 - failure = skycoin.SKY_OK - - -def test_TestCreateUnspent(): - err, pubkey, seckey, address = utils.makeKeysAndAddress() - assert err == skycoin.SKY_OK - hash1 = skycoin.cipher_SHA256() - handle = utils.makeEmptyTransaction() - err = skycoin.SKY_coin_Transaction_PushOutput(handle, address, 11000000, 255) - assert err == skycoin.SKY_OK - bh = skycoin.coin__BlockHeader() - bh.Time = 0 - bh.BkSeq = 1 - t = [] - tc1 = testcase() - t.append(tc1) - tc2 = testcase() - tc2.index = 10 - tc2.failure = skycoin.SKY_ERROR - t.append(tc2) - ux = skycoin.coin__UxOut() - tests_count = len(t) - for i in range(tests_count): - err = skycoin.SKY_coin_CreateUnspent(bh, handle, t[i].index, ux) - if t[i].failure == skycoin.SKY_ERROR : - pass - assert bh.Time == ux.Head.Time - assert bh.BkSeq == ux.Head.BkSeq - - -def test_TestCreateUnspents(): - err, pubkey, seckey, address = utils.makeKeysAndAddress() - assert err == skycoin.SKY_OK - hash1 = skycoin.cipher_SHA256() - txn = utils.makeEmptyTransaction() - err = skycoin.SKY_coin_Transaction_PushOutput(txn, address, int(11e6), int(255)) - assert err == skycoin.SKY_OK - bh = skycoin.coin__BlockHeader() - bh.Time = 0 - bh.BkSeq = 1 - err , uxouts = skycoin.SKY_coin_CreateUnspents(bh, txn) - assert err == skycoin.SKY_OK - assert err == skycoin.SKY_OK - assert len(uxouts) == 1 - diff --git a/tests/test_coin_math.py b/tests/test_coin_math.py deleted file mode 100644 index 5cbab095..00000000 --- a/tests/test_coin_math.py +++ /dev/null @@ -1,64 +0,0 @@ -import skycoin -import tests.utils - - -def test_TestAddUint64(): - err, n = skycoin.SKY_coin_AddUint64(10, 11) - assert err == skycoin.SKY_OK - assert int(21) == n - err, n = skycoin.SKY_coin_AddUint64(int(0xFFFFFFFFFFFFFFFF), 1) - assert err == skycoin.SKY_ErrUint64AddOverflow - - -class math_test: - a = 0 - b = 0 - err = skycoin.SKY_OK - - -def test_TestUint64ToInt64(): - cases = [] - values = math_test() - cases.append(values) - values.a = int(1) - values.b = 1 - cases.append(values) - values.a = int(0xFFFFFFFFFFFFFFFF) - values.b = int(0xFFFFFFFFFFFFFFFF) - values.err = skycoin.SKY_ErrUint64AddOverflow - cases.append(values) - values.a = int(0xFFFFFFFFFFFFFFFF) - values.b = 0 - values.err = skycoin.SKY_ErrUint64AddOverflow - cases.append(values) - for val in cases: - s = int(val.a) - err, x = skycoin.SKY_coin_Uint64ToInt64(s) - if err != skycoin.SKY_OK: - assert skycoin.SKY_ErrUint64AddOverflow == val.err - else: - assert val.b == x - - -def test_TestInt64ToUint64(): - cases = [] - values = math_test() - cases.append(values) - values.a = 1 - values.b = 1 - cases.append(values) - values.a = int(-0xFFFFFFFFFFFFFFFF) - values.b = int(0) - values.err = skycoin.SKY_ErrUint64AddOverflow - cases.append(values) - values.a = int(-1) - values.b = 0 - values.err = skycoin.SKY_ErrUint64AddOverflow - cases.append(values) - for val in cases: - s = int(val.a) - err, x = skycoin.SKY_coin_Int64ToUint64(s) - if err != skycoin.SKY_OK: - assert skycoin.SKY_ErrUint64AddOverflow == val.err - else: - assert val.b == x diff --git a/tests/test_coin_outputs.py b/tests/test_coin_outputs.py deleted file mode 100644 index a3658d8d..00000000 --- a/tests/test_coin_outputs.py +++ /dev/null @@ -1,607 +0,0 @@ -import skycoin -import tests.utils as utils - -def test_TestUxBodyHash(): - uxb, _ = utils.makeUxBodyWithSecret() - hash_null = skycoin.cipher_SHA256() - hashx = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxBody_Hash(uxb, hashx) == skycoin.SKY_OK - assert hashx != hash_null - - -def test_TestUxOutHash(): - uxb, _ = utils.makeUxBodyWithSecret() - uxo, _ = utils.makeUxOutWithSecret() - uxo.Body = uxb - hash_body = skycoin.cipher_SHA256() - hash_out = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxBody_Hash(uxb, hash_body) == skycoin.SKY_OK - assert skycoin.SKY_coin_UxOut_Hash(uxo, hash_out) == skycoin.SKY_OK - assert hash_body == hash_out - # Head should not affect hash - uxh = skycoin.coin__UxHead() - uxh.Time = 0 - uxh.BkSeq = 1 - uxo.Head = uxh - assert skycoin.SKY_coin_UxOut_Hash(uxo, hash_out) == skycoin.SKY_OK - assert hash_body == hash_out - - -def test_TestUxOutSnapshotHash(): - p = skycoin.cipher_PubKey() - s = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(p, s) - uxb = skycoin.coin__UxBody() - _, b = skycoin.SKY_cipher_RandByte(128) - h = skycoin.cipher_SHA256() - assert skycoin.SKY_cipher_SumSHA256(b, h) == skycoin.SKY_OK - uxb.SetSrcTransaction(h.toStr()) - a = skycoin.cipher__Address() - skycoin.SKY_cipher_AddressFromPubKey(p, a) - uxb.Address = a - uxb.Coins = int(1e6) - uxb.Hours = int(100) - uxo = skycoin.coin__UxOut() - uxh = skycoin.coin__UxHead() - uxh.Time = 100 - uxh.BkSeq = 2 - uxo.Head = uxh - uxo.Body = uxb - hn = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_SnapshotHash(uxo, hn) == skycoin.SKY_OK - # snapshot hash should be dependent on every field in body and head - # Head Time - uxo_2 = uxo - uxh.Time = 20 - uxo_2.Head = uxh - hn_2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_SnapshotHash(uxo_2, hn_2) == skycoin.SKY_OK - assert hn != hn_2 - # Head BkSeq - uxo_2 = uxo - uxh.BkSeq = 4 - uxo_2.Head = uxh - hn_2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_SnapshotHash(uxo_2, hn_2) == skycoin.SKY_OK - assert hn != hn_2 - # Body SetSrcTransaction - uxo_2 = uxo - uxb = skycoin.coin__UxBody() - _, b = skycoin.SKY_cipher_RandByte(128) - h = skycoin.cipher_SHA256() - assert skycoin.SKY_cipher_SumSHA256(b, h) == skycoin.SKY_OK - uxb.SetSrcTransaction(h.toStr()) - uxo_2.Body = uxb - hn_2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_SnapshotHash(uxo_2, hn_2) == skycoin.SKY_OK - assert hn != hn_2 - # Body Address - p_2 = skycoin.cipher_PubKey() - s_2 = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(p_2, s_2) - a_2 = skycoin.cipher__Address() - skycoin.SKY_cipher_AddressFromPubKey(p_2, a_2) - uxo_2 = uxo - uxb = skycoin.coin__UxBody() - uxb.Address = a_2 - uxo_2.Body = uxb - hn_2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_SnapshotHash(uxo_2, hn_2) == skycoin.SKY_OK - assert hn != hn_2 - # Body Coins - uxo_2 = uxo - uxb = skycoin.coin__UxBody() - uxb.Coins = int(2) - uxo_2.Body = uxb - hn_2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_SnapshotHash(uxo_2, hn_2) == skycoin.SKY_OK - assert hn != hn_2 - # Body Hours - uxo_2 = uxo - uxb = skycoin.coin__UxBody() - uxb.Hours = int(2) - uxo_2.Body = uxb - hn_2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_SnapshotHash(uxo_2, hn_2) == skycoin.SKY_OK - assert hn != hn_2 - - -def test_TestUxOutCoinHours(): - p = skycoin.cipher_PubKey() - s = skycoin.cipher_SecKey() - skycoin.SKY_cipher_GenerateKeyPair(p, s) - uxb = skycoin.coin__UxBody() - _, b = skycoin.SKY_cipher_RandByte(128) - h = skycoin.cipher_SHA256() - assert skycoin.SKY_cipher_SumSHA256(b, h) == skycoin.SKY_OK - uxb.SetSrcTransaction(h.toStr()) - a = skycoin.cipher__Address() - skycoin.SKY_cipher_AddressFromPubKey(p, a) - uxb.Address = a - uxb.Coins = int(1e6) - uxb.Hours = int(100) - uxo = skycoin.coin__UxOut() - uxh = skycoin.coin__UxHead() - uxh.Time = 100 - uxh.BkSeq = 2 - uxo.Head = uxh - uxo.Body = uxb - - # Less than an hour passed - now = uxh.Time + 100 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxh.Time - assert err == skycoin.SKY_OK - # 1 hours passed - now = uxh.Time + 3600 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxh.Time + uxb.Coins / 1000000 - assert err == skycoin.SKY_OK - # 6 hours passed - now = uxh.Time + 3600 * 6 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxh.Time + (uxb.Coins / 1000000) * 6 - assert err == skycoin.SKY_OK - # Time is backwards (treated as no hours passed) - now = uxh.Time // 2 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxh.Time - assert err == skycoin.SKY_OK - # 1 hour has passed, output has 1.5 coins, should gain 1 coinhour - uxb.Coins = 1500000 - now = uxh.Time + 3600 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxb.Hours + 1 - assert err == skycoin.SKY_OK - # 2 hours have passed, output has 1.5 coins, should gain 3 coin hours - uxb.Coins = 1500000 - uxo.Body = uxb - now = uxh.Time + 3600 * 2 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxb.Hours + 3 - assert err == skycoin.SKY_OK - # 1 second has passed, output has 3600 coins, should gain 1 coin hour - uxb.Coins = 3600000000 - uxo.Body = uxb - now = uxh.Time + 1 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxb.Hours + 1 - assert err == skycoin.SKY_OK - # 1000000 hours minus 1 second have passed, output has 1 droplet, should gain 0 coin hour - uxb.Coins = 1 - uxo.Body = uxb - now = uxh.Time + 1000000 * 3600 - 1 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxb.Hours - assert err == skycoin.SKY_OK - # 1000000 hours have passed, output has 1 droplet, should gain 1 coin hour - uxb.Coins = 1 - uxo.Body = uxb - now = uxh.Time + 1000000 * 3600 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxb.Hours + 1 - assert err == skycoin.SKY_OK - # No hours passed, using initial coin hours - uxb.Coins = 1000000000 - uxb.Hours = 1000 * 1000 - uxo.Body = uxb - now = uxh.Time - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxb.Hours - assert err == skycoin.SKY_OK - # One hour passed, using initial coin hours - now = uxh.Time + 3600 - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == uxb.Hours + 1000000000 / 1000000 - assert err == skycoin.SKY_OK - # No hours passed and no hours to begin with0 - uxb.Hours = 0 - uxo.Body = uxb - now = uxh.Time - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert hours == 0 - assert err == skycoin.SKY_OK - # Centuries have passed, time-based calculation overflows uint64 - # when calculating the whole coin seconds - uxb.Coins = 2000000 - uxo.Body = uxb - now = 0xFFFFFFFFFFFFFFFF - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert err == skycoin.SKY_ERROR - # Centuries have passed, time-based calculation overflows uint64 - # when calculating the droplet seconds - uxb.Coins = 1500000 - uxo.Body = uxb - now = 0xFFFFFFFFFFFFFFFF - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert err == skycoin.SKY_ERROR - # Output would overflow if given more hours, has reached its limit - uxb.Coins = 3600000000 - uxo.Body = uxb - now = 0xFFFFFFFFFFFFFFFF - err, hours = skycoin.SKY_coin_UxOut_CoinHours(uxo, now) - assert err == skycoin.SKY_ERROR - - -def test_TestUxArrayCoins(): - uxa = utils.makeUxArray(4) - for x in uxa: - x.Body.Coins = utils.Million - err, coins = skycoin.SKY_coin_UxArray_Coins(uxa) - assert coins == int(4e6) - assert err == skycoin.SKY_OK - uxa[2].Body.Coins = int(utils.MaxUint64 - int(1e6)) - err, _ = skycoin.SKY_coin_UxArray_Coins(uxa) - assert err == skycoin.SKY_ERROR - - -def ux_Array_CoinsHours(uxa, now=0, slic=0): - result = 0 - for x in uxa[slic:]: - err, time = skycoin.SKY_coin_UxOut_CoinHours(x, now) - result += time - assert err == skycoin.SKY_OK - return result - - -def test_TestUxArrayCoinHours(): - uxa = utils.makeUxArray(4) - assert skycoin.SKY_coin_UxArray_CoinHours(uxa, 0)[1] == 400 - # 1 hour later - assert skycoin.SKY_coin_UxArray_CoinHours( - uxa, uxa[0].Head.Time + 3600)[1] == 404 - # 1.5 hours later - assert skycoin.SKY_coin_UxArray_CoinHours( - uxa, uxa[0].Head.Time + 3600 + 1800)[1] == 404 - # 2 hour later - assert skycoin.SKY_coin_UxArray_CoinHours( - uxa, uxa[0].Head.Time + 3600 + 4600)[1] == 408 - - uxa[2].Head.Time = utils.MaxUint64 - 100 - # assert skycoin.SKY_coin_UxArray_CoinHours(uxa, utils.MaxUint64 - 100)[1] == skycoin.SKY_OK - value = skycoin.SKY_coin_UxArray_CoinHours(uxa, uxa[2].Head.Time)[1] - assert utils.err_CoinHours_Overflow( - value) == skycoin.SKY_ErrAddEarnedCoinHoursAdditionOverflow - value = skycoin.SKY_coin_UxArray_CoinHours(uxa, 1000000000000)[1] - assert utils.err_CoinHours_Overflow( - value) == skycoin.SKY_ErrAddEarnedCoinHoursAdditionOverflow - - -def test_TestUxArrayHashArray(): - uxa = utils.makeUxArray(4) - sha = skycoin.cipher_SHA256() - err, hashs = skycoin.SKY_coin_UxArray_Hashes(uxa) - assert err == skycoin.SKY_OK - assert len(hashs) == len(uxa) - skycoin.SKY_coin_UxOut_Hash(uxa[0], sha) - print(sha) - print(uxa[0]) - assert hashs[0] == sha - for i in range(len(hashs)): - assert skycoin.SKY_coin_UxOut_Hash(uxa[i], sha) == 0 - assert sha == hashs[i] - - -def test_TestUxArrayHasDupes(): - uxa = utils.makeUxArray(4) - err, hasDupes = skycoin.SKY_coin_UxArray_HasDupes(uxa) - assert err == skycoin.SKY_OK - assert hasDupes == 0 - uxa[0] = uxa[1] - err, hasDupes = skycoin.SKY_coin_UxArray_HasDupes(uxa) - assert err == skycoin.SKY_OK - assert hasDupes == 1 - - -def test_TestUxArraySub(): - uxa = utils.makeUxArray(4) - uxb = utils.makeUxArray(4) - uxc = uxa[:1] - for ux in uxb: - uxc.append(ux) - for ux in uxa[1:2]: - uxc.append(ux) - err, uxd = skycoin.SKY_coin_UxArray_Sub(uxc, uxa) - assert err == skycoin.SKY_OK - assert len(uxd) == len(uxb) - assert uxd == uxb - err, uxd = skycoin.SKY_coin_UxArray_Sub(uxc, uxb) - assert err == skycoin.SKY_OK - assert len(uxd) == 2 - assert uxd == uxa[:2] - # No intersection - err, uxd = skycoin.SKY_coin_UxArray_Sub(uxa, uxb) - assert uxd == uxa - err, uxd = skycoin.SKY_coin_UxArray_Sub(uxb, uxa) - assert uxd == uxb - - -def manualUxArrayIsSorted(uxa): - sha_1 = skycoin.cipher_SHA256() - sha_2 = skycoin.cipher_SHA256() - isSorte = True - for i in range(len(uxa) - 1): - assert skycoin.SKY_coin_UxOut_Hash(uxa[i], sha_1) == skycoin.SKY_OK - assert skycoin.SKY_coin_UxOut_Hash(uxa[i + 1], sha_2) == skycoin.SKY_OK - if sha_1 > sha_2: - isSorte = False - return isSorte - - -def isUxArraySorted(uxa): - n = len(uxa) - prev = uxa - current = prev - current += 1 - hash_1 = skycoin.cipher_SHA256() - hash_2 = skycoin.cipher_SHA256() - prevHash = None - currentHash = None - result = int() - for i in n: - if(prevHash == None): - result = skycoin.SKY_coin_UxOut_Hash(prev, hash_1) - assert result == skycoin.SKY_OK - prevHash = hash_1 - if currentHash == None: - currentHash = hash_2 - result = skycoin.SKY_coin_UxOut_Hash(current, currentHash) - assert result == skycoin.SKY_OK - if prevHash.__eq__(currentHash) > 0: - return 0 - if i % 2 != 0: - prevHash = hash_2 - currentHash = hash_1 - else: - prevHash = hash_1 - currentHash = hash_2 - prev += 1 - current += 1 - return 1 - - -def test_TestUxArrayLen(): - uxa = utils.makeUxArray(4) - assert len(uxa) == 4 - - -def test_TestUxArrayLess(): - uxa = utils.makeUxArray(2) - err, hasha = skycoin.SKY_coin_UxArray_Hashes(uxa) - assert err == skycoin.SKY_OK and len(hasha) == len(uxa) - err, lessResult1 = skycoin.SKY_coin_UxArray_Less(uxa, 0, 1) - assert err == skycoin.SKY_OK - err, lessResult2 = skycoin.SKY_coin_UxArray_Less(uxa, 1, 0) - assert err == skycoin.SKY_OK - -def test_TestUxArraySwap(): - uxa = utils.makeUxArray(2) - uxx = utils.make_UxOut() - uxy = utils.make_UxOut() - uxa[0] = uxx - uxa[1] = uxy - err = skycoin.SKY_coin_UxArray_Swap(uxa, 0, 1) - assert err == skycoin.SKY_OK - uxa[0] = uxy - uxa[1] = uxx - err = skycoin.SKY_coin_UxArray_Swap(uxa, 0, 1) - assert err == skycoin.SKY_OK - uxa[0] = uxx - uxa[1] = uxy - err = skycoin.SKY_coin_UxArray_Swap(uxa, 0, 1) - assert err == skycoin.SKY_OK - uxa[1] = uxx - uxa[0] = uxy - -def test_TestAddressUxOutsKeys(): - uxa = utils.makeUxArray(3) - err, uxH = skycoin.SKY_coin_NewAddressUxOuts(uxa) - assert err == skycoin.SKY_OK - err, keys = skycoin.SKY_coin_AddressUxOuts_Keys(uxH) - assert err == skycoin.SKY_OK - assert len(keys) == 3 - for k in keys: - assert k == uxa[0].Body.Address or k == uxa[1].Body.Address or k == uxa[2].Body.Address - -def test_TestAddressUxOutsSub(): - uxa = utils.makeUxArray(4) - empty = utils.makeUxArray(0) - err, uxH_1 = skycoin.SKY_coin_NewAddressUxOuts(empty) - assert err == skycoin.SKY_OK - err, uxH_2 = skycoin.SKY_coin_NewAddressUxOuts(empty) - assert err == skycoin.SKY_OK - uxa[1].Body.Address = uxa[0].Body.Address - ux_2 = uxa[:2] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_1,uxa[0].Body.Address,ux_2) - assert err == skycoin.SKY_OK - ux_3 = [uxa[2]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_1,uxa[2].Body.Address, ux_3) - assert err == skycoin.SKY_OK - ux_4 = [uxa[3]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_1,uxa[3].Body.Address,ux_4) - assert err == skycoin.SKY_OK - - ux_5 = [uxa[0]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_2,uxa[0].Body.Address,ux_5) - assert err == skycoin.SKY_OK - ux_6 = [uxa[2]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_2,uxa[2].Body.Address,ux_6) - assert err == skycoin.SKY_OK - err, uxH_3 = skycoin.SKY_coin_AddressUxOuts_Sub(uxH_1,uxH_2) - assert err == skycoin.SKY_OK - # length - err, length = skycoin.SKY_coin_AddressUxOuts_Length(uxH_3) - assert length == 2 - assert err == skycoin.SKY_OK - # hasKey - err, has_key = skycoin.SKY_coin_AddressUxOuts_HasKey(uxH_3, uxa[2].Body.Address) - assert err == skycoin.SKY_OK - assert has_key == 0 - err, ux_3 = skycoin.SKY_coin_AddressUxOuts_Get(uxH_3,uxa[3].Body.Address) - assert err == skycoin.SKY_OK - assert len(ux_3) == 1 - assert ux_3[0] == uxa[3] - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH_3,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - assert len(ux_2) == 1 - assert ux_2[0] == uxa[1] - # Originals should be unmodified - err, length = skycoin.SKY_coin_AddressUxOuts_Length(uxH_1) - assert err == skycoin.SKY_OK - assert length == 3 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_1,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - assert length == 2 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_1,uxa[2].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_1,uxa[3].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - - err, length = skycoin.SKY_coin_AddressUxOuts_Length(uxH_2) - assert err == skycoin.SKY_OK - assert length == 2 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_2,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_2,uxa[2].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - - -def test_TestAddressUxOutsAdd(): - uxa = utils.makeUxArray(4) - empty = utils.makeUxArray(0) - err, uxH_1 = skycoin.SKY_coin_NewAddressUxOuts(empty) - assert err == skycoin.SKY_OK - err, uxH_2 = skycoin.SKY_coin_NewAddressUxOuts(empty) - assert err == skycoin.SKY_OK - uxa[1].Body.Address = uxa[0].Body.Address - ux_2 = [uxa[0]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_1,uxa[0].Body.Address,ux_2) - assert err == skycoin.SKY_OK - ux_3 = [uxa[2]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_1,uxa[2].Body.Address, ux_3) - assert err == skycoin.SKY_OK - ux_4 = [uxa[3]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_1,uxa[3].Body.Address,ux_4) - assert err == skycoin.SKY_OK - ux_5 = [uxa[0]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_2,uxa[0].Body.Address,ux_5) - assert err == skycoin.SKY_OK - ux_6 = [uxa[2]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH_2,uxa[2].Body.Address,ux_6) - assert err == skycoin.SKY_OK - err, uxH_3 = skycoin.SKY_coin_AddressUxOuts_Add(uxH_1,uxH_2) - assert err == skycoin.SKY_OK - # length - err, length = skycoin.SKY_coin_AddressUxOuts_Length(uxH_3) - assert err == skycoin.SKY_OK - assert length == 3 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_3,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - # assert length == 2 - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH_3,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - # assert len(ux_2) == 2 - assert ux_2[0] == uxa[0] - # assert ux_2[1] == uxa[1] - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH_3,uxa[2].Body.Address) - assert err == skycoin.SKY_OK - assert len(ux_2) == 1 - assert ux_2[0] == uxa[2] - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH_3,uxa[3].Body.Address) - assert err == skycoin.SKY_OK - assert len(ux_2) == 1 - assert ux_2[0] == uxa[3] - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH_3,uxa[1].Body.Address) - assert err == skycoin.SKY_OK - # assert len(ux_2) == 2 - assert ux_2[0] == uxa[0] - # assert ux_2[1] == uxa[1] - # Originals should be unmodified - err, length = skycoin.SKY_coin_AddressUxOuts_Length(uxH_1) - assert err == skycoin.SKY_OK - assert length == 3 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_1,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_1,uxa[2].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_1,uxa[3].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - err, length = skycoin.SKY_coin_AddressUxOuts_Length(uxH_2) - assert err == skycoin.SKY_OK - assert length == 2 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_2,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - err, length = skycoin.SKY_coin_AddressUxOuts_GetOutputLength(uxH_2,uxa[2].Body.Address) - assert err == skycoin.SKY_OK - assert length == 1 - -def test_TestAddressUxOutsFlatten(): - uxa = utils.makeUxArray(3) - empty = utils.makeUxArray(0) - err, uxH = skycoin.SKY_coin_NewAddressUxOuts(empty) - assert err == skycoin.SKY_OK - uxa[2].Body.Address = uxa[1].Body.Address - emptyAddr = skycoin.cipher__Address() - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH,emptyAddr,empty) - assert err == skycoin.SKY_OK - ux_1 = [uxa[0]] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH,uxa[0].Body.Address,ux_1) - assert err == skycoin.SKY_OK - ux_2 = uxa[1:] - err = skycoin.SKY_coin_AddressUxOuts_Set(uxH,uxa[1].Body.Address,ux_2) - assert err == skycoin.SKY_OK - err, flatArray = skycoin.SKY_coin_AddressUxOuts_Flatten(uxH) - assert err == skycoin.SKY_OK - assert len(flatArray) == 3 - for x in flatArray: - assert x.Body.Address != emptyAddr - - if flatArray[0].Body.Address == uxa[0].Body.Address: - assert flatArray[0] == uxa[0] - assert flatArray[0].Body.Address == uxa[0].Body.Address - assert flatArray[1] == uxa[1] - assert flatArray[1].Body.Address == uxa[1].Body.Address - assert flatArray[2] == uxa[2] - assert flatArray[2].Body.Address == uxa[2].Body.Address - else: - assert flatArray[0] == uxa[1] - assert flatArray[0].Body.Address == uxa[1].Body.Address - assert flatArray[1] == uxa[2] - assert flatArray[1].Body.Address == uxa[2].Body.Address - assert flatArray[2] == uxa[0] - assert flatArray[2].Body.Address == uxa[0].Body.Address - -def test_TestNewAddressUxOuts(): - uxa = utils.makeUxArray(6) - uxa[1].Body.Address = uxa[0].Body.Address - uxa[3].Body.Address = uxa[2].Body.Address - uxa[4].Body.Address = uxa[2].Body.Address - err, uxH = skycoin.SKY_coin_NewAddressUxOuts(uxa) - assert err == skycoin.SKY_OK - # length - err, length = skycoin.SKY_coin_AddressUxOuts_Length(uxH) - assert err == skycoin.SKY_OK - assert length == 3 - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH,uxa[0].Body.Address) - assert err == skycoin.SKY_OK - assert len(ux_2) == 2 - assert ux_2[0] == uxa[0] - assert ux_2[1] == uxa[1] - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH,uxa[3].Body.Address) - assert err == skycoin.SKY_OK - assert len(ux_2) == 3 - assert ux_2[0] == uxa[2] - assert ux_2[1] == uxa[3] - assert ux_2[2] == uxa[4] - err, ux_2 = skycoin.SKY_coin_AddressUxOuts_Get(uxH,uxa[5].Body.Address) - assert err == skycoin.SKY_OK - assert len(ux_2) == 1 - assert ux_2[0] == uxa[5] diff --git a/tests/test_coin_transaction.py b/tests/test_coin_transaction.py deleted file mode 100644 index e7ac5234..00000000 --- a/tests/test_coin_transaction.py +++ /dev/null @@ -1,786 +0,0 @@ -import skycoin -import tests.utils as utils - - -def test_TestTransactionVerify(): - # Mismatch header hash - handle, tx = utils.makeTransaction() - h = skycoin.cipher_SHA256() - h.assignTo(tx.InnerHash) - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # No inputs - handle, tx = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_ResetInputs( - handle, 0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # No outputs - handle, _ = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_ResetOutputs( - handle, 0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # Invalid number of Sigs - handle, _ = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_ResetSignatures( - handle, 0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - assert skycoin.SKY_coin_Transaction_ResetSignatures( - handle, 20) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # Too many sigs & inputs - handle, _ = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_ResetSignatures( - handle, utils.MaxUint16) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_ResetInputs( - handle, utils.MaxUint16) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # Duplicate inputs - ux, s = utils.makeUxOutWithSecret() - handle, _ = utils.makeTransactionFromUxOut(ux, s) - h = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_GetInputAt( - handle, 0, h) == skycoin.SKY_OK - err, _ = skycoin.SKY_coin_Transaction_PushInput(handle, h) - assert err == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_ResetSignatures( - handle, 0) == skycoin.SKY_OK - secKeys = [] - secKeys.append(s) - secKeys.append(s) - assert skycoin.SKY_coin_Transaction_SignInputs( - handle, secKeys) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # Duplicate outputs - handle, _ = utils.makeTransaction() - pOutput = skycoin.coin__TransactionOutput() - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle, 0, pOutput) == skycoin.SKY_OK - pOutput.Address = skycoin.cipher__Address() - assert skycoin.SKY_coin_Transaction_ResetOutputs( - handle, 0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, pOutput.Address, pOutput.Coins, pOutput.Hours) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, pOutput.Address, pOutput.Coins, pOutput.Hours) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # Output coins are 0 - handle, _ = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle, 0, pOutput) == skycoin.SKY_OK - pOutput.Coins = 0 - assert skycoin.SKY_coin_Transaction_ResetOutputs( - handle, 0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, pOutput.Address, pOutput.Coins, pOutput.Hours) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # Output coin overflow - handle, _ = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle, 0, pOutput) == skycoin.SKY_OK - pOutput.Coins = int(utils.MaxUint64 - int(3e6)) - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, pOutput.Address, pOutput.Coins, pOutput.Hours) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_ERROR - # Output coins are not multiples of 1e6 (valid, decimal restriction is not enforced here) - handle, _ = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle, 0, pOutput) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_ResetOutputs( - handle, 0) == skycoin.SKY_OK - pOutput.Coins += 10 - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, pOutput.Address, pOutput.Coins, pOutput.Hours) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_ResetSignatures( - handle, 0) == skycoin.SKY_OK - p = skycoin.cipher_PubKey() - s = skycoin.cipher_SecKey() - assert skycoin.SKY_cipher_GenerateKeyPair(p, s) == skycoin.SKY_OK - secKeys = [] - secKeys.append(s) - assert skycoin.SKY_coin_Transaction_SignInputs( - handle, secKeys) == skycoin.SKY_OK - assert int(pOutput.Coins % int(1e6)) != int(0) - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_OK - # Valid - handle, _ = utils.makeTransaction() - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle, 0, pOutput) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_ResetOutputs( - handle, 0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, pOutput.Address, int(10e6), pOutput.Hours) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, pOutput.Address, int(1e6), pOutput.Hours) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_Verify(handle) == skycoin.SKY_OK - -def test_TestTransactionVerifyInput(): - # Valid - ux, s = utils.makeUxOutWithSecret() - handle, tx = utils.makeTransactionFromUxOut(ux, s) - seckeys = [] - seckeys.append(ux) - assert skycoin.SKY_coin_Transaction_VerifyInput( - handle, seckeys) == skycoin.SKY_OK - - -def test_TestTransactionPushInput(): - handle = utils.makeEmptyTransaction() - ux = utils.makeUxOut() - sha = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_Hash(ux, sha) == skycoin.SKY_OK - _, r = skycoin.SKY_coin_Transaction_PushInput(handle, sha) - assert r == 0 - _, count = skycoin.SKY_coin_Transaction_GetInputsCount(handle) - assert count == 1 - sha1 = skycoin.cipher_SHA256() - skycoin.SKY_coin_Transaction_GetInputAt(handle, 0, sha1) - assert sha == sha1 - skycoin.SKY_coin_Transaction_ResetInputs(handle, 0) - for _ in range(utils.MaxUint16): - err, _ = skycoin.SKY_coin_Transaction_PushInput( - handle, skycoin.cipher_SHA256()) - assert err == skycoin.SKY_OK - ux = utils.makeUxOut() - assert skycoin.SKY_coin_UxOut_Hash(ux, sha) == skycoin.SKY_OK - - -def test_TestTransactionPushOutput(): - handle = utils.makeEmptyTransaction() - a = utils.makeAddress() - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, a, 100, 150) == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transaction_GetOutputsCount(handle) - assert err == skycoin.SKY_OK - assert count == 1 - pOut1 = skycoin.coin__TransactionOutput() - pOut = skycoin.coin__TransactionOutput() - pOut1.Address = a - pOut1.Coins = 100 - pOut1.Hours = 150 - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle, 0, pOut) == skycoin.SKY_OK - assert pOut == pOut1 - for i in range(1, 20): - a = utils.makeAddress() - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, a, int(i * 100), int(i * 50)) == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transaction_GetOutputsCount(handle) - assert err == skycoin.SKY_OK - assert count == int(i + 1) - pOut1.Address = a - pOut1.Coins = int(i * 100) - pOut1.Hours = int(i * 150) - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle, i, pOut) == skycoin.SKY_OK - assert pOut == pOut - i += 1 - - -def test_TestTransactionSignInputs(): - handle = utils.makeEmptyTransaction() - # Panics if txns already signed - sig = skycoin.cipher_Sig() - assert skycoin.SKY_coin_Transaction_PushSignature(handle, sig) == skycoin.SKY_OK - secKeys = [] - secKeys.append(skycoin.cipher_SecKey()) - # Panics if not enough keys - handle = utils.makeEmptyTransaction() - ux, s = utils.makeUxOutWithSecret() - h = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_Hash(ux, h) == skycoin.SKY_OK - err, _ = skycoin.SKY_coin_Transaction_PushInput(handle, h) - assert err == skycoin.SKY_OK - ux2, s2 = utils.makeUxOutWithSecret() - assert skycoin.SKY_coin_UxOut_Hash(ux2, h) == skycoin.SKY_OK - err, _ = skycoin.SKY_coin_Transaction_PushInput(handle, h) - assert err == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, utils.makeAddress(), 40, 80) == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transaction_GetSignaturesCount(handle) - assert err == skycoin.SKY_OK - assert count == 0 - # Valid signing - assert skycoin.SKY_coin_Transaction_HashInner(handle, h) == skycoin.SKY_OK - secKeys = [] - secKeys.append(s) - secKeys.append(s2) - assert skycoin.SKY_coin_Transaction_SignInputs( - handle, secKeys) == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transaction_GetSignaturesCount(handle) - assert err == skycoin.SKY_OK - assert count == 2 - h2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_HashInner( - handle, h2) == skycoin.SKY_OK - assert h == h2 - p = skycoin.cipher_PubKey() - assert skycoin.SKY_cipher_PubKeyFromSecKey(s, p) == skycoin.SKY_OK - a = skycoin.cipher__Address() - a2 = skycoin.cipher__Address() - assert skycoin.SKY_cipher_AddressFromPubKey(p, a) == skycoin.SKY_OK - assert skycoin.SKY_cipher_PubKeyFromSecKey(s2, p) == skycoin.SKY_OK - assert skycoin.SKY_cipher_AddressFromPubKey(p, a2) == skycoin.SKY_OK - sha1 = skycoin.cipher_SHA256() - sha2 = skycoin.cipher_SHA256() - txin0 = skycoin.cipher_SHA256() - txin1 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_GetInputAt( - handle, 0, txin0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_GetInputAt( - handle, 1, txin1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_AddSHA256(h, txin0, sha1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_AddSHA256(h, txin1, sha2) == skycoin.SKY_OK - txsig0 = skycoin.cipher_Sig() - txsig1 = skycoin.cipher_Sig() - assert skycoin.SKY_coin_Transaction_GetSignatureAt( - handle, 0, txsig0) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_GetSignatureAt( - handle, 1, txsig1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(a, sha1, txsig0) == skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(a2, sha2, txsig1) == skycoin.SKY_OK - assert skycoin.SKY_cipher_ChkSig(a, h, txsig1) == skycoin.SKY_ErrInvalidAddressForSig - assert skycoin.SKY_cipher_ChkSig(a2, h, txsig0) == skycoin.SKY_ErrInvalidAddressForSig - -def test_TestTransactionHash(): - handle, _ = utils.makeTransaction() - h = skycoin.cipher_SHA256() - h2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_Hash(handle, h) == skycoin.SKY_OK - assert h != h2 - assert skycoin.SKY_coin_Transaction_HashInner( - handle, h2) == skycoin.SKY_OK - assert h != h2 - -def test_TestTransactionUpdateHeader(): - handle, tx = utils.makeTransaction() - h = skycoin.cipher_SHA256() - h1 = skycoin.cipher_SHA256() - h2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_HashInner(handle, h) == skycoin.SKY_OK - skycoin.cipher_SHA256().assignTo(tx.InnerHash) - assert skycoin.SKY_coin_Transaction_UpdateHeader(handle) == skycoin.SKY_OK - h1.assignFrom(tx.InnerHash) - assert skycoin.SKY_coin_Transaction_HashInner( - handle, h2) == skycoin.SKY_OK - assert h1 != skycoin.cipher_SHA256() - assert h1 == h - assert h1 == h2 - -def test_TestTransactionHashInner(): - handle, tx = utils.makeTransaction() - h = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_HashInner(handle, h) == skycoin.SKY_OK - assert h != skycoin.cipher_SHA256() - - # If tx.In is changed, hash should change - handle2, tx2 = utils.copyTransaction(handle) - ux = utils.makeUxOut() - h = skycoin.cipher_SHA256() - h1 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_UxOut_Hash(ux, h) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_SetInputAt( - handle2, 0, h) == skycoin.SKY_OK - assert tx != tx2 - assert skycoin.SKY_coin_UxOut_Hash(ux, h1) == skycoin.SKY_OK - assert h == h1 - assert skycoin.SKY_coin_Transaction_HashInner(handle, h) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_HashInner( - handle2, h1) == skycoin.SKY_OK - assert h != h1 - - # If tx.Out is changed, hash should change - handle2, tx2 = utils.copyTransaction(handle) - a = utils.makeAddress() - a2 = skycoin.cipher__Address() - pOut = skycoin.coin__TransactionOutput() - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle2, 0, pOut) == skycoin.SKY_OK - pOut.Address = a - assert skycoin.SKY_coin_Transaction_SetOutputAt( - handle2, 0, pOut) == skycoin.SKY_OK - assert tx != tx2 - assert skycoin.SKY_coin_Transaction_GetOutputAt( - handle2, 0, pOut) == skycoin.SKY_OK - assert pOut.Address == a - sha1 = skycoin.cipher_SHA256() - sha2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_HashInner( - handle, sha1) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_HashInner( - handle2, sha2) == skycoin.SKY_OK - assert sha1 != sha2 - - # If tx.Head is changed, hash should not change - handle2, tx2 = utils.copyTransaction(handle) - sig = skycoin.cipher_Sig() - assert skycoin.SKY_coin_Transaction_PushSignature( - handle, sig) == skycoin.SKY_OK - sha1 = skycoin.cipher_SHA256() - sha2 = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_HashInner( - handle, sha1) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_HashInner( - handle2, sha2) == skycoin.SKY_OK - assert sha1 == sha2 - -def test_TestTransactionSerialization(): - handle, tx = utils.makeTransaction() - err, b = skycoin.SKY_coin_Transaction_Serialize(handle) - assert err == skycoin.SKY_OK - err, handle2 = skycoin.SKY_coin_TransactionDeserialize(b) - assert err == skycoin.SKY_OK - err, tx2 = skycoin.SKY_coin_GetTransactionObject(handle2) - assert err == skycoin.SKY_OK - assert tx == tx2 - -def test_TestTransactionOutputHours(): - handle = utils.makeEmptyTransaction() - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, utils.makeAddress(), int(1e6), 100) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, utils.makeAddress(), int(1e6), 200) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, utils.makeAddress(), int(1e6), 500) == skycoin.SKY_OK - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, utils.makeAddress(), int(1e6), 0) == skycoin.SKY_OK - err, hours = skycoin.SKY_coin_Transaction_OutputHours(handle) - assert err == skycoin.SKY_OK - assert hours == 800 - - assert skycoin.SKY_coin_Transaction_PushOutput( - handle, utils.makeAddress(), int(1e6), int(utils.MaxUint64 - 700)) == skycoin.SKY_OK - err, _ = skycoin.SKY_coin_Transaction_OutputHours(handle) - assert err == skycoin.SKY_ERROR - -def test_TestTransactionsSize(): - handle = utils.makeTransactions(10) - size = 0 - for i in range(10): - err, tx = skycoin.SKY_coin_Transactions_GetAt(handle, i) - assert err == skycoin.SKY_OK - err, b = skycoin.SKY_coin_Transaction_Serialize(tx) - size += len(b) - i += 1 - - assert size != 0 - err, sizetx = skycoin.SKY_coin_Transactions_Size(handle) - assert err == skycoin.SKY_OK - assert sizetx == size - -def test_TestTransactionsHashes(): - handle = utils.makeTransactions(4) - err, hashes = skycoin.SKY_coin_Transactions_Hashes(handle) - assert err == skycoin.SKY_OK - len_hashes = len(hashes) - assert len_hashes == 4 - for i in range(len_hashes): - err, tx = skycoin.SKY_coin_Transactions_GetAt(handle, i) - assert err == skycoin.SKY_OK - h = skycoin.cipher_SHA256() - assert skycoin.SKY_coin_Transaction_Hash(tx, h) == skycoin.SKY_OK - assert h == hashes[i] - i += 1 - -def test_TestTransactionsTruncateBytesTo(): - handles = utils.makeTransactions(10) - trunc = 0 - for i in range(5): - err, handle = skycoin.SKY_coin_Transactions_GetAt(handles, i) - assert err == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transaction_Size(handle) - assert err == skycoin.SKY_OK - trunc += count - i += 1 - # Trucating halfway - err, tnxs2 = skycoin.SKY_coin_Transactions_TruncateBytesTo(handles, trunc) - assert err == skycoin.SKY_OK - err, len_tnxs2 = skycoin.SKY_coin_Transactions_Length(tnxs2) - assert err == skycoin.SKY_OK - assert len_tnxs2 == 5 - err, count = skycoin.SKY_coin_Transactions_Size(tnxs2) - assert err == skycoin.SKY_OK - assert count == trunc - - # Stepping into next boundary has same cutoff, must exceed - trunc += 1 - err, txns2 = skycoin.SKY_coin_Transactions_TruncateBytesTo(handles, trunc) - assert err == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transactions_Length(tnxs2) - assert err == skycoin.SKY_OK - assert count == 5 - err, count = skycoin.SKY_coin_Transactions_Size(tnxs2) - assert err == skycoin.SKY_OK - assert count == int(trunc - 1) - - # Moving to 1 before next level - err, tnxs_5 = skycoin.SKY_coin_Transactions_GetAt(handles, 5) - assert err == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transaction_Size(tnxs_5) - assert err == skycoin.SKY_OK - trunc += int(count - 2) - err, txns2 = skycoin.SKY_coin_Transactions_TruncateBytesTo(handles, trunc) - assert err == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transactions_Length(txns2) - assert err == skycoin.SKY_OK - assert count == 5 - err, count = skycoin.SKY_coin_Transactions_Size(txns2) - assert err == skycoin.SKY_OK - err, count_tnxs5 = skycoin.SKY_coin_Transaction_Size(tnxs_5) - assert err == skycoin.SKY_OK - assert int(trunc - count_tnxs5 + 1) == count - - # Moving to next level - trunc += 1 - err, txns2 = skycoin.SKY_coin_Transactions_TruncateBytesTo(handles, trunc) - assert err == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transactions_Length(txns2) - assert err == skycoin.SKY_OK - assert count == 6 - err, count = skycoin.SKY_coin_Transactions_Size(txns2) - assert err == skycoin.SKY_OK - assert count == trunc - - # Truncating to full available amt - err, trunc = skycoin.SKY_coin_Transactions_Size(handles) - assert err == skycoin.SKY_OK - err, txns2 = skycoin.SKY_coin_Transactions_TruncateBytesTo(handles, trunc) - assert err == skycoin.SKY_OK - assert err == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transactions_Size(txns2) - assert err == skycoin.SKY_OK - assert count == trunc - assert utils.equalTransactions(handles, txns2) == skycoin.SKY_OK - - # Truncating over amount - trunc += 1 - err, txns2 = skycoin.SKY_coin_Transactions_TruncateBytesTo(handles, trunc) - assert utils.equalTransactions(handles, txns2) == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transactions_Size(handles) - assert err == skycoin.SKY_OK - assert count == int(trunc - 1) - - # Truncating to 0 - trunc = 0 - err, txns2 = skycoin.SKY_coin_Transactions_TruncateBytesTo(handles, 0) - assert err == skycoin.SKY_OK - err, count = skycoin.SKY_coin_Transactions_Length(txns2) - assert err == skycoin.SKY_OK - assert count == 0 - err, count = skycoin.SKY_coin_Transactions_Size(txns2) - assert err == skycoin.SKY_OK - assert count == trunc - -class ux(): - coins = 0 - hours = 0 - -class cases(): - name = "" - inUxs = [] - outUxs = [] - err = skycoin.SKY_OK - headTime = 0 - -def test_TestVerifyTransactionCoinsSpending(): - case = [] - inu1 = ux() - tests1 = cases - tests1.name = "Input coins overflow" - tests1.err = skycoin.SKY_ERROR - inu1.coins = int(utils.MaxUint64 - int(1e6) + 1) - inu1.hours = 10 - tests1.inUxs.append(inu1) - inu1.coins = int(1e6) - inu1.hours = 0 - tests1.inUxs.append(inu1) - case.append(tests1) - - tests2 = cases - inu2 = ux - tests2.name = "Output coins overflow" - tests2.err = skycoin.SKY_ERROR - inu2.coins = int(10e6) - inu2.hours = 10 - tests2.inUxs.append(inu2) - inu2.coins = int(utils.MaxUint64 - 10e6 + 1) - inu2.hours = 0 - tests2.outUxs.append(inu2) - inu2.coins = int(20e6) - inu2.hours = 1 - tests2.outUxs.append(inu2) - case.append(tests2) - - tests3 = cases - inu3 = ux - tests3.name = "Insufficient coins" - tests3.err = skycoin.SKY_ERROR - inu3.coins = int(10e6) - inu3.hours = int(10) - tests3.inUxs.append(inu3) - inu3.coins = int(15e6) - inu3.hours = int(10) - tests3.inUxs.append(inu3) - inu3.coins = int(20e6) - inu3.hours = int(1) - tests3.outUxs.append(inu3) - inu3.coins = int(10e6) - inu3.hours = int(1) - tests3.outUxs.append(inu3) - case.append(tests3) - - tests4 = cases - inu4 = ux - tests4.name = "Destroyed coins" - tests4.err = skycoin.SKY_ERROR - inu4.coins = int(10e6) - inu4.hours = int(10) - tests4.inUxs.append(inu4) - inu4.coins = int(15e6) - inu4.hours = int(10) - tests4.inUxs.append(inu4) - inu4.coins = int(5e6) - inu4.hours = int(1) - tests4.outUxs.append(inu4) - inu4.coins = int(10e6) - inu4.hours = int(1) - tests4.outUxs.append(inu4) - case.append(tests4) - - tests5 = cases - inu5 = ux - tests5.name = "valid" - - inu5.coins = int(10e6) - inu5.hours = int(10) - tests5.inUxs.append(inu5) - inu5.coins = int(15e6) - inu5.hours = int(10) - tests5.inUxs.append(inu5) - - inu5.coins = int(10e6) - inu5.hours = int(11) - tests5.outUxs.append(inu5) - inu5.coins = int(10e6) - inu5.hours = int(1) - tests5.outUxs.append(inu5) - inu5.coins = int(5e6) - inu5.hours = int(0) - tests5.outUxs.append(inu5) - case.append(tests5) - - for tc in case: - uxIn = [] - uxOut = [] - for ch in tc.inUxs: - puxIn = skycoin.coin__UxOut() - puxIn.Body.Coins = ch.coins - puxIn.Body.Hours = ch.hours - uxIn.append(puxIn) - for ch in tc.outUxs: - puxOut = skycoin.coin__UxOut() - puxOut.Body.Coins = ch.coins - puxOut.Body.Hours = ch.hours - uxOut.append(puxOut) - assert skycoin.SKY_coin_VerifyTransactionCoinsSpending( - uxIn, uxOut) == tc.err - -def test_TestVerifyTransactionHoursSpending(): - case = [] - # Case #1 - case1 = cases() - case1.name = "Input hours overflow" - ux1_1 = ux() - ux1_1.coins = int(3e6) - ux1_1.hours = int(utils.MaxUint64 - int(1e6) + 1) - case1.inUxs.append(ux1_1) - ux1_2 = ux() - ux1_2.coins = int(1e6) - ux1_2.hours = int(1e6) - case1.inUxs.append(ux1_2) - case1.err = skycoin.SKY_ERROR - case.append(case1) - - # Case #2 - case2 = cases() - case2.name = "Insufficient coin hours" - case2.err = skycoin.SKY_ERROR - ux2_1 = ux() - ux2_1.coins = int(10e6) - ux2_1.hours = 10 - case2.inUxs.append(ux2_1) - ux2_2 = ux() - ux2_2.coins = int(15e6) - ux2_2.hours = 10 - case2.inUxs.append(ux2_2) - ox2_1 = ux() - ox2_1.coins = int(15e6) - ox2_1.hours = 10 - case2.outUxs.append(ox2_1) - ox2_2 = ux() - ox2_2.coins = int(10e6) - ox2_2.hours = 11 - case2.outUxs.append(ox2_2) - case.append(case2) - - # Case #3 - case3 = cases() - case3.name = "coin hours time calculation overflow" - case3.err = skycoin.SKY_ERROR - case3.headTime = utils.MaxUint64 - ux3_1 = ux() - ux3_1.coins = int(10e6) - ux3_1.hours = 10 - case3.inUxs.append(ux3_1) - ux3_2 = ux() - ux3_2.coins = int(15e6) - ux3_2.hours = 10 - case3.inUxs.append(ux3_2) - ox3_1 = ux() - ox3_1.coins = int(10e6) - ox3_1.hours = 11 - case3.outUxs.append(ox3_1) - ox3_2 = ux() - ox3_2.coins = int(10e6) - ox3_2.hours = 1 - case3.outUxs.append(ox3_2) - ox3_3 = ux() - ox3_3.coins = int(5e6) - ox3_3.hours = 0 - case3.outUxs.append(ox3_3) - case.append(case3) - - # Case #4 - case4 = cases() - case4.name = "Invalid (coin hours overflow when adding earned hours, which is treated as 0, and now enough coin hours)" - case4.err = skycoin.SKY_ERROR - case4.headTime = int(1e6) - ux4_1 = ux() - ux4_1.coins = int(10e6) - ux4_1.hours = utils.MaxUint64 - case4.inUxs.append(ux4_1) - ox4_1 = ux() - ox4_1.coins = int(10e6) - ox4_1.hours = 1 - case4.outUxs.append(ox4_1) - - # Case #5 - case5 = cases() - case5.name = "Valid (coin hours overflow when adding earned hours, which is treated as 0, but not sending any hours)" - case5.headTime = int(1e6) - ux5_1 = ux() - ux5_1.coins = int(10e6) - ux5_1.hours = utils.MaxUint64 - case5.inUxs.append(ux5_1) - ox5_1 = ux() - ox5_1.coins = int(10e6) - ox5_1.hours = 0 - case5.outUxs.append(ox5_1) - case.append(case5) - - # Case #6 - case6 = cases() - case6.err = skycoin.SKY_OK - case6.name = "Valid (base inputs have insufficient coin hours, but have sufficient after adjusting coinhours by headTime)" - case6.headTime = 1492707255 - ux6_1 = ux() - ux6_1.coins = int(10e6) - ux6_1.hours = 10 - case6.inUxs.append(ux6_1) - ux6_2 = ux() - ux6_2.coins = int(15e6) - ux6_2.hours = 10 - case6.inUxs.append(ux6_2) - ox6_1 = ux() - ox6_1.coins = int(15e6) - ox6_1.hours = 10 - case6.outUxs.append(ox6_1) - ox6_2 = ux() - ox6_2.coins = int(10e6) - ox6_2.hours = 11 - case6.outUxs.append(ox6_2) - case.append(case6) - - # Case #7 - case7 = cases() - case7.name = "valid" - ux7_1 = ux() - ux7_1.coins = int(10e6) - ux7_1.hours = 10 - case7.inUxs.append(ux7_1) - ux7_2 = ux() - ux7_2.coins = int(15e6) - ux7_2.hours = 10 - case7.inUxs.append(ux7_2) - ox7_1 = ux() - ox7_1.coins = int(10e6) - ox7_1.hours = 11 - case7.outUxs.append(ox7_1) - ox7_2 = ux() - ox7_2.coins = int(10e6) - ox7_2.hours = 1 - case7.outUxs.append(ox7_2) - ox7_3 = ux() - ox7_3.coins = int(5e6) - ox7_3.hours = 0 - case7.outUxs.append(ox7_3) - case.append(case7) - - for tc in case: - uxIn = [] - uxOut = [] - for ch in tc.inUxs: - puxIn = skycoin.coin__UxOut() - puxIn.Body.Coins = ch.coins - puxIn.Body.Hours = ch.hours - uxIn.append(puxIn) - for ch in tc.outUxs: - puxOut = skycoin.coin__UxOut() - puxOut.Body.Coins = ch.coins - puxOut.Body.Hours = ch.hours - uxOut.append(puxOut) - print(tc.name) - assert skycoin.SKY_coin_VerifyTransactionHoursSpending( - tc.headTime, uxIn, uxOut) == tc.err - -def calc(transactions): - return skycoin.SKY_OK, 1 - -def overflowCalc(transaction): - return skycoin.SKY_ERROR, utils.MaxUint64 - -def test_TestTransactionsFees(): - txns = utils.makeTransactions(0) - # Nil txns - err, fee = skycoin.SKY_coin_Transactions_Fees( - txns, calc) - assert err == skycoin.SKY_OK - assert fee == 0 - - # 2 transactions, calc() always returns 1 - txn = utils.makeEmptyTransaction() - assert skycoin.SKY_coin_Transactions_Add(txns, txn) == skycoin.SKY_OK - txn1 = utils.makeEmptyTransaction() - assert skycoin.SKY_coin_Transactions_Add(txns, txn1) == skycoin.SKY_OK - err, fee = skycoin.SKY_coin_Transactions_Fees( - txns, calc) - assert err == skycoin.SKY_OK - assert fee == 2 - - # calc error - err, _ = skycoin.SKY_coin_Transactions_Fees( - txns, utils.badFeeCalculator) - assert err == skycoin.SKY_ERROR - - # # summing of calculated fees overflows - err, _ = skycoin.SKY_coin_Transactions_Fees(txns, overflowCalc) - assert err == skycoin.SKY_ERROR diff --git a/tests/test_simple.py b/tests/test_simple.py deleted file mode 100644 index 8e108d2c..00000000 --- a/tests/test_simple.py +++ /dev/null @@ -1,468 +0,0 @@ -# the inclusion of the tests module is not meant to offer best practices for -# testing in general, but rather to support the `find_packages` example in -# setup.py that excludes installing the "tests" package -import skycoin - - -# Test with handles and strings -def test_loadconfig(): - err, old_coin = skycoin.SKY_cli_Getenv(b"COIN") - assert err == skycoin.SKY_OK - err = skycoin.SKY_cli_Setenv(b"COIN", b"foocoin") - assert err == skycoin.SKY_OK - err, configHandle = skycoin.SKY_cli_LoadConfig() - assert err == skycoin.SKY_OK - err, new_coin = skycoin.SKY_cli_Config_GetCoin(configHandle) - assert err == skycoin.SKY_OK - assert new_coin == b"foocoin" - skycoin.SKY_handle_close(configHandle) - err = skycoin.SKY_cli_Setenv(b"COIN", old_coin) - assert err == skycoin.SKY_OK - - -# Test with slices as []byte -def test_Sha256XorEncrypt(): - err, data = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - assert len(data) == 32 - pwd = b"pwd" - err, encrypted = skycoin.SKY_encrypt_Sha256Xor_Encrypt( - data, pwd) - assert err == skycoin.SKY_OK - err, decrypted = skycoin.SKY_encrypt_Sha256Xor_Decrypt( - encrypted, pwd) - assert err == skycoin.SKY_OK - assert data == decrypted - - -# Test with struct and slices -def test_encrypt_ScryptChacha20poly1305Encrypt(): - encrypt_settings = skycoin.encrypt__ScryptChacha20poly1305() - encrypt_settings.N = 2 - encrypt_settings.R = 8 - encrypt_settings.P = 1 - encrypt_settings.KeyLen = 32 - - err, data = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - assert len(data) == 32 - err, encrypted = skycoin.SKY_encrypt_ScryptChacha20poly1305_Encrypt( - encrypt_settings, data, b"password") - assert err == skycoin.SKY_OK - err, decrypted = skycoin.SKY_encrypt_ScryptChacha20poly1305_Decrypt( - encrypt_settings, encrypted, b"password") - assert err == skycoin.SKY_OK - assert data == decrypted - - -# Test with struct containing array -def test_cipherAddress(): - address = skycoin.cipher__Address() - err = skycoin.SKY_cipher_DecodeBase58Address( - b"2GgFvqoyk9RjwVzj8tqfcXVXB4orBwoc9qv", address) - assert err == skycoin.SKY_OK - - err, byte = skycoin.SKY_cipher_Address_BitcoinBytes(address) - assert err == skycoin.SKY_OK - assert len(byte) > 0 - address2 = skycoin.cipher__Address() - err = skycoin.SKY_cipher_BitcoinAddressFromBytes(byte, address2) - assert err == skycoin.SKY_OK - assert address == address2 - - -# Test with array typedefs. Array typedefs were wrapped inside a struct -# Notice that the type used is cipher_PubKey instead of cipher__PubKey -def test_GenerateKeyPairs(): - err, data = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - - err = skycoin.SKY_cipher_GenerateDeterministicKeyPair( - data, pubkey, seckey) - assert err == skycoin.SKY_OK - - address = skycoin.cipher__Address() - err = skycoin.SKY_cipher_AddressFromPubKey(pubkey, address) - assert err == skycoin.SKY_OK - err = skycoin.SKY_cipher_Address_Verify(address, pubkey) - assert err == skycoin.SKY_OK - - err, address_string = skycoin.SKY_cipher_Address_String(address) - assert err == skycoin.SKY_OK - address2 = skycoin.cipher__Address() - err = skycoin.SKY_cipher_DecodeBase58Address(address_string, address2) - assert err == skycoin.SKY_OK - assert address == address2 - - -def test_GenerateDeterministicKeyPairs(): - err, seed = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - err, seckeys = skycoin.SKY_cipher_GenerateDeterministicKeyPairs(seed, 2) - assert err == skycoin.SKY_OK - length = len(seckeys) - assert length == 2 - for seckey in seckeys: - address = skycoin.cipher__Address() - err = skycoin.SKY_cipher_AddressFromSecKey(seckey, address) - assert err == skycoin.SKY_OK - pubkey = skycoin.cipher_PubKey() - err = skycoin.SKY_cipher_PubKeyFromSecKey(seckey, pubkey) - assert err == skycoin.SKY_OK - err = skycoin.SKY_cipher_PubKey_Verify(pubkey) - assert err == skycoin.SKY_OK - - -def test_GenerateDeterministicKeyPairsSeed(): - err, seed = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - err, newseed, seckeys = skycoin.SKY_cipher_GenerateDeterministicKeyPairsSeed( - seed, 2) - length = len(seckeys) - assert length == 2 - - -def test_Transaction(): - err, handle = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - err = skycoin.SKY_cipher_GenerateKeyPair(pubkey, seckey) - assert err == skycoin.SKY_OK - address = skycoin.cipher__Address() - err = skycoin.SKY_cipher_AddressFromPubKey(pubkey, address) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_Transaction_PushOutput( - handle, address, 1000000, 100) - assert err == skycoin.SKY_OK - err, transaction = skycoin.SKY_coin_GetTransactionObject(handle) - assert err == skycoin.SKY_OK - assert transaction.Length >= 0 - skycoin.SKY_handle_close(handle) - - -def __feeCalculator(transaction): - err, outCount = skycoin.SKY_coin_Transaction_GetOutputsCount(transaction) - assert err == skycoin.SKY_OK - if outCount > 0: - output = skycoin.coin__TransactionOutput() - err = skycoin.SKY_coin_Transaction_GetOutputAt(transaction, 0, output) - assert err == skycoin.SKY_OK - return 0, output.Hours - return 0, 0 - - -def __badFeeCalculator(transaction): - return 1, 0 - - -def test_Transactions(): - err, handleTransactions = skycoin.SKY_coin_Create_Transactions() - assert err == skycoin.SKY_OK - err, handleTransaction1 = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - skycoin.SKY_coin_Transactions_Add(handleTransactions, handleTransaction1) - err, handleTransaction2 = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - err = skycoin.SKY_cipher_GenerateKeyPair(pubkey, seckey) - assert err == skycoin.SKY_OK - address = skycoin.cipher__Address() - err = skycoin.SKY_cipher_AddressFromPubKey(pubkey, address) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_Transaction_PushOutput( - handleTransaction2, address, 1000000, 100) - assert err == skycoin.SKY_OK - skycoin.SKY_coin_Transactions_Add(handleTransactions, handleTransaction2) - err, fees = skycoin.SKY_coin_Transactions_Fees( - handleTransactions, __feeCalculator) - assert err == skycoin.SKY_OK - assert fees == 100 - err, fees = skycoin.SKY_coin_Transactions_Fees(handleTransactions, __badFeeCalculator) - assert err == skycoin.SKY_ERROR - skycoin.SKY_handle_close(handleTransaction1) - skycoin.SKY_handle_close(handleTransaction2) - skycoin.SKY_handle_close(handleTransactions) - - -def test_Transactions2(): - err, handleTransaction1 = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - err, handleTransaction2 = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - err, transaction1 = skycoin.SKY_coin_GetTransactionObject( - handleTransaction1) - assert err == skycoin.SKY_OK - err, transaction2 = skycoin.SKY_coin_GetTransactionObject( - handleTransaction2) - assert err == skycoin.SKY_OK - assert transaction1 == transaction2 - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - err = skycoin.SKY_cipher_GenerateKeyPair(pubkey, seckey) - assert err == skycoin.SKY_OK - address = skycoin.cipher__Address() - err = skycoin.SKY_cipher_AddressFromPubKey(pubkey, address) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_Transaction_PushOutput( - handleTransaction1, address, 1000000, 100) - assert err == skycoin.SKY_OK - assert not (transaction1 == transaction2) - output = skycoin.coin__TransactionOutput() - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_Transaction_GetOutputAt( - handleTransaction1, 0, output) - skycoin.SKY_handle_close(handleTransaction1) - skycoin.SKY_handle_close(handleTransaction2) - - -def test_SHA256NULL(): - sha256 = skycoin.cipher_SHA256() - err, result = skycoin.SKY_cipher_SHA256_Null(sha256) - assert err == skycoin.SKY_OK - assert result == True - - -def test_Number(): - err, number = skycoin.SKY_secp256k1go_Number_Create() - assert err == skycoin.SKY_OK - err = skycoin.SKY_secp256k1go_Number_SetHex( - number, b"6028b9e3a31c9e725fcbd7d5d16736aaaafcc9bf157dfb4be62bcbcf0969d488") - assert err == skycoin.SKY_OK - err, sig = skycoin.SKY_secp256k1go_Signature_Create() - assert err == skycoin.SKY_OK - err, r = skycoin.SKY_secp256k1go_Signature_GetR(sig) - assert err == skycoin.SKY_OK - err = skycoin.SKY_secp256k1go_Number_SetHex( - r, b"6028b9e3a31c9e725fcbd7d5d16736aaaafcc9bf157dfb4be62bcbcf0969d488") - assert err == skycoin.SKY_OK - - -def test_UxBody(): - uxbody = skycoin.coin__UxBody() - uxbody.Address.Version = 45 - sha256 = skycoin.cipher_SHA256() - x = sha256.toStr() - sha256.assignFrom(uxbody.SrcTransaction) - sha256.assignTo(uxbody.SrcTransaction) - - -def test_SecKeysList(): - seckeysList = [] - # Generate pubkeys and seckeys - # then add seckeys to lists - err, data = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - err = skycoin.SKY_cipher_GenerateDeterministicKeyPair( - data, pubkey, seckey) - assert err == skycoin.SKY_OK - err, data = skycoin.SKY_cipher_RandByte(32) - assert err == skycoin.SKY_OK - seckeysList.append(seckey) - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - err = skycoin.SKY_cipher_GenerateDeterministicKeyPair( - data, pubkey, seckey) - assert err == skycoin.SKY_OK - seckeysList.append(seckey) - err, handleTransaction = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - # Add as many inputs as keys - sha256 = skycoin.cipher_SHA256() - err, r = skycoin.SKY_coin_Transaction_PushInput( - handleTransaction, sha256) - assert err == skycoin.SKY_OK - sha256 = skycoin.cipher_SHA256() - err, r = skycoin.SKY_coin_Transaction_PushInput( - handleTransaction, sha256) - assert err == skycoin.SKY_OK - skycoin.SKY_coin_Transaction_ResetSignatures(handleTransaction, 0) - err = skycoin.SKY_coin_Transaction_SignInputs( - handleTransaction, seckeysList) - assert err == skycoin.SKY_OK - skycoin.SKY_handle_close(handleTransaction) - - -def test_UxOutList_CoinsHoursSpending(): - million = 1000000 - uxInList = [] - in1 = skycoin.coin__UxOut() - in1.Body.Coins = 10 * million - in1.Body.Hours = 10 - uxInList.append(in1) - in2 = skycoin.coin__UxOut() - in2.Body.Coins = 15 * million - in2.Body.Hours = 10 - uxInList.append(in2) - uxOutList = [] - out1 = skycoin.coin__UxOut() - out1.Body.Coins = 10 * million - out1.Body.Hours = 11 - uxOutList.append(out1) - out2 = skycoin.coin__UxOut() - out2.Body.Coins = 10 * million - out2.Body.Hours = 1 - uxOutList.append(out2) - out3 = skycoin.coin__UxOut() - out3.Body.Coins = 5 * million - out3.Body.Hours = 0 - uxOutList.append(out3) - err = skycoin.SKY_coin_VerifyTransactionCoinsSpending( - uxInList, uxOutList) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_VerifyTransactionHoursSpending( - 0, uxInList, uxOutList) - assert err == skycoin.SKY_OK - - -def test_UxOutList_CreateUnspent(): - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - address = skycoin.cipher__Address() - skycoin.SKY_cipher_GenerateKeyPair(pubkey, seckey) - err = skycoin.SKY_cipher_AddressFromPubKey(pubkey, address) - assert err == skycoin.SKY_OK - err, transactionHandle = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_Transaction_PushOutput( - transactionHandle, address, 11000000, 255) - assert err == skycoin.SKY_OK - bh = skycoin.coin__BlockHeader() - bh.Time = 0 - bh.BkSeq = 1 - err, unspents = skycoin.SKY_coin_CreateUnspents(bh, transactionHandle) - assert err == skycoin.SKY_OK - assert len(unspents) == 1 - err, outputsCount = skycoin.SKY_coin_Transaction_GetOutputsCount( - transactionHandle) - assert err == skycoin.SKY_OK - assert outputsCount == len(unspents) - i = 0 - for unspent in unspents: - assert unspent.Head.Time == bh.Time - assert unspent.Head.BkSeq == bh.BkSeq - output = skycoin.coin__TransactionOutput() - skycoin.SKY_coin_Transaction_GetOutputAt(transactionHandle, i, output) - assert unspent.Body.Coins == output.Coins - assert unspent.Body.Hours == output.Hours - hash = skycoin.cipher_SHA256() - err = skycoin.SKY_coin_Transaction_Hash(transactionHandle, hash) - assert err == skycoin.SKY_OK - hash2 = skycoin.cipher_SHA256() - hash2.assignFrom(unspent.Body.SrcTransaction) - assert hash == hash2 - assert unspent.Body.Address == output.Address - i += 1 - skycoin.SKY_handle_close(transactionHandle) - - -def test_Transaction_Hashes(): - err, handleTransactions = skycoin.SKY_coin_Create_Transactions() - assert err == skycoin.SKY_OK - err, handleTransaction1 = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - skycoin.SKY_coin_Transactions_Add(handleTransactions, handleTransaction1) - err, handleTransaction2 = skycoin.SKY_coin_Create_Transaction() - assert err == skycoin.SKY_OK - pubkey = skycoin.cipher_PubKey() - seckey = skycoin.cipher_SecKey() - address = skycoin.cipher__Address() - error = skycoin.SKY_cipher_GenerateKeyPair(pubkey, seckey) - assert error == skycoin.SKY_OK - error = skycoin.SKY_cipher_AddressFromPubKey(pubkey, address) - assert error == skycoin.SKY_OK - error = skycoin.SKY_coin_Transaction_PushOutput(handleTransaction2, address, 11000000, 255) - assert error == skycoin.SKY_OK - skycoin.SKY_coin_Transactions_Add(handleTransactions, handleTransaction2) - err, hashesList = skycoin.SKY_coin_Transactions_Hashes( - handleTransactions) - assert err == skycoin.SKY_OK - assert len(hashesList) == 2 - h1 = skycoin.cipher_SHA256() - h2 = skycoin.cipher_SHA256() - assert h1 == h2 - for hash in hashesList: - h = skycoin.cipher_SHA256() - assert not (h == hash) - error = skycoin.SKY_coin_Transaction_Hash(handleTransaction1, h1) - assert error == skycoin.SKY_OK - error = skycoin.SKY_coin_Transaction_Hash(handleTransaction1, h2) - assert error == skycoin.SKY_OK - assert h1 == h2 - error = skycoin.SKY_coin_Transaction_Hash(handleTransaction2, h2) - assert error == skycoin.SKY_OK - assert not (h1 == h2) - -def test_coinUxArray_Sort(): - million = 1000000 - uxInList = [] - in1 = skycoin.coin__UxOut() - in1.Body.Coins = 10 * million - in1.Body.Hours = 10 - uxInList.append(in1) - in2 = skycoin.coin__UxOut() - in2.Body.Coins = 15 * million - in2.Body.Hours = 10 - uxInList.append(in2) - assert not (in1 == in2) - error, sortedList = skycoin.SKY_coin_UxArray_Sort(uxInList) - assert error == skycoin.SKY_OK - assert len(sortedList) == 2 - error, uxAddressOutHandle = skycoin.SKY_coin_NewAddressUxOuts(uxInList) - assert error == skycoin.SKY_OK - address = skycoin.cipher__Address() - error = skycoin.SKY_cipher_DecodeBase58Address(b"2GgFvqoyk9RjwVzj8tqfcXVXB4orBwoc9qv", address) - assert error == skycoin.SKY_OK - error = skycoin.SKY_coin_AddressUxOuts_Set(uxAddressOutHandle, address, uxInList) - assert error == skycoin.SKY_OK - error, uxList = skycoin.SKY_coin_AddressUxOuts_Get(uxAddressOutHandle, address) - assert error == skycoin.SKY_OK - assert len(uxList) == 2 - assert uxInList[0] == uxList[0] - assert uxInList[1] == uxList[1] - error, keys = skycoin.SKY_coin_AddressUxOuts_Keys(uxAddressOutHandle) - assert error == skycoin.SKY_OK - assert len(keys) > 0 - keyFound = False - for key in keys: - if key == address: - keyFound = True - assert keyFound - million = 1000000 - uxInList = [] - in1 = skycoin.coin__UxOut() - in1.Body.Coins = 10 * million - in1.Body.Hours = 10 - uxInList.append(in1) - in2 = skycoin.coin__UxOut() - in2.Body.Coins = 15 * million - in2.Body.Hours = 10 - uxInList.append(in2) - assert not (in1 == in2) - error, sortedList = skycoin.SKY_coin_UxArray_Sort(uxInList) - assert error == skycoin.SKY_OK - assert len(sortedList) == 2 - error, uxAddressOutHandle = skycoin.SKY_coin_NewAddressUxOuts(uxInList) - assert error == skycoin.SKY_OK - address = skycoin.cipher__Address() - error = skycoin.SKY_cipher_DecodeBase58Address(b"2GgFvqoyk9RjwVzj8tqfcXVXB4orBwoc9qv", address) - assert error == skycoin.SKY_OK - error = skycoin.SKY_coin_AddressUxOuts_Set(uxAddressOutHandle, address, uxInList) - assert error == skycoin.SKY_OK - error, uxList = skycoin.SKY_coin_AddressUxOuts_Get(uxAddressOutHandle, address) - assert error == skycoin.SKY_OK - assert len(uxList) == 2 - error, keys = skycoin.SKY_coin_AddressUxOuts_Keys(uxAddressOutHandle) - assert error == skycoin.SKY_OK - assert len(keys) > 0 - keyFound = False - for key in keys: - if key == address: - keyFound = True - assert keyFound diff --git a/tests/test_testsuite.py b/tests/test_testsuite.py deleted file mode 100755 index ab6b4d27..00000000 --- a/tests/test_testsuite.py +++ /dev/null @@ -1,174 +0,0 @@ -import skycoin -import base64 -import binascii - -# InputTestData contains hashes to be signed -class InputTestData(): - Hashes = [] - - -# SeedTestData contains data generated by Seed -class SeedTestData(): - Seed = [] - Keys = [] - - -# KeysTestData contains address, public key, secret key and list of signatures -class KeysTestData(): - Address = "" - Secret = "" - Public = "" - Signatures = [] - - -# InputTestDataFromJSON converts InputTestDataJSON to InputTestData -def InputTestDataFromJSON(InputTestDataJSON): - hashes = [] - for h in InputTestDataJSON.Hashes: - h2 = skycoin.cipher_SHA256() - err = skycoin.SKY_cipher_SHA256FromHex(h.encode(), h2) #ok python2 - hashes.append(h2) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR, None - return skycoin.SKY_OK, hashes - - -# KeysTestDataFromJSON converts KeysTestDataJSON to KeysTestData -def KeysTestDataFromJSON(KeysTestDataJSON): - address = skycoin.cipher__Address() - err = skycoin.SKY_cipher_DecodeBase58Address(KeysTestDataJSON["address"].encode(), address) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR, None - err, hex_str = skycoin.SKY_base58_String2Hex(KeysTestDataJSON["secret"].encode()) - assert err == skycoin.SKY_OK - secret_key = skycoin.cipher_SecKey() - err = skycoin.SKY_cipher_NewSecKey(hex_str, secret_key) - assert err == skycoin.SKY_OK - - err , secret_key_hex = skycoin.SKY_cipher_SecKey_Hex(secret_key) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR, None - - err, hex_str = skycoin.SKY_base58_String2Hex(KeysTestDataJSON["public"].encode()) - assert err == skycoin.SKY_OK - public_key = skycoin.cipher_PubKey() - err = skycoin.SKY_cipher_NewPubKey(hex_str, public_key) - assert err == skycoin.SKY_OK - - err , public_key_hex = skycoin.SKY_cipher_PubKey_Hex(public_key) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR, None - - r = KeysTestData() - r.Address = address - r.Public = public_key_hex - r.Secret = secret_key_hex - r.Signatures = 0 - if KeysTestDataJSON.get("signatures") == None: - return skycoin.SKY_OK, r - sigs = [] - if len(KeysTestDataJSON["signatures"]) >= 0: - for s in KeysTestDataJSON["signatures"]: - sig_fromHex = skycoin.cipher_Sig() - err = skycoin.SKY_cipher_SigFromHex(s.encode(), sig_fromHex) - assert err == skycoin.SKY_OK - sigs.append(sig_fromHex) - assert err == skycoin.SKY_OK - r.Signatures = sigs - return skycoin.SKY_OK, r - - -# SeedTestDataFromJSON converts SeedTestDataJSON to SeedTestData -def SeedTestDataFromJSON(SeedTestDataJSON): - seed = base64.standard_b64decode(SeedTestDataJSON.Seed) - keys = [] - for kj in SeedTestDataJSON.Keys: - err, k = KeysTestDataFromJSON(kj) - if err == skycoin.SKY_ERROR: - return skycoin.SKY_ERROR, None - keys.append(k) - r = SeedTestData() - r.Seed = seed - r.Keys = keys - return skycoin.SKY_OK, r - -# ValidateSeedData validates the provided SeedTestData against the current cipher library. -# inputData is required if SeedTestData contains signatures -def ValidateSeedData(SeedTestData = None, InputTestData = None): - err, keys = skycoin.SKY_cipher_GenerateDeterministicKeyPairs(SeedTestData.Seed, len(SeedTestData.Keys)) - assert err == skycoin.SKY_OK - if len(SeedTestData.Keys) != len(keys): - return skycoin.SKY_ERROR - for i, s in enumerate(keys): - secret_Key_null = skycoin.cipher_SecKey() - if s == secret_Key_null: - return skycoin.SKY_ErrInvalidSecKey - if (SeedTestData.Keys[i].Secret).decode() != binascii.hexlify(bytearray(s.toStr())).decode('ascii'): - assert err == skycoin.SKY_ERROR - p = skycoin.cipher_PubKey() - p_null = skycoin.cipher_PubKey() - err = skycoin.SKY_cipher_PubKeyFromSecKey(s, p) - if p == p_null: - return skycoin.SKY_ErrInvalidPubKey - if (SeedTestData.Keys[i].Public).decode() != binascii.hexlify(bytearray(p.toStr())).decode('ascii'): - return skycoin.SKY_ErrInvalidPubKey - addr1 = skycoin.cipher__Address() - addr_null = skycoin.cipher__Address() - err = skycoin.SKY_cipher_AddressFromPubKey(p, addr1) - assert err == skycoin.SKY_OK - if addr1 == addr_null: - return skycoin.SKY_ErrAddressInvalidPubKey - if not(SeedTestData.Keys[i].Address == addr1): - return skycoin.SKY_ErrAddressInvalidChecksum - addr2 = skycoin.cipher__Address() - err = skycoin.SKY_cipher_AddressFromSecKey(s, addr2) - assert err == skycoin.SKY_OK - if not(addr1 == addr2): - return skycoin.SKY_ErrAddressInvalidChecksum - err, validSec = skycoin.SKY_secp256k1_VerifySeckey(s.toStr()) - if validSec != 1: - return skycoin.SKY_ERROR - err, validPub = skycoin.SKY_secp256k1_VerifyPubkey(p.toStr()) - if validPub != 1: - return skycoin.SKY_ERROR - - - if InputTestData == None and SeedTestData.Keys[i].Signatures != 0: - return skycoin.SKY_ERROR - - if InputTestData != None: - if len(SeedTestData.Keys[i].Signatures) != len(InputTestData): - return skycoin.SKY_ERROR - - for j in range(len(InputTestData)): - sig = SeedTestData.Keys[i].Signatures[j] - sig_null = skycoin.cipher_Sig() - if sig == sig_null: - return skycoin.SKY_ERROR - - err = skycoin.SKY_cipher_VerifySignature(p, sig, InputTestData[j]) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR - - err = skycoin.SKY_cipher_ChkSig(addr1, InputTestData[j], sig) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR - - err = skycoin.SKY_cipher_VerifySignedHash(sig, InputTestData[j]) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR - - p2 = skycoin.cipher_PubKey() - err = skycoin.SKY_cipher_PubKeyFromSig(sig, InputTestData[j], p2) - if err != skycoin.SKY_OK: - return skycoin.SKY_ERROR - if not(p == p2): - return 1 - return skycoin.SKY_ERROR - - sig2 = skycoin.cipher_Sig() - skycoin.SKY_cipher_SignHash(InputTestData[j], s, sig2) - if sig2 == sig_null: - return skycoin.SKY_ERROR - return skycoin.SKY_OK - diff --git a/tests/test_testsuite_test.py b/tests/test_testsuite_test.py deleted file mode 100755 index 5f328446..00000000 --- a/tests/test_testsuite_test.py +++ /dev/null @@ -1,58 +0,0 @@ -import skycoin -from . import test_testsuite -import json -import os -import re - -# testdataDir = "./testdata/" -testdataDir = "./gopath/src/github.com/skycoin/skycoin/src/cipher/testsuite/testdata/" -manyAddressesFilename = "many-addresses.golden" -inputHashesFilename = "input-hashes.golden" -seedFileRegex = "seed-\d+.golden" - - -def test_TestManyAddresses(): - f = open(testdataDir+manyAddressesFilename,'r') - fn = f.read() - f_JSON = json.loads(fn) - dataJSON = test_testsuite.SeedTestData() - dataJSON.Seed = f_JSON["seed"] - dataJSON.Keys = f_JSON["keys"] - err, data = test_testsuite.SeedTestDataFromJSON(dataJSON) - assert err == skycoin.SKY_OK - err = test_testsuite.ValidateSeedData(data, None) - assert err == skycoin.SKY_OK - -def test_TestSeedSignatures(): - f = open(testdataDir+inputHashesFilename,'r') - fn = f.read() - f_JSON = json.loads(fn) - inputDataJSON = test_testsuite.InputTestData() - inputDataJSON.Hashes = f_JSON["hashes"] - err, inputData = test_testsuite.InputTestDataFromJSON(inputDataJSON) - assert err == skycoin.SKY_OK - err, seedFiles = traverseFiles() - assert err == skycoin.SKY_OK - for dir_f in seedFiles: - f = open(testdataDir+dir_f,'r') - fn = f.read() - f_JSON = json.loads(fn) - dataJSON = test_testsuite.SeedTestData() - dataJSON.Seed = f_JSON["seed"] - dataJSON.Keys = f_JSON["keys"] - err, data = test_testsuite.SeedTestDataFromJSON(dataJSON) - assert err == skycoin.SKY_OK - err = test_testsuite.ValidateSeedData(data, inputData) - assert err == skycoin.SKY_OK - - -def traverseFiles(): - files = [] - root = os.listdir(testdataDir) - pattern = re.compile(seedFileRegex) - for path in root: - if pattern.match(path): - files.append(path) - if len(files) == 0: - return skycoin.SKY_ERROR, None - return skycoin.SKY_OK, files \ No newline at end of file diff --git a/tests/test_util_droplet.py b/tests/test_util_droplet.py deleted file mode 100644 index eef0f949..00000000 --- a/tests/test_util_droplet.py +++ /dev/null @@ -1,81 +0,0 @@ -import skycoin -import tests.utils as utils - - -class tmpstruct: - s = "", - n = 0, - e = skycoin.SKY_OK - - def __init__(self, _s, _n, _e=skycoin.SKY_OK): - self.e = _e - self.s = _s - self.n = _n - - -def test_TestFromString(): - cases = [] - cases.append(tmpstruct(b"0", 0)) - cases.append(tmpstruct(b"0.", 0)) - cases.append(tmpstruct(b"0.0", 0)) - cases.append(tmpstruct(b"0.000000", 0)) - cases.append(tmpstruct(b"0.0000000", 0)) - cases.append(tmpstruct(b"0.0000001", 0, skycoin.SKY_ErrTooManyDecimals)) - cases.append(tmpstruct(b"0.000001", 1)) - cases.append(tmpstruct(b"0.0000010", 1)) - cases.append(tmpstruct(b"1", int(1e6))) - cases.append(tmpstruct(b"1.000001", int(1e6 + 1))) - cases.append(tmpstruct(b"-1", 0, skycoin.SKY_ErrNegativeValue)) - cases.append(tmpstruct(b"10000", int(1e4 * 1e6))) - cases.append(tmpstruct(b"123456789.123456", int(123456789123456))) - cases.append(tmpstruct(b"123.000456", int(123000456))) - cases.append(tmpstruct(b"100SKY", 0, skycoin.SKY_ERROR)) - cases.append(tmpstruct(b"", 0, skycoin.SKY_ERROR)) - cases.append(tmpstruct(b"999999999999999999999999999999999999999999", 0, skycoin.SKY_ErrTooLarge)) - cases.append(tmpstruct(b"9223372036854.775807", 9223372036854775807)) - cases.append(tmpstruct(b"-9223372036854.775807", 0, skycoin.SKY_ErrNegativeValue)) - cases.append(tmpstruct(b"9223372036854775808", 0, skycoin.SKY_ErrTooLarge)) - cases.append(tmpstruct(b"9223372036854775807.000001", 0, skycoin.SKY_ErrTooLarge)) - cases.append(tmpstruct(b"9223372036854775807", 0, skycoin.SKY_ErrTooLarge)) - cases.append(tmpstruct(b"9223372036854775806.000001", 0, skycoin.SKY_ErrTooLarge)) - cases.append(tmpstruct(b"1.1", int(1e6 + 1e5))) - cases.append(tmpstruct(b"1.01", int(1e6 + 1e4))) - cases.append(tmpstruct(b"1.001", int(1e6 + 1e3))) - cases.append(tmpstruct(b"1.0001", int(1e6 + 1e2))) - cases.append(tmpstruct(b"1.00001", int(1e6 + 1e1))) - cases.append(tmpstruct(b"1.000001", int(1e6 + 1e0))) - cases.append(tmpstruct(b"1.0000001", 0, skycoin.SKY_ErrTooManyDecimals)) - - for i in range(len(cases)): - tc = cases[i] - err, n = skycoin.SKY_droplet_FromString(tc.s) - - if tc.e == skycoin.SKY_OK: - assert tc.e == err - assert tc.n == n - else: - assert tc.e == err - assert 0 == n - - -def test_TestToString(): - cases = [] - cases.append(tmpstruct(b"0.000000", 0)) - cases.append(tmpstruct(b"0.000001", 1)) - cases.append(tmpstruct(b"1.000000", int(1e6))) - cases.append(tmpstruct(b"0.100100", 100100)) - cases.append(tmpstruct(b"1.001000", 1001000)) - cases.append(tmpstruct(b"0.000999", 999)) - cases.append(tmpstruct(b"999.000000", 999000000)) - cases.append(tmpstruct(b"123.000456", 123000456)) - cases.append(tmpstruct(b"", 9223372036854775808, skycoin.SKY_ErrTooLarge)) - - for tcc in cases: - tc = tcc - err, s = skycoin.SKY_droplet_ToString(tc.n) - - if tc.e == skycoin.SKY_OK: - assert tc.s == s - else: - assert tc.e == err - assert None == s \ No newline at end of file diff --git a/tests/test_util_fee.py b/tests/test_util_fee.py deleted file mode 100644 index a5a204c4..00000000 --- a/tests/test_util_fee.py +++ /dev/null @@ -1,235 +0,0 @@ -import skycoin -import tests.utils as utils - - -class verifyTxFeeTestCase: - inputHours = 0 - outputHours = 0 - err = skycoin.SKY_OK - - def __init__(self, _inputHours, _outputHours, _err=skycoin.SKY_OK): - self.inputHours = _inputHours - self.outputHours = _outputHours - self.err = _err - - -burnFactor2verifyTxFeeTestCase = [] - -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(0, 0, skycoin.SKY_ErrTxnNoFee)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(1, 0, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(1, 1, skycoin.SKY_ErrTxnNoFee)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(2, 0, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(2, 1, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(2, 2, skycoin.SKY_ErrTxnNoFee)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(3, 0, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(3, 1, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(3, 2, skycoin.SKY_ErrTxnInsufficientFee)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(3, 3, skycoin.SKY_ErrTxnNoFee)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(4, 0, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(4, 1, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(4, 2, skycoin.SKY_OK)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(4, 3, skycoin.SKY_ErrTxnInsufficientFee)) -burnFactor2verifyTxFeeTestCase.append(verifyTxFeeTestCase(4, 4, skycoin.SKY_ErrTxnNoFee)) - - -def test_TestVerifyTransactionFee(): - addr = utils.makeAddress() - emptyTxn = utils.makeEmptyTransaction() - err, hours = skycoin.SKY_coin_Transaction_OutputHours(emptyTxn) - assert err == skycoin.SKY_OK - assert 0 == hours - - # A txn with no outputs hours and no coinhours burn fee is valid - err = skycoin.SKY_fee_VerifyTransactionFee(emptyTxn, 0) - assert err == skycoin.SKY_ErrTxnNoFee - - # A txn with no outputs hours but with a coinhours burn fee is valid - err = skycoin.SKY_fee_VerifyTransactionFee(emptyTxn, 100) - assert err == skycoin.SKY_OK - - txn = utils.makeEmptyTransaction() - addr = utils.makeAddress() - err = skycoin.SKY_coin_Transaction_PushOutput(txn, addr , 0, int(1e6)) - assert err == skycoin.SKY_OK - err = skycoin.SKY_coin_Transaction_PushOutput(txn, addr , 0, int(3e6)) - assert err == skycoin.SKY_OK - - err , hours = skycoin.SKY_coin_Transaction_OutputHours(txn) - assert err == skycoin.SKY_OK - assert hours == int(4e6) - - # A txn with insufficient net coinhours burn fee is invalid - err = skycoin.SKY_fee_VerifyTransactionFee(txn, 0) - assert err == skycoin.SKY_ErrTxnNoFee - - err = skycoin.SKY_fee_VerifyTransactionFee(txn, 1) - assert err == skycoin.SKY_ErrTxnInsufficientFee - - # A txn with sufficient net coinhours burn fee is valid - err, hours = skycoin.SKY_coin_Transaction_OutputHours(txn) - assert err == skycoin.SKY_OK - err = skycoin.SKY_fee_VerifyTransactionFee(txn, hours) - assert err == skycoin.SKY_OK - err, hours = skycoin.SKY_coin_Transaction_OutputHours(txn) - assert err == skycoin.SKY_OK - err = skycoin.SKY_fee_VerifyTransactionFee(txn, hours * 10) - assert err == skycoin.SKY_OK - - # fee + hours overflows - err = skycoin.SKY_fee_VerifyTransactionFee(txn, utils.MaxUint64 - int(3e6)) - assert err == skycoin.SKY_ERROR - - # txn has overflowing output hours - err = skycoin.SKY_coin_Transaction_PushOutput(txn, addr, 0, int(utils.MaxUint64 - 1e6 - 3e6 + 1)) - assert err == skycoin.SKY_OK - err = skycoin.SKY_fee_VerifyTransactionFee(txn, 10) - assert err == skycoin.SKY_ERROR - - cases = burnFactor2verifyTxFeeTestCase - - for tc in cases: - txn = utils.makeEmptyTransaction() - err = skycoin.SKY_coin_Transaction_PushOutput(txn, addr, 0, tc.outputHours) - assert tc.inputHours >= tc.outputHours - err = skycoin.SKY_fee_VerifyTransactionFee(txn, int(tc.inputHours - tc.outputHours)) - assert tc.err == err - - -class requiredFeeTestCase: - hours = 0 - fee = 0 - - def __init__(self, _hours, _fee): - self.hours = _hours - self.fee = _fee - - -burnFactor2RequiredFeeTestCases = [] - -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(0, 0)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(1, 1)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(2, 1)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(3, 2)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(4, 2)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(5, 3)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(6, 3)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(7, 4)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(998, 499)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(999, 500)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(1000, 500)) -burnFactor2RequiredFeeTestCases.append(requiredFeeTestCase(1001, 501)) - - -def test_TestRequiredFee(): - cases = burnFactor2RequiredFeeTestCases - - for tc in cases: - err , fee = skycoin.SKY_fee_RequiredFee(tc.hours) - assert err == skycoin.SKY_OK - assert tc.fee == fee - err , remainingHours = skycoin.SKY_fee_RemainingHours(tc.hours) - assert err == skycoin.SKY_OK - assert ((tc.hours - fee) == remainingHours) - - -class uxInput: - time = 0 - coins = 0 - hours = 0 - - def __init__(self, _time, _coins, _hours): - self.hours = _hours - self.time = _time - self.coins = _coins - - -class tmpstruct: - name = "" - out = [] - ins = [] - headTime = 0 - fee = 0 - err = skycoin.SKY_OK - - def __init__(self): - self.name = "" - self.out = [] - self.ins = [] - self.headTime = 0 - self.fee = 0 - self.err = skycoin.SKY_OK - - -headTime = int(1000) -nextTime = int(headTime + 3600) # 1 hour later - -cases = [] -# Test case with one output, one input -case1 = tmpstruct() -case1.fee = 5 -case1.headTime = 1000 -case1.out = [5] -case1.ins.append(uxInput(headTime, 10e6, 10)) -cases.append(case1) - -# Test case with multiple outputs, multiple inputs -case2 = tmpstruct() -case2.fee = 0 -case2.headTime = 1000 -case2.out = [5, 7, 3] -case2.ins.append(uxInput(headTime, int(10e6), 10)) -case2.ins.append(uxInput(headTime, int(10e6), 5)) -cases.append(case2) -# # Test case with multiple outputs, multiple inputs, and some inputs have more CoinHours once adjusted for HeadTime -case3 = tmpstruct() -case3.fee = 8 -case3.headTime = 1000 -case3.out.append(5) -case3.out.append(10) -case3.ins.append(uxInput(nextTime, 10e6, 10)) -case3.ins.append(uxInput(nextTime, 8e6, 5)) -# Test case with insufficient coin hours -case4 = tmpstruct() -case4.err = skycoin.SKY_ErrTxnInsufficientCoinHours -case4.out.append(5) -case4.out.append(10) -case4.out.append(1) -case4.ins.append(uxInput(headTime, 10e6, 10)) -case4.ins.append(uxInput(headTime, 8e6, 5)) -# Test case with overflowing input hours -case5 = tmpstruct() -case5.err = skycoin.SKY_ERROR -case5.out.append(0) -case5.ins.append(uxInput(headTime, 10e6, 10)) -case5.ins.append(uxInput(headTime, 10e6, utils.MaxUint64 - 9)) -case5.headTime = 1000 -# Test case with overflowing output hours -case6 = tmpstruct() -case6.err = skycoin.SKY_ERROR -case6.out.append(0) -case6.out.append(10) -case6.out.append(utils.MaxUint64 - 9) -case6.ins.append(uxInput(headTime, 10e6, 10)) -case6.ins.append(uxInput(headTime, 10e6, 100)) -case6.headTime = 1000 - - -def test_TestTransactionFee(): - addr = utils.makeAddress() - for j in range(len(cases)): - tc = cases[j] - tx = utils.makeEmptyTransaction() - for h in tc.out: - err = skycoin.SKY_coin_Transaction_PushOutput(tx, addr, 0, h) - assert err == skycoin.SKY_OK - - inUxs = utils.makeUxArray(len(tc.ins)) - for i in range(len(tc.ins)): - b = tc.ins[i] - inUxs[i].Head.Time = b.time - inUxs[i].Body.Coins = int(b.coins) - inUxs[i].Body.Hours = int(b.hours) - - err, fee = skycoin.SKY_fee_TransactionFee(tx, int(tc.headTime), inUxs) - assert err == tc.err - assert tc.fee == fee \ No newline at end of file