/// <summary> /// Check existance of item with provided KeyID /// </summary> /// <param name="scriptID">Hash160 of public key.</param> /// <returns>Checking result</returns> public bool HaveKey(CKeyID keyID) { var QueryCount = dbConn.Query<NumQuery>("select count([ItemID]) from [KeyStorage] where [KeyID] = ?", (byte[])keyID); return QueryCount.First().Num == 1; }
/// <summary> /// Initialize new instance of PUBKEY_ADDRESS /// </summary> /// <param name="keyID">CKeyID instance</param> public CNovacoinAddress(CKeyID keyID) { nVersion = (byte)AddrType.PUBKEY_ADDRESS; addrData = keyID; }
/// <summary> /// Get the key pair object. /// </summary> /// <param name="keyID">Hash of public key.</param> /// <param name="keyPair">Instance of CKeyPair or null.</param> /// <returns>Result</returns> public bool GetKey(CKeyID keyID, out CKeyPair keyPair) { var QueryGet = dbConn.Query<KeyStorageItem>("select * from [KeyStorage] where [KeyID] = ?", (byte[])keyID); if (QueryGet.Count() == 1) { keyPair = new CKeyPair(QueryGet.First().PrivateKey); return true; } keyPair = null; return false; }