コード例 #1
0
        public void CheckBtsAddressFromBitcoinPubKeyHex()
        {
            for (int i = 0; i < m_bitcoinPrivKeys.Count; i++)
            {
                string bitcoinHex = m_bitcoinPubKeys[i];
                string btsAddress = m_btsAddresses[i];

                BitsharesPubKey key     = BitsharesPubKey.FromBitcoinHex(bitcoinHex);
                string          compare = key.m_Address;

                Assert.AreEqual(btsAddress, compare);
            }
        }
コード例 #2
0
ファイル: DaemonBase.cs プロジェクト: wildbunny/metaexchange
        /// <summary>	Take the given transaction, pull out the first input and get the public key,
        ///             turn that into a bitshares address </summary>
        ///
        /// <remarks>	Paul, 22/12/2014. </remarks>
        ///
        /// <param name="t">	The TransactionSinceBlock to process. </param>
        ///
        /// <returns>	The bitshares address from bitcoin deposit. </returns>
        protected virtual AddressOrAccountName GetBitsharesAddressFromBitcoinDeposit(TransactionSinceBlock t)
        {
            IEnumerable <string> allPubKeys = GetAllPubkeysFromBitcoinTransaction(t.TxId);

            // this is probably ok to leave out because if the user imports their whole wallet, they will likely
            // have all the PKs they need since bitcoin pregenerates 100 or so of them. worst case the user
            // can re-import their wallet into bitshares to get access to missing transcations

            /*if (allPubKeys.Distinct().Count() > 1)
             * {
             *      // can't handle more than one sender case
             *      throw new MultiplePublicKeysException();
             * }*/

            string          publicKey = allPubKeys.First();
            BitsharesPubKey btsPk     = BitsharesPubKey.FromBitcoinHex(publicKey, m_addressByteType);

            return(new AddressOrAccountName {
                m_text = btsPk.m_Address, m_isAddress = true
            });
        }