├── .gitignore ├── CoreBitcoin.podspec ├── CoreBitcoin.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── CoreBitcoin ├── BTC256+Tests.h ├── BTC256+Tests.m ├── BTC256.h ├── BTC256.m ├── BTCAddress+Tests.h ├── BTCAddress+Tests.m ├── BTCAddress.h ├── BTCAddress.m ├── BTCAddressSubclass.h ├── BTCAssetAddress.h ├── BTCAssetAddress.m ├── BTCAssetID.h ├── BTCAssetID.m ├── BTCAssetType.h ├── BTCAssetType.m ├── BTCBase58+Tests.h ├── BTCBase58+Tests.m ├── BTCBase58.h ├── BTCBase58.m ├── BTCBigNumber+Tests.h ├── BTCBigNumber+Tests.m ├── BTCBigNumber.h ├── BTCBigNumber.m ├── BTCBitcoinURL+Tests.h ├── BTCBitcoinURL+Tests.m ├── BTCBitcoinURL.h ├── BTCBitcoinURL.m ├── BTCBlindSignature+Tests.h ├── BTCBlindSignature+Tests.m ├── BTCBlindSignature.h ├── BTCBlindSignature.m ├── BTCBlock.h ├── BTCBlock.m ├── BTCBlockHeader.h ├── BTCBlockHeader.m ├── BTCBlockchainInfo+Tests.h ├── BTCBlockchainInfo+Tests.m ├── BTCBlockchainInfo.h ├── BTCBlockchainInfo.m ├── BTCChainCom.h ├── BTCChainCom.m ├── BTCCurrencyConverter+Tests.h ├── BTCCurrencyConverter+Tests.m ├── BTCCurrencyConverter.h ├── BTCCurrencyConverter.m ├── BTCCurvePoint+Tests.h ├── BTCCurvePoint+Tests.m ├── BTCCurvePoint.h ├── BTCCurvePoint.m ├── BTCData+Tests.h ├── BTCData+Tests.m ├── BTCData.h ├── BTCData.m ├── BTCEncryptedBackup+Tests.h ├── BTCEncryptedBackup+Tests.m ├── BTCEncryptedBackup.h ├── BTCEncryptedBackup.m ├── BTCEncryptedMessage+Tests.h ├── BTCEncryptedMessage+Tests.m ├── BTCEncryptedMessage.h ├── BTCEncryptedMessage.m ├── BTCErrors.h ├── BTCErrors.m ├── BTCFancyEncryptedMessage+Tests.h ├── BTCFancyEncryptedMessage+Tests.m ├── BTCFancyEncryptedMessage.h ├── BTCFancyEncryptedMessage.m ├── BTCHashID.h ├── BTCHashID.m ├── BTCKey+Tests.h ├── BTCKey+Tests.m ├── BTCKey.h ├── BTCKey.m ├── BTCKeychain+Tests.h ├── BTCKeychain+Tests.m ├── BTCKeychain.h ├── BTCKeychain.m ├── BTCMerkleTree+Tests.h ├── BTCMerkleTree+Tests.m ├── BTCMerkleTree.h ├── BTCMerkleTree.m ├── BTCMnemonic+Tests.h ├── BTCMnemonic+Tests.m ├── BTCMnemonic.h ├── BTCMnemonic.m ├── BTCNetwork.h ├── BTCNetwork.m ├── BTCNumberFormatter.h ├── BTCNumberFormatter.m ├── BTCOpcode.h ├── BTCOpcode.m ├── BTCOutpoint.h ├── BTCOutpoint.m ├── BTCPaymentMethod.h ├── BTCPaymentMethod.m ├── BTCPaymentMethodDetails.h ├── BTCPaymentMethodDetails.m ├── BTCPaymentMethodRequest.h ├── BTCPaymentMethodRequest.m ├── BTCPaymentProtocol.h ├── BTCPaymentProtocol.m ├── BTCPaymentRequest.h ├── BTCPaymentRequest.m ├── BTCPriceSource+Tests.h ├── BTCPriceSource+Tests.m ├── BTCPriceSource.h ├── BTCPriceSource.m ├── BTCProcessor.h ├── BTCProcessor.m ├── BTCProtocolBuffers.h ├── BTCProtocolBuffers.m ├── BTCProtocolSerialization+Tests.h ├── BTCProtocolSerialization+Tests.m ├── BTCProtocolSerialization.h ├── BTCProtocolSerialization.m ├── BTCQRCode.h ├── BTCQRCode.m ├── BTCScript+Tests.h ├── BTCScript+Tests.m ├── BTCScript.h ├── BTCScript.m ├── BTCScriptMachine.h ├── BTCScriptMachine.m ├── BTCScriptTestData.h ├── BTCSecretSharing.h ├── BTCSecretSharing.m ├── BTCSignatureHashType.h ├── BTCTransaction+Tests.h ├── BTCTransaction+Tests.m ├── BTCTransaction.h ├── BTCTransaction.m ├── BTCTransactionBuilder.h ├── BTCTransactionBuilder.m ├── BTCTransactionInput.h ├── BTCTransactionInput.m ├── BTCTransactionOutput.h ├── BTCTransactionOutput.m ├── BTCUnitsAndLimits.h ├── CoreBitcoin+Categories.h ├── CoreBitcoin.h ├── NS+BTCBase58.h ├── NS+BTCBase58.m ├── NSData+BTCData.h ├── NSData+BTCData.m └── SwiftBridgingHeader.h ├── CoreBitcoinIOS ├── CoreBitcoinIOS-Info.plist ├── CoreBitcoinIOS-Prefix.pch └── en.lproj │ └── InfoPlist.strings ├── CoreBitcoinIOSlib └── CoreBitcoinIOSlib-Prefix.pch ├── CoreBitcoinOSX ├── CoreBitcoinOSX-Info.plist ├── CoreBitcoinOSX-Prefix.pch └── en.lproj │ └── InfoPlist.strings ├── CoreBitcoinOSXlib └── CoreBitcoinOSXlib-Prefix.pch ├── CoreBitcoinTestsOSX ├── BTC256Tests.swift ├── BTCAddressTests.swift ├── BTCBase58Tests.swift ├── BTCBigNumberTests.swift ├── BTCBitcoinURLTests.swift ├── BTCBlindSignatureTests.swift ├── BTCBlockchainInfoTests.swift ├── BTCCurrencyConverterTests.swift ├── BTCCurvePointTests.swift ├── BTCDataTests.swift ├── BTCEncryptedBackupTests.swift ├── BTCEncryptedMessageTests.swift ├── BTCFancyEncryptedMessageTests.swift ├── BTCKeyTests.swift ├── BTCKeychainTests.swift ├── BTCMerkleTreeTests.swift ├── BTCMnemonicTests.swift ├── BTCPaymentProtocolTests.swift ├── BTCPriceSourceTests.swift ├── BTCProtocolSerializationTests.swift ├── BTCScriptTests.swift ├── BTCSecretSharingTests.swift ├── BTCTransactionTests.swift ├── Info.plist └── TestsSwiftBridgingHeader.h ├── GLOSSARY.md ├── INSTALLATION.txt ├── LICENSE.txt ├── MEME_GLOSSARY.md ├── README.md ├── ReleaseNotes.md ├── ScriptStringRepresentation.md ├── UnitTests ├── TestProjects │ ├── TestiOSFramework │ │ ├── TestiOSFramework.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── TestiOSFramework.xccheckout │ │ ├── TestiOSFramework │ │ │ ├── Base.lproj │ │ │ │ ├── Main_iPad.storyboard │ │ │ │ └── Main_iPhone.storyboard │ │ │ ├── Images.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ │ └── LaunchImage.launchimage │ │ │ │ │ └── Contents.json │ │ │ ├── TestAppDelegate.h │ │ │ ├── TestAppDelegate.m │ │ │ ├── TestViewController.h │ │ │ ├── TestViewController.m │ │ │ ├── TestiOSFramework-Info.plist │ │ │ ├── TestiOSFramework-Prefix.pch │ │ │ ├── en.lproj │ │ │ │ └── InfoPlist.strings │ │ │ └── main.m │ │ └── TestiOSFrameworkTests │ │ │ ├── TestiOSFrameworkTests-Info.plist │ │ │ ├── TestiOSFrameworkTests.m │ │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ └── TestiOSPodfile │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Pods │ │ ├── BuildHeaders │ │ │ ├── CoreBitcoin │ │ │ │ ├── BTCAddress.h │ │ │ │ ├── BTCBase58.h │ │ │ │ ├── BTCBigNumber.h │ │ │ │ ├── BTCBlockchainInfo.h │ │ │ │ ├── BTCCurvePoint.h │ │ │ │ ├── BTCData.h │ │ │ │ ├── BTCErrors.h │ │ │ │ ├── BTCKey.h │ │ │ │ ├── BTCKeychain.h │ │ │ │ ├── BTCOpcode.h │ │ │ │ ├── BTCProtocolSerialization.h │ │ │ │ ├── BTCScript.h │ │ │ │ ├── BTCScriptMachine.h │ │ │ │ ├── BTCSignatureHashType.h │ │ │ │ ├── BTCTransaction.h │ │ │ │ ├── BTCTransactionInput.h │ │ │ │ ├── BTCTransactionOutput.h │ │ │ │ ├── BTCUnitsAndLimits.h │ │ │ │ ├── CoreBitcoin+Categories.h │ │ │ │ ├── CoreBitcoin.h │ │ │ │ ├── NS+BTCBase58.h │ │ │ │ └── NSData+BTCData.h │ │ │ └── OpenSSL │ │ │ │ ├── aes.h │ │ │ │ ├── asn1.h │ │ │ │ ├── asn1_mac.h │ │ │ │ ├── asn1t.h │ │ │ │ ├── bio.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bn.h │ │ │ │ ├── buffer.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast.h │ │ │ │ ├── cmac.h │ │ │ │ ├── cms.h │ │ │ │ ├── comp.h │ │ │ │ ├── conf.h │ │ │ │ ├── conf_api.h │ │ │ │ ├── crypto.h │ │ │ │ ├── des.h │ │ │ │ ├── des_old.h │ │ │ │ ├── dh.h │ │ │ │ ├── dsa.h │ │ │ │ ├── dso.h │ │ │ │ ├── dtls1.h │ │ │ │ ├── e_os2.h │ │ │ │ ├── ebcdic.h │ │ │ │ ├── ec.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── engine.h │ │ │ │ ├── err.h │ │ │ │ ├── evp.h │ │ │ │ ├── hmac.h │ │ │ │ ├── idea.h │ │ │ │ ├── krb5_asn.h │ │ │ │ ├── kssl.h │ │ │ │ ├── lhash.h │ │ │ │ ├── md4.h │ │ │ │ ├── md5.h │ │ │ │ ├── mdc2.h │ │ │ │ ├── modes.h │ │ │ │ ├── obj_mac.h │ │ │ │ ├── objects.h │ │ │ │ ├── ocsp.h │ │ │ │ ├── opensslconf.h │ │ │ │ ├── opensslv.h │ │ │ │ ├── ossl_typ.h │ │ │ │ ├── pem.h │ │ │ │ ├── pem2.h │ │ │ │ ├── pkcs12.h │ │ │ │ ├── pkcs7.h │ │ │ │ ├── pqueue.h │ │ │ │ ├── rand.h │ │ │ │ ├── rc2.h │ │ │ │ ├── rc4.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── rsa.h │ │ │ │ ├── safestack.h │ │ │ │ ├── seed.h │ │ │ │ ├── sha.h │ │ │ │ ├── srp.h │ │ │ │ ├── srtp.h │ │ │ │ ├── ssl.h │ │ │ │ ├── ssl2.h │ │ │ │ ├── ssl23.h │ │ │ │ ├── ssl3.h │ │ │ │ ├── stack.h │ │ │ │ ├── symhacks.h │ │ │ │ ├── tls1.h │ │ │ │ ├── ts.h │ │ │ │ ├── txt_db.h │ │ │ │ ├── ui.h │ │ │ │ ├── ui_compat.h │ │ │ │ ├── whrlpool.h │ │ │ │ ├── x509.h │ │ │ │ ├── x509_vfy.h │ │ │ │ └── x509v3.h │ │ ├── CoreBitcoin │ │ │ ├── CoreBitcoin │ │ │ │ ├── BTCAddress.h │ │ │ │ ├── BTCAddress.m │ │ │ │ ├── BTCBase58.h │ │ │ │ ├── BTCBase58.m │ │ │ │ ├── BTCBigNumber.h │ │ │ │ ├── BTCBigNumber.m │ │ │ │ ├── BTCBlockchainInfo.h │ │ │ │ ├── BTCBlockchainInfo.m │ │ │ │ ├── BTCCurvePoint.h │ │ │ │ ├── BTCCurvePoint.m │ │ │ │ ├── BTCData.h │ │ │ │ ├── BTCData.m │ │ │ │ ├── BTCErrors.h │ │ │ │ ├── BTCErrors.m │ │ │ │ ├── BTCKey.h │ │ │ │ ├── BTCKey.m │ │ │ │ ├── BTCKeychain.h │ │ │ │ ├── BTCKeychain.m │ │ │ │ ├── BTCOpcode.h │ │ │ │ ├── BTCOpcode.m │ │ │ │ ├── BTCProtocolSerialization.h │ │ │ │ ├── BTCProtocolSerialization.m │ │ │ │ ├── BTCScript.h │ │ │ │ ├── BTCScript.m │ │ │ │ ├── BTCScriptMachine.h │ │ │ │ ├── BTCScriptMachine.m │ │ │ │ ├── BTCSignatureHashType.h │ │ │ │ ├── BTCTransaction.h │ │ │ │ ├── BTCTransaction.m │ │ │ │ ├── BTCTransactionInput.h │ │ │ │ ├── BTCTransactionInput.m │ │ │ │ ├── BTCTransactionOutput.h │ │ │ │ ├── BTCTransactionOutput.m │ │ │ │ ├── BTCUnitsAndLimits.h │ │ │ │ ├── CoreBitcoin+Categories.h │ │ │ │ ├── CoreBitcoin.h │ │ │ │ ├── NS+BTCBase58.h │ │ │ │ ├── NS+BTCBase58.m │ │ │ │ ├── NSData+BTCData.h │ │ │ │ └── NSData+BTCData.m │ │ │ ├── LICENSE.txt │ │ │ └── README.md │ │ ├── Headers │ │ │ ├── CoreBitcoin │ │ │ │ ├── BTCAddress.h │ │ │ │ ├── BTCBase58.h │ │ │ │ ├── BTCBigNumber.h │ │ │ │ ├── BTCBlockchainInfo.h │ │ │ │ ├── BTCCurvePoint.h │ │ │ │ ├── BTCData.h │ │ │ │ ├── BTCErrors.h │ │ │ │ ├── BTCKey.h │ │ │ │ ├── BTCKeychain.h │ │ │ │ ├── BTCOpcode.h │ │ │ │ ├── BTCProtocolSerialization.h │ │ │ │ ├── BTCScript.h │ │ │ │ ├── BTCScriptMachine.h │ │ │ │ ├── BTCSignatureHashType.h │ │ │ │ ├── BTCTransaction.h │ │ │ │ ├── BTCTransactionInput.h │ │ │ │ ├── BTCTransactionOutput.h │ │ │ │ ├── BTCUnitsAndLimits.h │ │ │ │ ├── CoreBitcoin+Categories.h │ │ │ │ ├── CoreBitcoin.h │ │ │ │ ├── NS+BTCBase58.h │ │ │ │ └── NSData+BTCData.h │ │ │ └── OpenSSL │ │ │ │ ├── aes.h │ │ │ │ ├── asn1.h │ │ │ │ ├── asn1_mac.h │ │ │ │ ├── asn1t.h │ │ │ │ ├── bio.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bn.h │ │ │ │ ├── buffer.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast.h │ │ │ │ ├── cmac.h │ │ │ │ ├── cms.h │ │ │ │ ├── comp.h │ │ │ │ ├── conf.h │ │ │ │ ├── conf_api.h │ │ │ │ ├── crypto.h │ │ │ │ ├── des.h │ │ │ │ ├── des_old.h │ │ │ │ ├── dh.h │ │ │ │ ├── dsa.h │ │ │ │ ├── dso.h │ │ │ │ ├── dtls1.h │ │ │ │ ├── e_os2.h │ │ │ │ ├── ebcdic.h │ │ │ │ ├── ec.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── engine.h │ │ │ │ ├── err.h │ │ │ │ ├── evp.h │ │ │ │ ├── hmac.h │ │ │ │ ├── idea.h │ │ │ │ ├── krb5_asn.h │ │ │ │ ├── kssl.h │ │ │ │ ├── lhash.h │ │ │ │ ├── md4.h │ │ │ │ ├── md5.h │ │ │ │ ├── mdc2.h │ │ │ │ ├── modes.h │ │ │ │ ├── obj_mac.h │ │ │ │ ├── objects.h │ │ │ │ ├── ocsp.h │ │ │ │ ├── opensslconf.h │ │ │ │ ├── opensslv.h │ │ │ │ ├── ossl_typ.h │ │ │ │ ├── pem.h │ │ │ │ ├── pem2.h │ │ │ │ ├── pkcs12.h │ │ │ │ ├── pkcs7.h │ │ │ │ ├── pqueue.h │ │ │ │ ├── rand.h │ │ │ │ ├── rc2.h │ │ │ │ ├── rc4.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── rsa.h │ │ │ │ ├── safestack.h │ │ │ │ ├── seed.h │ │ │ │ ├── sha.h │ │ │ │ ├── srp.h │ │ │ │ ├── srtp.h │ │ │ │ ├── ssl.h │ │ │ │ ├── ssl2.h │ │ │ │ ├── ssl23.h │ │ │ │ ├── ssl3.h │ │ │ │ ├── stack.h │ │ │ │ ├── symhacks.h │ │ │ │ ├── tls1.h │ │ │ │ ├── ts.h │ │ │ │ ├── txt_db.h │ │ │ │ ├── ui.h │ │ │ │ ├── ui_compat.h │ │ │ │ ├── whrlpool.h │ │ │ │ ├── x509.h │ │ │ │ ├── x509_vfy.h │ │ │ │ └── x509v3.h │ │ ├── Local Podspecs │ │ │ └── CoreBitcoin.podspec │ │ ├── Manifest.lock │ │ ├── OpenSSL │ │ │ ├── LICENSE │ │ │ ├── include │ │ │ │ └── openssl │ │ │ │ │ ├── aes.h │ │ │ │ │ ├── asn1.h │ │ │ │ │ ├── asn1_mac.h │ │ │ │ │ ├── asn1t.h │ │ │ │ │ ├── bio.h │ │ │ │ │ ├── blowfish.h │ │ │ │ │ ├── bn.h │ │ │ │ │ ├── buffer.h │ │ │ │ │ ├── camellia.h │ │ │ │ │ ├── cast.h │ │ │ │ │ ├── cmac.h │ │ │ │ │ ├── cms.h │ │ │ │ │ ├── comp.h │ │ │ │ │ ├── conf.h │ │ │ │ │ ├── conf_api.h │ │ │ │ │ ├── crypto.h │ │ │ │ │ ├── des.h │ │ │ │ │ ├── des_old.h │ │ │ │ │ ├── dh.h │ │ │ │ │ ├── dsa.h │ │ │ │ │ ├── dso.h │ │ │ │ │ ├── dtls1.h │ │ │ │ │ ├── e_os2.h │ │ │ │ │ ├── ebcdic.h │ │ │ │ │ ├── ec.h │ │ │ │ │ ├── ecdh.h │ │ │ │ │ ├── ecdsa.h │ │ │ │ │ ├── engine.h │ │ │ │ │ ├── err.h │ │ │ │ │ ├── evp.h │ │ │ │ │ ├── hmac.h │ │ │ │ │ ├── idea.h │ │ │ │ │ ├── krb5_asn.h │ │ │ │ │ ├── kssl.h │ │ │ │ │ ├── lhash.h │ │ │ │ │ ├── md4.h │ │ │ │ │ ├── md5.h │ │ │ │ │ ├── mdc2.h │ │ │ │ │ ├── modes.h │ │ │ │ │ ├── obj_mac.h │ │ │ │ │ ├── objects.h │ │ │ │ │ ├── ocsp.h │ │ │ │ │ ├── opensslconf.h │ │ │ │ │ ├── opensslv.h │ │ │ │ │ ├── ossl_typ.h │ │ │ │ │ ├── pem.h │ │ │ │ │ ├── pem2.h │ │ │ │ │ ├── pkcs12.h │ │ │ │ │ ├── pkcs7.h │ │ │ │ │ ├── pqueue.h │ │ │ │ │ ├── rand.h │ │ │ │ │ ├── rc2.h │ │ │ │ │ ├── rc4.h │ │ │ │ │ ├── ripemd.h │ │ │ │ │ ├── rsa.h │ │ │ │ │ ├── safestack.h │ │ │ │ │ ├── seed.h │ │ │ │ │ ├── sha.h │ │ │ │ │ ├── srp.h │ │ │ │ │ ├── srtp.h │ │ │ │ │ ├── ssl.h │ │ │ │ │ ├── ssl2.h │ │ │ │ │ ├── ssl23.h │ │ │ │ │ ├── ssl3.h │ │ │ │ │ ├── stack.h │ │ │ │ │ ├── symhacks.h │ │ │ │ │ ├── tls1.h │ │ │ │ │ ├── ts.h │ │ │ │ │ ├── txt_db.h │ │ │ │ │ ├── ui.h │ │ │ │ │ ├── ui_compat.h │ │ │ │ │ ├── whrlpool.h │ │ │ │ │ ├── x509.h │ │ │ │ │ ├── x509_vfy.h │ │ │ │ │ └── x509v3.h │ │ │ └── lib │ │ │ │ ├── libcrypto.a │ │ │ │ └── libssl.a │ │ ├── Pods-CoreBitcoin-Private.xcconfig │ │ ├── Pods-CoreBitcoin-dummy.m │ │ ├── Pods-CoreBitcoin-prefix.pch │ │ ├── Pods-CoreBitcoin.xcconfig │ │ ├── Pods-OpenSSL-Private.xcconfig │ │ ├── Pods-OpenSSL-dummy.m │ │ ├── Pods-OpenSSL-prefix.pch │ │ ├── Pods-OpenSSL.xcconfig │ │ ├── Pods-acknowledgements.markdown │ │ ├── Pods-acknowledgements.plist │ │ ├── Pods-dummy.m │ │ ├── Pods-environment.h │ │ ├── Pods-resources.sh │ │ ├── Pods.xcconfig │ │ └── Pods.xcodeproj │ │ │ └── project.pbxproj │ │ ├── TestiOSPodfile.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── TestiOSPodfile.xccheckout │ │ ├── TestiOSPodfile.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── TestiOSPodfile.xccheckout │ │ ├── TestiOSPodfile │ │ ├── Base.lproj │ │ │ ├── Main_iPad.storyboard │ │ │ └── Main_iPhone.storyboard │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── LaunchImage.launchimage │ │ │ │ └── Contents.json │ │ ├── TestAppDelegate.h │ │ ├── TestAppDelegate.m │ │ ├── TestViewController.h │ │ ├── TestViewController.m │ │ ├── TestiOSPodfile-Info.plist │ │ ├── TestiOSPodfile-Prefix.pch │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── main.m │ │ └── TestiOSPodfileTests │ │ ├── TestiOSPodfileTests-Info.plist │ │ ├── TestiOSPodfileTests.m │ │ └── en.lproj │ │ └── InfoPlist.strings ├── UnitTests-Prefix.pch └── main.m ├── build_libraries.sh ├── openssl-1.0.1e.tar.gz ├── openssl └── include │ └── openssl │ ├── aes.h │ ├── asn1.h │ ├── asn1_mac.h │ ├── asn1t.h │ ├── bio.h │ ├── blowfish.h │ ├── bn.h │ ├── buffer.h │ ├── camellia.h │ ├── cast.h │ ├── cmac.h │ ├── cms.h │ ├── comp.h │ ├── conf.h │ ├── conf_api.h │ ├── crypto.h │ ├── des.h │ ├── des_old.h │ ├── dh.h │ ├── dsa.h │ ├── dso.h │ ├── dtls1.h │ ├── e_os2.h │ ├── ebcdic.h │ ├── ec.h │ ├── ecdh.h │ ├── ecdsa.h │ ├── engine.h │ ├── err.h │ ├── evp.h │ ├── hmac.h │ ├── idea.h │ ├── krb5_asn.h │ ├── kssl.h │ ├── lhash.h │ ├── md4.h │ ├── md5.h │ ├── mdc2.h │ ├── modes.h │ ├── obj_mac.h │ ├── objects.h │ ├── ocsp.h │ ├── opensslconf.h │ ├── opensslv.h │ ├── ossl_typ.h │ ├── pem.h │ ├── pem2.h │ ├── pkcs12.h │ ├── pkcs7.h │ ├── pqueue.h │ ├── rand.h │ ├── rc2.h │ ├── rc4.h │ ├── ripemd.h │ ├── rsa.h │ ├── safestack.h │ ├── seed.h │ ├── sha.h │ ├── srp.h │ ├── srtp.h │ ├── ssl.h │ ├── ssl2.h │ ├── ssl23.h │ ├── ssl3.h │ ├── stack.h │ ├── symhacks.h │ ├── tls1.h │ ├── ts.h │ ├── txt_db.h │ ├── ui.h │ ├── ui_compat.h │ ├── whrlpool.h │ ├── x509.h │ ├── x509_vfy.h │ └── x509v3.h ├── postprocess_openssl_includes_in_framework.rb ├── update_headers.rb └── update_openssl.sh /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | binaries 3 | openssl/bin 4 | openssl/lib 5 | openssl/lib/engines 6 | openssl/lib/pkgconfig 7 | openssl/ssl 8 | .DS_Store 9 | */build/* 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | *.moved-aside 20 | DerivedData 21 | .idea/ 22 | *.hmap 23 | 24 | # svn & cvs 25 | .svn 26 | CVS 27 | CoreBitcoin.xcodeproj/project.xcworkspace/xcshareddata/ 28 | openssl.bak 29 | -------------------------------------------------------------------------------- /CoreBitcoin.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "CoreBitcoin" 3 | s.version = "0.6.8.1" 4 | s.summary = "CoreBitcoin is an implementation of Bitcoin protocol in Objective-C." 5 | s.description = <<-DESC 6 | CoreBitcoin is a complete toolkit to work with Bitcoin data structures. 7 | DESC 8 | s.homepage = "https://github.com/oleganza/CoreBitcoin" 9 | s.license = 'WTFPL' 10 | s.author = { "Oleg Andreev" => "oleganza@gmail.com" } 11 | s.ios.deployment_target = '7.0' 12 | s.osx.deployment_target = '10.9' 13 | s.source = { :git => "https://github.com/oleganza/CoreBitcoin.git", :tag => s.version.to_s } 14 | s.source_files = 'CoreBitcoin' 15 | s.exclude_files = ['CoreBitcoin/**/*+Tests.{h,m}', 'CoreBitcoin/BTCScriptTestData.h'] 16 | s.requires_arc = true 17 | s.framework = 'Foundation' 18 | s.ios.framework = 'UIKit' 19 | s.osx.framework = 'AppKit' 20 | s.dependency 'OpenSSL-Universal', '1.0.1.16' 21 | s.dependency 'ISO8601DateFormatter' 22 | end 23 | -------------------------------------------------------------------------------- /CoreBitcoin.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CoreBitcoin/BTC256+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | void BTC256RunAllTests(); 4 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAddress+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCAddress.h" 4 | 5 | @interface BTCAddress (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAddressSubclass.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #ifndef CoreBitcoin_BTCAddressSubclass_h 4 | #define CoreBitcoin_BTCAddressSubclass_h 5 | 6 | @interface BTCAddress () 7 | @property(nonatomic, readwrite) NSData* data; 8 | @end 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAssetAddress.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCAddress.h" 4 | 5 | @interface BTCAssetAddress : BTCAddress 6 | @property(nonatomic, readonly, nonnull) BTCAddress* bitcoinAddress; 7 | + (nonnull instancetype) addressWithBitcoinAddress:(nonnull BTCAddress*)btcAddress; 8 | @end 9 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAssetAddress.m: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCAssetAddress.h" 4 | #import "BTCData.h" 5 | #import "BTCBase58.h" 6 | 7 | @interface BTCAssetAddress () 8 | @property(nonatomic, readwrite) BTCAddress* bitcoinAddress; 9 | @end 10 | 11 | // OpenAssets Address, e.g. akB4NBW9UuCmHuepksob6yfZs6naHtRCPNy (corresponds to 16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM) 12 | @implementation BTCAssetAddress 13 | 14 | #define BTCAssetAddressNamespace 0x13 15 | 16 | + (void) load { 17 | [BTCAddress registerAddressClass:self version:BTCAssetAddressNamespace]; 18 | } 19 | 20 | + (instancetype) addressWithBitcoinAddress:(BTCAddress*)btcAddress { 21 | if (!btcAddress) return nil; 22 | BTCAssetAddress* addr = [[self alloc] init]; 23 | addr.bitcoinAddress = btcAddress; 24 | return addr; 25 | } 26 | 27 | + (instancetype) addressWithString:(NSString*)string { 28 | NSMutableData* composedData = BTCDataFromBase58Check(string); 29 | uint8_t version = ((unsigned char*)composedData.bytes)[0]; 30 | return [self addressWithComposedData:composedData cstring:[string cStringUsingEncoding:NSUTF8StringEncoding] version:version]; 31 | } 32 | 33 | + (instancetype) addressWithComposedData:(NSData*)composedData cstring:(const char*)cstring version:(uint8_t)version { 34 | if (!composedData) return nil; 35 | if (composedData.length < 2) return nil; 36 | 37 | if (version == BTCAssetAddressNamespace) { // same for testnet and mainnet 38 | BTCAddress* btcAddr = [BTCAddress addressWithString:BTCBase58CheckStringWithData([composedData subdataWithRange:NSMakeRange(1, composedData.length - 1)])]; 39 | return [self addressWithBitcoinAddress:btcAddr]; 40 | } else { 41 | return nil; 42 | } 43 | } 44 | 45 | - (NSMutableData*) dataForBase58Encoding { 46 | NSMutableData* data = [NSMutableData dataWithLength:1]; 47 | char* buf = data.mutableBytes; 48 | buf[0] = BTCAssetAddressNamespace; 49 | [data appendData:[(BTCAssetAddress* /* cast only to expose the method that is defined in BTCAddress anyway */)self.bitcoinAddress dataForBase58Encoding]]; 50 | return data; 51 | } 52 | 53 | - (unsigned char) versionByte { 54 | return BTCAssetAddressNamespace; 55 | } 56 | 57 | - (BOOL) isTestnet { 58 | return self.bitcoinAddress.isTestnet; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAssetID.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCAddress.h" 4 | 5 | @interface BTCAssetID : BTCAddress 6 | 7 | + (nullable instancetype) assetIDWithHash:(nullable NSData*)data; 8 | 9 | + (nullable instancetype) assetIDWithString:(nullable NSString*)string; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAssetID.m: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCAssetID.h" 4 | #import "BTCAddressSubclass.h" 5 | 6 | static const uint8_t BTCAssetIDVersionMainnet = 23; // "A" prefix 7 | static const uint8_t BTCAssetIDVersionTestnet = 115; 8 | 9 | @implementation BTCAssetID 10 | 11 | + (void) load { 12 | [BTCAddress registerAddressClass:self version:BTCAssetIDVersionMainnet]; 13 | [BTCAddress registerAddressClass:self version:BTCAssetIDVersionTestnet]; 14 | } 15 | 16 | #define BTCAssetIDLength 20 17 | 18 | + (instancetype) assetIDWithString:(NSString*)string { 19 | return [self addressWithString:string]; 20 | } 21 | 22 | + (instancetype) assetIDWithHash:(NSData*)data { 23 | if (!data) return nil; 24 | if (data.length != BTCAssetIDLength) { 25 | NSLog(@"+[BTCAssetID addressWithData] cannot init with hash %d bytes long", (int)data.length); 26 | return nil; 27 | } 28 | BTCAssetID* addr = [[self alloc] init]; 29 | addr.data = [NSMutableData dataWithData:data]; 30 | return addr; 31 | } 32 | 33 | + (instancetype) addressWithComposedData:(NSData*)composedData cstring:(const char*)cstring version:(uint8_t)version { 34 | if (composedData.length != (1 + BTCAssetIDLength)) { 35 | NSLog(@"BTCAssetID: cannot init with %d bytes (need 20+1 bytes)", (int)composedData.length); 36 | return nil; 37 | } 38 | BTCAssetID* addr = [[self alloc] init]; 39 | addr.data = [[NSMutableData alloc] initWithBytes:((const char*)composedData.bytes) + 1 length:composedData.length - 1]; 40 | return addr; 41 | } 42 | 43 | - (NSMutableData*) dataForBase58Encoding { 44 | NSMutableData* data = [NSMutableData dataWithLength:1 + BTCAssetIDLength]; 45 | char* buf = data.mutableBytes; 46 | buf[0] = [self versionByte]; 47 | memcpy(buf + 1, self.data.bytes, BTCAssetIDLength); 48 | return data; 49 | } 50 | 51 | - (uint8_t) versionByte { 52 | // TODO: support testnet 53 | return BTCAssetIDVersionMainnet; 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAssetType.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | extern NSString* __nonnull const BTCAssetTypeBitcoin; 6 | extern NSString* __nonnull const BTCAssetTypeOpenAssets; 7 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCAssetType.m: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCAssetType.h" 4 | 5 | NSString* __nonnull const BTCAssetTypeBitcoin = @"bitcoin"; 6 | NSString* __nonnull const BTCAssetTypeOpenAssets = @"openassets"; 7 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBase58+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCBase58.h" 4 | 5 | void BTCBase58RunAllTests(); 6 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBase58.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // Base58 is used for compact human-friendly representation of Bitcoin addresses and private keys. 6 | // Typically Base58-encoded text also contains a checksum. 7 | // Addresses look like 19FGfswVqxNubJbh1NW8A4t51T9x9RDVWQ 8 | // Private keys look like 5KQntKuhYWSRXNqp2yhdXzjekYAR7US3MT1715Mbv5CyUKV6hVe 9 | // 10 | // Here is what Satoshi said about Base58: 11 | // Why base-58 instead of standard base-64 encoding? 12 | // - Don't want 0OIl characters that look the same in some fonts and 13 | // could be used to create visually identical looking account numbers. 14 | // - A string with non-alphanumeric characters is not as easily accepted as an account number. 15 | // - E-mail usually won't line-break if there's no punctuation to break at. 16 | // - Double-clicking selects the whole number as one word if it's all alphanumeric. 17 | 18 | 19 | // See NS+BTCBase58.h for easy to use categories. 20 | 21 | // Returns data for a Base58 string without checksum 22 | // Data is mutable so you can clear sensitive information as soon as possible. 23 | NSMutableData* BTCDataFromBase58(NSString* string); 24 | NSMutableData* BTCDataFromBase58CString(const char* cstring); 25 | 26 | // Returns data for a Base58 string with checksum 27 | NSMutableData* BTCDataFromBase58Check(NSString* string); 28 | NSMutableData* BTCDataFromBase58CheckCString(const char* cstring); 29 | 30 | // String in Base58 without checksum, you need to free it yourself. 31 | // It's mutable so you can clear it securely yourself. 32 | char* BTCBase58CStringWithData(NSData* data); 33 | 34 | // Same as above, but returns an immutable autoreleased string. Suitable for non-sensitive data. 35 | NSString* BTCBase58StringWithData(NSData* data); 36 | 37 | // String in Base58 with checksum, you need to free it yourself. 38 | // It's mutable so you can clear it securely yourself. 39 | char* BTCBase58CheckCStringWithData(NSData* data); 40 | 41 | // Same as above, but returns an immutable autoreleased string. Suitable for non-sensitive data. 42 | NSString* BTCBase58CheckStringWithData(NSData* data); 43 | 44 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBigNumber+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCBigNumber.h" 4 | 5 | @interface BTCBigNumber (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBitcoinURL+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // 4 | // BTCBitcoinURL+Tests.h 5 | // CoreBitcoin 6 | // 7 | // Created by Oleg Andreev on 02.04.2015. 8 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 9 | // 10 | 11 | #import "BTCBitcoinURL.h" 12 | 13 | @interface BTCBitcoinURL (Tests) 14 | 15 | + (void) runAllTests; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBlindSignature+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCBlindSignature.h" 4 | 5 | @interface BTCBlindSignature (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBlock.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | @class BTCBlockHeader; 6 | @interface BTCBlock : NSObject 7 | 8 | @property(nonatomic, readonly) BTCBlockHeader* header; 9 | @property(nonatomic) NSArray* transactions; 10 | 11 | @property(nonatomic, readonly) NSData* blockHash; 12 | @property(nonatomic, readonly) NSString* blockID; 13 | @property(nonatomic, readonly) NSData* data; // serialized form of the block 14 | 15 | // Informational Properties 16 | // ------------------------ 17 | // These are available via external APIs like Chain.com. 18 | 19 | // Height of the block. Default is 0. 20 | @property(nonatomic) NSInteger height; 21 | 22 | // Number of confirmations. Default is NSNotFound. 23 | @property(nonatomic) NSUInteger confirmations; 24 | 25 | // Arbitrary information attached to this instance. 26 | // The reference is copied when this instance is copied. 27 | // Default is nil. 28 | @property(nonatomic) NSDictionary* userInfo; 29 | 30 | 31 | // Computes merkle root hash from the current transaction array. 32 | - (NSData*) computeMerkleRootHash; 33 | 34 | // Updates header.merkleRootHash by hashing transactions. 35 | // Equivalent to `block.header.merkleRootHash = [block computeMerkleRootHash]`. 36 | - (void) updateMerkleTree; 37 | 38 | // Instantiates an empty block with a given header. 39 | - (id) initWithHeader:(BTCBlockHeader*)header; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBlockHeader.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | static const int32_t BTCBlockCurrentVersion = 2; 6 | 7 | @interface BTCBlockHeader : NSObject 8 | 9 | + (NSUInteger) headerLength; 10 | 11 | @property(nonatomic) int32_t version; 12 | @property(nonatomic) NSData* previousBlockHash; 13 | @property(nonatomic) NSString* previousBlockID; 14 | @property(nonatomic) NSData* merkleRootHash; 15 | @property(nonatomic) uint32_t time; 16 | @property(nonatomic) uint32_t difficultyTarget; // aka nBits 17 | @property(nonatomic) uint32_t nonce; 18 | 19 | @property(nonatomic, readonly) NSData* blockHash; 20 | @property(nonatomic, readonly) NSString* blockID; 21 | @property(nonatomic, readonly) NSData* data; 22 | 23 | // Date and time of the block. 24 | @property(nonatomic) NSDate* date; 25 | 26 | 27 | // Informational Properties 28 | // ------------------------ 29 | // These are available via external APIs like Chain.com. 30 | 31 | // Height of the block. Default is 0. 32 | @property(nonatomic) NSInteger height; 33 | 34 | // Number of confirmations. Default is NSNotFound. 35 | @property(nonatomic) NSUInteger confirmations; 36 | 37 | // Arbitrary information attached to this instance. 38 | // The reference is copied when this instance is copied. 39 | // Default is nil. 40 | @property(nonatomic) NSDictionary* userInfo; 41 | 42 | 43 | // Parses block from data buffer 44 | - (id) initWithData:(NSData*)data; 45 | 46 | // Parses input stream 47 | - (id) initWithStream:(NSInputStream*)stream; 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBlockchainInfo+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCBlockchainInfo.h" 4 | 5 | @interface BTCBlockchainInfo (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBlockchainInfo+Tests.m: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCBlockchainInfo+Tests.h" 4 | #import "BTCAddress.h" 5 | #import "BTCTransactionOutput.h" 6 | 7 | @implementation BTCBlockchainInfo (Tests) 8 | 9 | + (void) runAllTests { 10 | [self testUnspentOutputs]; 11 | } 12 | 13 | + (void) testUnspentOutputs { 14 | // our donations address with some outputs: 1CBtcGivXmHQ8ZqdPgeMfcpQNJrqTrSAcG 15 | // some temp address without outputs: 1LKF45kfvHAaP7C4cF91pVb3bkAsmQ8nBr 16 | 17 | { 18 | NSError* error = nil; 19 | NSArray* outputs = [[[BTCBlockchainInfo alloc] init] unspentOutputsWithAddresses:@[ [BTCAddress addressWithString:@"1LKF45kfvHAaP7C4cF91pVb3bkAsmQ8nBr"] ] error:&error]; 20 | 21 | NSAssert([outputs isEqual:@[]], @"should return an empty array"); 22 | NSAssert(!error, @"should have no error"); 23 | } 24 | 25 | 26 | { 27 | NSError* error = nil; 28 | NSArray* outputs = [[[BTCBlockchainInfo alloc] init] unspentOutputsWithAddresses:@[ [BTCAddress addressWithString:@"1CBtcGivXmHQ8ZqdPgeMfcpQNJrqTrSAcG"] ] error:&error]; 29 | 30 | NSAssert(outputs.count > 0, @"should return non-empty array"); 31 | NSAssert([outputs.firstObject isKindOfClass:[BTCTransactionOutput class]], @"should contain BTCTransactionOutput objects"); 32 | NSAssert(!error, @"should have no error"); 33 | } 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCBlockchainInfo.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // Collection of useful APIs for Blockchain.info 6 | @interface BTCBlockchainInfo : NSObject 7 | 8 | // Getting unspent outputs. 9 | 10 | // Builds a request from a list of BTCAddress objects. 11 | - (NSMutableURLRequest*) requestForUnspentOutputsWithAddresses:(NSArray*)addresses; 12 | // List of BTCTransactionOutput instances parsed from the response. 13 | - (NSArray*) unspentOutputsForResponseData:(NSData*)responseData error:(NSError**)errorOut; 14 | // Makes sync request for unspent outputs and parses the outputs. 15 | - (NSArray*) unspentOutputsWithAddresses:(NSArray*)addresses error:(NSError**)errorOut; 16 | 17 | 18 | // Broadcasting transaction 19 | 20 | // Request to broadcast a raw transaction data. 21 | - (NSMutableURLRequest*) requestForTransactionBroadcastWithData:(NSData*)data; 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCChainCom.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | @class BTCAddress; 5 | 6 | // Collection of APIs for Chain.con 7 | @interface BTCChainCom : NSObject 8 | 9 | - (id)initWithToken:(NSString *)token; // Free API Token from http://chain.com 10 | 11 | // Getting unspent outputs. 12 | 13 | // Builds a request from a list of BTCAddress objects. 14 | - (NSMutableURLRequest*) requestForUnspentOutputsWithAddress:(BTCAddress*)address; 15 | // List of BTCTransactionOutput instances parsed from the response. 16 | - (NSArray*) unspentOutputsForResponseData:(NSData*)responseData error:(NSError**)errorOut; 17 | // Makes sync request for unspent outputs and parses the outputs. 18 | - (NSArray*) unspentOutputsWithAddress:(BTCAddress*)addresses error:(NSError**)errorOut; 19 | 20 | 21 | // Broadcasting transaction 22 | 23 | // Request to broadcast a raw transaction data. 24 | - (NSMutableURLRequest*) requestForTransactionBroadcastWithData:(NSData*)data; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCCurrencyConverter+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // 4 | // BTCCurrencyConverter+Tests.h 5 | // CoreBitcoin 6 | // 7 | // Created by Andrew Ogden on 5/4/15. 8 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 9 | // 10 | 11 | #import "BTCCurrencyConverter.h" 12 | 13 | @interface BTCCurrencyConverter (Tests) 14 | 15 | + (void) runAllTests; 16 | 17 | @end -------------------------------------------------------------------------------- /CoreBitcoin/BTCCurvePoint+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCCurvePoint.h" 4 | 5 | @interface BTCCurvePoint (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCCurvePoint.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #include 5 | 6 | // Represents a point on the elliptic curve secp256k1. 7 | // Combined with BTCBigNumber arithmetic, you can do usual EC operations to manipulate private and public keys. 8 | // Private key is a big integer (represented by raw NSData or BTCBigNumber). 9 | // Public key is a point on the curve represented by BTCCurvePoint or BTCKey. 10 | // BTCCurvePoint is mutable. There is no immutable counterpart. 11 | @class BTCKey; 12 | @class BTCBigNumber; 13 | @interface BTCCurvePoint : NSObject 14 | 15 | // Serialized form of a curve point as a compressed public key (32-byte X coordinate with 1-byte prefix) 16 | @property(nonatomic, readonly) NSData* data; 17 | 18 | // Underlying data structure in OpenSSL. 19 | @property(nonatomic, readonly) const EC_POINT* EC_POINT; 20 | 21 | // Returns YES if the point is at infinity. 22 | @property(nonatomic, readonly) BOOL isInfinity; 23 | 24 | // Coordinates of the point 25 | @property(nonatomic, readonly) BTCBigNumber* x; 26 | @property(nonatomic, readonly) BTCBigNumber* y; 27 | 28 | // Returns the generator point. Same as [BTCCurvePoint alloc] init]. 29 | + (instancetype) generator; 30 | 31 | // Returns order of the secp256k1 curve (FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141). 32 | + (BTCBigNumber*) curveOrder; 33 | 34 | // Initializes point with its binary representation (corresponds to -data). 35 | - (id) initWithData:(NSData*)data; 36 | 37 | // Initializes point with OpenSSL EC_POINT. 38 | - (id) initWithEC_POINT:(const EC_POINT*)ecpoint; 39 | 40 | // These modify the receiver and return self (or nil in case of error). To create another point use -copy: [[point copy] multiply:number] 41 | - (instancetype) multiply:(BTCBigNumber*)number; 42 | - (instancetype) add:(BTCCurvePoint*)point; 43 | 44 | // Efficiently adds n*G to the receiver. Equivalent to [point add:[[G copy] multiply:number]] 45 | - (instancetype) addGeneratorMultipliedBy:(BTCBigNumber*)number; 46 | 47 | // Re-declared `-copy` to provide exact return type. 48 | - (BTCCurvePoint*) copy; 49 | 50 | // Clears internal point data. 51 | - (void) clear; 52 | 53 | 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCData+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | @interface NSData (BTC_Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCEncryptedBackup+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // 4 | // BTCEncryptedBackup+Tests.h 5 | // CoreBitcoin 6 | // 7 | // Created by Oleg Andreev on 30.03.2015. 8 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 9 | // 10 | 11 | #import "BTCEncryptedBackup.h" 12 | 13 | @interface BTCEncryptedBackup (Tests) 14 | 15 | + (void) runAllTests; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCEncryptedBackup.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // Implementation of [Automatic Encrypted Wallet Backups](https://github.com/oleganza/bitcoin-papers/blob/master/AutomaticEncryptedWalletBackups.md) scheme. 4 | // For test vectors, see unit tests (BTCEncryptedBackup+Tests.m). 5 | 6 | #import 7 | 8 | typedef NS_ENUM(unsigned char, BTCEncryptedBackupVersion) { 9 | BTCEncryptedBackupVersion1 = 0x01, 10 | }; 11 | 12 | @class BTCNetwork; 13 | @class BTCKey; 14 | @interface BTCEncryptedBackup : NSObject 15 | 16 | // Default version is BTCEncryptedBackupVersion1. 17 | @property(nonatomic, readonly) BTCEncryptedBackupVersion version; 18 | 19 | // Timestamp of the backup. If not specified, during encryption set to current time. 20 | @property(nonatomic, readonly) NSTimeInterval timestamp; 21 | @property(nonatomic, readonly) NSDate* date; 22 | 23 | @property(nonatomic, readonly) NSData* decryptedData; 24 | @property(nonatomic, readonly) NSData* encryptedData; 25 | 26 | @property(nonatomic, readonly) NSString* walletID; 27 | @property(nonatomic, readonly) BTCKey* authenticationKey; 28 | 29 | + (instancetype) encrypt:(NSData*)data backupKey:(NSData*)backupKey; 30 | + (instancetype) encrypt:(NSData*)data backupKey:(NSData*)backupKey timestamp:(NSTimeInterval)timestamp; 31 | + (instancetype) decrypt:(NSData*)data backupKey:(NSData*)backupKey; 32 | 33 | + (NSData*) backupKeyForNetwork:(BTCNetwork*)network masterKey:(NSData*)masterKey; 34 | + (BTCKey*) authenticationKeyWithBackupKey:(NSData*)backupKey; 35 | + (NSString*) walletIDWithAuthenticationKey:(NSData*)authPubkey; 36 | 37 | // For testing/audit purposes only: 38 | 39 | @property(nonatomic, readonly) NSData* encryptionKey; 40 | @property(nonatomic, readonly) NSData* iv; 41 | @property(nonatomic, readonly) NSData* merkleRoot; 42 | @property(nonatomic, readonly) NSData* ciphertext; 43 | @property(nonatomic, readonly) NSData* dataForSigning; 44 | @property(nonatomic, readonly) NSData* signature; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCEncryptedMessage+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // 4 | // BTCEncryptedMessage+Tests.h 5 | // CoreBitcoin 6 | // 7 | // Created by Oleg Andreev on 29.03.2015. 8 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 9 | // 10 | 11 | #import "BTCEncryptedMessage.h" 12 | 13 | @interface BTCEncryptedMessage (Tests) 14 | 15 | + (void) runAllTests; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCEncryptedMessage+Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // BTCEncryptedMessage+Tests.m 3 | // CoreBitcoin 4 | // 5 | // Created by Oleg Andreev on 29.03.2015. 6 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import "BTCEncryptedMessage+Tests.h" 10 | #import "BTCKey.h" 11 | #import "BTCData.h" 12 | 13 | @implementation BTCEncryptedMessage (Tests) 14 | 15 | + (void) runAllTests { 16 | 17 | BTCEncryptedMessage* em = [[BTCEncryptedMessage alloc] init]; 18 | em.senderKey = [[BTCKey alloc] initWithWIF:@"L1Ejc5dAigm5XrM3mNptMEsNnHzS7s51YxU7J61ewGshZTKkbmzJ"]; 19 | em.recipientKey = [[BTCKey alloc] initWithWIF:@"KxfxrUXSMjJQcb3JgnaaA6MqsrKQ1nBSxvhuigdKRyFiEm6BZDgG"]; 20 | 21 | NSData* message = [@"attack at dawn" dataUsingEncoding:NSUTF8StringEncoding]; 22 | NSData* expectedCiphertext = BTCDataFromHex(@"0339e504d6492b082da96e11e8f039796b06cd4855c101e2492a6f10f3e056a9e712c732611c6917ab5c57a1926973bc44a1586e94a783f81d05ce72518d9b0a80e2e13c7ff7d1306583f9cc7a48def5b37fbf2d5f294f128472a6e9c78dede5f5"); 23 | 24 | NSData* ciphertext = [em encrypt:message]; 25 | NSAssert([ciphertext isEqual:expectedCiphertext], @"Must encrypt correctly"); 26 | 27 | 28 | // Must decrypt. 29 | 30 | NSData* plaintext = [em decrypt:expectedCiphertext]; 31 | NSAssert([plaintext isEqual:message], @"Must decrypt correctly"); 32 | } 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCEncryptedMessage.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | @class BTCKey; 6 | 7 | // Implementation of [ECIES](http://en.wikipedia.org/wiki/Integrated_Encryption_Scheme) 8 | // compatible with [Bitcore ECIES](https://github.com/bitpay/bitcore-ecies) implementation. 9 | @interface BTCEncryptedMessage : NSObject 10 | 11 | // When encrypting, sender's keypair must contain a private key. 12 | @property(nonatomic) BTCKey* senderKey; 13 | 14 | // When decrypting, recipient's keypair must contain a private key. 15 | @property(nonatomic) BTCKey* recipientKey; 16 | 17 | - (NSData*) encrypt:(NSData*)plaintext; 18 | - (NSData*) decrypt:(NSData*)ciphertext; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCErrors.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | extern NSString* const BTCErrorDomain; 6 | 7 | typedef NS_ENUM(NSUInteger, BTCErrorCode) { 8 | 9 | // Canonical pubkey/signature check errors 10 | BTCErrorNonCanonicalPublicKey = 4001, 11 | BTCErrorNonCanonicalScriptSignature = 4002, 12 | 13 | // Script verification errors 14 | BTCErrorScriptError = 5001, 15 | 16 | // BTCPriceSource errors 17 | BTCErrorUnsupportedCurrencyCode = 6001, 18 | 19 | // BIP70 Payment Protocol errors 20 | BTCErrorPaymentRequestInvalidResponse = 7001, 21 | BTCErrorPaymentRequestTooBig = 7002, 22 | 23 | // Secret Sharing errors 24 | BTCErrorIncompatibleSecret = 10001, 25 | BTCErrorInsufficientShares = 10002, 26 | BTCErrorMalformedShare = 10003, 27 | }; -------------------------------------------------------------------------------- /CoreBitcoin/BTCErrors.m: -------------------------------------------------------------------------------- 1 | #import "BTCErrors.h" 2 | 3 | NSString* const BTCErrorDomain = @"com.oleganza.CoreBitcoin"; 4 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCFancyEncryptedMessage+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // 4 | // BTCFancyEncryptedMessage+Tests.h 5 | // CoreBitcoin 6 | // 7 | // Created by Oleg Andreev on 21.06.2014. 8 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 9 | // 10 | 11 | #import "BTCFancyEncryptedMessage.h" 12 | 13 | @interface BTCFancyEncryptedMessage (Tests) 14 | 15 | + (void) runAllTests; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCHashID.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | /*! 6 | * Converts string transaction or block ID (reversed tx hash in hex format) to binary hash. 7 | */ 8 | NSData* BTCHashFromID(NSString* identifier); 9 | 10 | /*! 11 | * Converts hash of the transaction or block to its string ID (reversed hash in hex format). 12 | */ 13 | NSString* BTCIDFromHash(NSData* hash); 14 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCHashID.m: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCHashID.h" 4 | #import "BTCData.h" 5 | 6 | NSData* BTCHashFromID(NSString* identifier) { 7 | return BTCReversedData(BTCDataFromHex(identifier)); 8 | } 9 | 10 | NSString* BTCIDFromHash(NSData* hash) { 11 | return BTCHexFromData(BTCReversedData(hash)); 12 | } 13 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCKey+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCKey.h" 4 | 5 | @interface BTCKey (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCKeychain+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCKeychain.h" 4 | 5 | @interface BTCKeychain (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCMerkleTree+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCMerkleTree.h" 4 | 5 | @interface BTCMerkleTree (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCMerkleTree+Tests.m: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCData.h" 4 | #import "BTCMerkleTree+Tests.h" 5 | 6 | @implementation BTCMerkleTree (Tests) 7 | 8 | + (void) runAllTests { 9 | 10 | { 11 | BTCMerkleTree* tree = [[BTCMerkleTree alloc] initWithHashes:nil]; 12 | NSAssert(tree == nil, @"Empty tree is not allowed"); 13 | } 14 | 15 | { 16 | BTCMerkleTree* tree = [[BTCMerkleTree alloc] initWithHashes:@[]]; 17 | NSAssert(tree == nil, @"Empty tree is not allowed"); 18 | } 19 | 20 | { 21 | NSData* a = BTCDataFromHex(@"5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456"); 22 | BTCMerkleTree* tree = [[BTCMerkleTree alloc] initWithHashes:@[a]]; 23 | NSAssert([tree.merkleRoot isEqual:a], @"One-hash tree should have the root == that hash"); 24 | } 25 | 26 | { 27 | NSData* a = BTCDataFromHex(@"9c2e4d8fe97d881430de4e754b4205b9c27ce96715231cffc4337340cb110280"); 28 | NSData* b = BTCDataFromHex(@"0c08173828583fc6ecd6ecdbcca7b6939c49c242ad5107e39deb7b0a5996b903"); 29 | NSData* r = BTCDataFromHex(@"7de236613dd3d9fa1d86054a84952f1e0df2f130546b394a4d4dd7b76997f607"); 30 | BTCMerkleTree* tree = [[BTCMerkleTree alloc] initWithHashes:@[a, b]]; 31 | NSAssert([tree.merkleRoot isEqual:r], @"Two-hash tree should have the root == Hash(a+b)"); 32 | } 33 | 34 | { 35 | NSData* a = BTCDataFromHex(@"9c2e4d8fe97d881430de4e754b4205b9c27ce96715231cffc4337340cb110280"); 36 | NSData* b = BTCDataFromHex(@"0c08173828583fc6ecd6ecdbcca7b6939c49c242ad5107e39deb7b0a5996b903"); 37 | NSData* c = BTCDataFromHex(@"80903da4e6bbdf96e8ff6fc3966b0cfd355c7e860bdd1caa8e4722d9230e40ac"); 38 | NSData* r = BTCDataFromHex(@"5b7534123197114fa7e7459075f39d89ffab74b5c3f31fad48a025b931ff5a01"); 39 | BTCMerkleTree* tree = [[BTCMerkleTree alloc] initWithHashes:@[a, b, c]]; 40 | NSAssert([tree.merkleRoot isEqual:r], @"Root(a,b,c) == Hash(Hash(a+b)+Hash(c+c))"); 41 | } 42 | 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCMerkleTree.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | @interface BTCMerkleTree : NSObject 6 | 7 | // Returns the merkle root of the tree, a 256-bit hash. 8 | @property(nonatomic, readonly) NSData* merkleRoot; 9 | 10 | // Returns YES if the merkle tree has duplicate items in the tail that cause merkle root collision. 11 | // See also CVE-2012-2459. 12 | @property(nonatomic, readonly) BOOL hasTailDuplicates; 13 | 14 | // Builds a merkle tree based on raw hashes. 15 | - (id) initWithHashes:(NSArray*)hashes; 16 | 17 | // Builds a merkle tree based on transaction hashes. 18 | - (id) initWithTransactions:(NSArray* /* [BTCTransaction] */)transactions; 19 | 20 | // Builds a merkle tree based on BTCHash256 hashes of each NSData item. 21 | - (id) initWithDataItems:(NSArray* /* [NSData] */)dataItems; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCMnemonic+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCMnemonic.h" 4 | 5 | @interface BTCMnemonic (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCNetwork.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import "BTC256.h" 5 | 6 | @class BTCBigNumber; 7 | @class BTCBlock; 8 | @interface BTCNetwork : NSObject 9 | 10 | - (id) initWithName:(NSString*)name; 11 | 12 | // Available networks 13 | 14 | // Main Bitcoin network, singleton instance. 15 | + (BTCNetwork*) mainnet; 16 | 17 | // Testnet3 (current testnet), singleton instance. 18 | + (BTCNetwork*) testnet; 19 | 20 | 21 | 22 | // Network Parameters 23 | // Note: all properties are writable so you can tweak parameters for testing purposes. 24 | // If you do so, you may want to use -copy. 25 | 26 | 27 | // Returns YES if this network is testnet3 (used to tweak certain validation rules). 28 | @property(nonatomic, readonly) BOOL isTestnet; 29 | 30 | // Returns opposite of `isTestnet`. 31 | @property(nonatomic, readonly) BOOL isMainnet; 32 | 33 | // Name of the network ("mainnet", "testnet3" etc) 34 | @property(nonatomic, copy) NSString* name; 35 | 36 | // Name of the network for BIP70 Payment Details ("main", "test" or some custom name used in `-initWithName:`) 37 | @property(nonatomic, copy) NSString* paymentProtocolName; 38 | 39 | // Hash of the genesis block. 40 | @property(nonatomic) NSData* genesisBlockHash; 41 | 42 | // Default port for TCP connections. 43 | @property(nonatomic) uint32_t defaultPort; 44 | 45 | // Maximum target for the proof of work: CBigNum(~uint256(0) >> 32) for mainnet. 46 | @property(nonatomic) BTCBigNumber* proofOfWorkLimit; 47 | 48 | // Array of pairs @[ @(int ), NSData* ] sorted by height. 49 | @property(nonatomic) NSArray* checkpoints; 50 | 51 | 52 | // Returns a checkpoint hash if it exists or BTC256Zero if there is no checkpoint at such height. 53 | - (NSData*) checkpointAtHeight:(int)height; 54 | 55 | // Returns height of checkpoint or -1 if there is no such checkpoint. 56 | - (int) heightForCheckpoint:(NSData*)checkpointHash; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCOutpoint.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // Outpoint is a reference to a transaction output (byt tx hash and output index). 6 | // It is a part of BTCTransactionInput. 7 | @interface BTCOutpoint : NSObject 8 | 9 | // Hash of the previous transaction. 10 | @property(nonatomic) NSData* txHash; 11 | 12 | // Transaction ID referenced by this input (reversed txHash in hex). 13 | @property(nonatomic) NSString* txID; 14 | 15 | // Index of the previous transaction's output. 16 | @property(nonatomic) uint32_t index; 17 | 18 | - (id) initWithHash:(NSData*)hash index:(uint32_t)index; 19 | 20 | - (id) initWithTxID:(NSString*)txid index:(uint32_t)index; 21 | 22 | @end -------------------------------------------------------------------------------- /CoreBitcoin/BTCOutpoint.m: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCOutpoint.h" 4 | #import "BTCTransaction.h" 5 | #import "BTCHashID.h" 6 | 7 | @implementation BTCOutpoint 8 | 9 | - (id) initWithHash:(NSData*)hash index:(uint32_t)index { 10 | if (hash.length != 32) return nil; 11 | if (self = [super init]) { 12 | _txHash = hash; 13 | _index = index; 14 | } 15 | return self; 16 | } 17 | 18 | - (id) initWithTxID:(NSString*)txid index:(uint32_t)index { 19 | NSData* hash = BTCHashFromID(txid); 20 | return [self initWithHash:hash index:index]; 21 | } 22 | 23 | - (NSString*) txID { 24 | return BTCIDFromHash(self.txHash); 25 | } 26 | 27 | - (void) setTxID:(NSString *)txID { 28 | self.txHash = BTCHashFromID(txID); 29 | } 30 | 31 | - (NSUInteger) hash { 32 | const NSUInteger* words = _txHash.bytes; 33 | return words[0] + self.index; 34 | } 35 | 36 | - (BOOL) isEqual:(BTCOutpoint*)object { 37 | return [self.txHash isEqual:object.txHash] && self.index == object.index; 38 | } 39 | 40 | - (id) copyWithZone:(NSZone *)zone { 41 | return [[BTCOutpoint alloc] initWithHash:_txHash index:_index]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCPaymentMethod.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import "BTCUnitsAndLimits.h" 5 | 6 | @class BTCAssetID; 7 | @class BTCPaymentMethodItem; 8 | @class BTCPaymentMethodAsset; 9 | @class BTCPaymentMethodRejection; 10 | @class BTCPaymentMethodRejectedAsset; 11 | 12 | // Reply by the user: payment_method, methods per item, assets per method. 13 | @interface BTCPaymentMethod : NSObject 14 | 15 | @property(nonatomic, nullable) NSData* merchantData; 16 | @property(nonatomic, nullable) NSArray* /* [BTCPaymentMethodItem] */ items; 17 | 18 | // Binary serialization in protocol buffer format. 19 | @property(nonatomic, readonly, nonnull) NSData* data; 20 | 21 | - (nullable id) initWithData:(nullable NSData*)data; 22 | @end 23 | 24 | 25 | 26 | 27 | 28 | // Proposed method to pay for a given item 29 | @interface BTCPaymentMethodItem : NSObject 30 | 31 | @property(nonatomic, nonnull) NSString* itemType; 32 | @property(nonatomic, nullable) NSData* itemIdentifier; 33 | @property(nonatomic, nullable) NSArray* /* [BTCPaymentMethodAsset] */ assets; 34 | 35 | // Binary serialization in protocol buffer format. 36 | @property(nonatomic, readonly, nonnull) NSData* data; 37 | 38 | - (nullable id) initWithData:(nullable NSData*)data; 39 | @end 40 | 41 | 42 | 43 | 44 | 45 | // Proposed asset and amount within BTCPaymentMethodItem. 46 | @interface BTCPaymentMethodAsset : NSObject 47 | 48 | @property(nonatomic, nullable) NSString* assetType; // BTCAssetTypeBitcoin or BTCAssetTypeOpenAssets 49 | @property(nonatomic, nullable) BTCAssetID* assetID; // nil if type is "bitcoin". 50 | @property(nonatomic) BTCAmount amount; 51 | 52 | // Binary serialization in protocol buffer format. 53 | @property(nonatomic, readonly, nonnull) NSData* data; 54 | 55 | - (nullable id) initWithData:(nullable NSData*)data; 56 | @end 57 | 58 | 59 | 60 | 61 | 62 | 63 | // Rejection reply by the server: rejection summary and per-asset rejection info. 64 | 65 | 66 | @interface BTCPaymentMethodRejection : NSObject 67 | 68 | @property(nonatomic, nullable) NSString* memo; 69 | @property(nonatomic) uint64_t code; 70 | @property(nonatomic, nullable) NSArray* /* [BTCPaymentMethodRejectedAsset] */ rejectedAssets; 71 | 72 | // Binary serialization in protocol buffer format. 73 | @property(nonatomic, readonly, nonnull) NSData* data; 74 | 75 | - (nullable id) initWithData:(nullable NSData*)data; 76 | @end 77 | 78 | 79 | @interface BTCPaymentMethodRejectedAsset : NSObject 80 | 81 | @property(nonatomic, nonnull) NSString* assetType; // BTCAssetTypeBitcoin or BTCAssetTypeOpenAssets 82 | @property(nonatomic, nullable) BTCAssetID* assetID; // nil if type is "bitcoin". 83 | @property(nonatomic) uint64_t code; 84 | @property(nonatomic, nullable) NSString* reason; 85 | 86 | // Binary serialization in protocol buffer format. 87 | @property(nonatomic, readonly, nonnull) NSData* data; 88 | 89 | - (nullable id) initWithData:(nullable NSData*)data; 90 | @end 91 | 92 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCPriceSource+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCPriceSource.h" 4 | 5 | @interface BTCPriceSource (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCPriceSource+Tests.m: -------------------------------------------------------------------------------- 1 | #import "BTCPriceSource+Tests.h" 2 | 3 | @implementation BTCPriceSource (Tests) 4 | 5 | + (void) runAllTests { 6 | 7 | BTCPriceSourceCoindesk* coindesk = [[BTCPriceSourceCoindesk alloc] init]; 8 | NSAssert([coindesk.name.lowercaseString containsString:@"coindesk"], @"should be named coindesk"); 9 | NSAssert([coindesk.currencyCodes containsObject:@"USD"], @"should contain USD"); 10 | NSAssert([coindesk.currencyCodes containsObject:@"EUR"], @"should contain EUR"); 11 | [self validatePrice:[coindesk loadPriceForCurrency:@"USD" error:NULL] min:100 max:10000]; 12 | [self validatePrice:[coindesk loadPriceForCurrency:@"EUR" error:NULL] min:100 max:10000]; 13 | 14 | BTCPriceSourceWinkdex* winkdex = [[BTCPriceSourceWinkdex alloc] init]; 15 | NSAssert([winkdex.name.lowercaseString containsString:@"wink"], @"should be named properly"); 16 | NSAssert([winkdex.currencyCodes containsObject:@"USD"], @"should contain USD"); 17 | [self validatePrice:[winkdex loadPriceForCurrency:@"USD" error:NULL] min:100 max:10000]; 18 | 19 | BTCPriceSourceCoinbase* coinbase = [[BTCPriceSourceCoinbase alloc] init]; 20 | NSAssert([coinbase.name.lowercaseString containsString:@"coinbase"], @"should be named properly"); 21 | NSAssert([coinbase.currencyCodes containsObject:@"USD"], @"should contain USD"); 22 | [self validatePrice:[coinbase loadPriceForCurrency:@"USD" error:NULL] min:100 max:10000]; 23 | 24 | BTCPriceSourcePaymium* paymium = [[BTCPriceSourcePaymium alloc] init]; 25 | NSAssert([paymium.name.lowercaseString containsString:@"paymium"], @"should be named properly"); 26 | NSAssert([paymium.currencyCodes containsObject:@"EUR"], @"should contain EUR"); 27 | [self validatePrice:[paymium loadPriceForCurrency:@"EUR" error:NULL] min:100 max:10000]; 28 | } 29 | 30 | + (void) validatePrice:(BTCPriceSourceResult*)result min:(double)minValue max:(double)maxValue { 31 | NSNumber* number = result.averageRate; 32 | // NSLog(@"price = %@ %@", number, result.currencyCode); 33 | NSAssert(result, @"result should not be nil"); 34 | NSAssert(result.date, @"date should not be nil"); 35 | NSAssert(number, @"averageRate should not be nil"); 36 | NSAssert(number.floatValue >= minValue, @"Must be over minimum value"); 37 | NSAssert(number.floatValue <= maxValue, @"Must be over minimum value"); 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCProtocolBuffers.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // An API to parse and encode protocol buffers. 6 | @interface BTCProtocolBuffers : NSObject 7 | 8 | // Reading 9 | 10 | // Returns a variable-length integer value at a given offset in source data. 11 | + (uint64_t) varIntAtOffset:(NSInteger*)offset fromData:(NSData*)src; 12 | 13 | // Returns a length-delimited data at a given offset in source data. 14 | + (NSData *) lenghtDelimitedDataAtOffset:(NSInteger *)offset fromData:(NSData*)src; 15 | 16 | // Returns either int or data depending on field type, and returns a field key. 17 | + (NSInteger) fieldAtOffset:(NSInteger *)offset int:(uint64_t *)i data:(NSData **)d fromData:(NSData*)src; 18 | 19 | // Returns either int or fixed64 or data depending on field type, and returns a field key. 20 | + (NSInteger) fieldAtOffset:(NSInteger *)offset int:(uint64_t *)i fixed32:(uint32_t *)fixed32 fixed64:(uint64_t *)fixed64 data:(NSData **)d fromData:(NSData*)src; 21 | 22 | // Writing 23 | 24 | + (void) writeInt:(uint64_t)i withKey:(NSInteger)key toData:(NSMutableData*)dst; 25 | + (void) writeFixed32:(uint32_t)i withKey:(NSInteger)key toData:(NSMutableData*)dst; 26 | + (void) writeFixed64:(uint64_t)i withKey:(NSInteger)key toData:(NSMutableData*)dst; 27 | + (void) writeLengthDelimitedData:(NSData*)data toData:(NSMutableData*)dst; 28 | + (void) writeData:(NSData*)d withKey:(NSInteger)key toData:(NSMutableData*)dst; 29 | + (void) writeString:(NSString*)string withKey:(NSInteger)key toData:(NSMutableData*)dst; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCProtocolSerialization+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCProtocolSerialization.h" 4 | 5 | @interface BTCProtocolSerialization (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCProtocolSerialization+Tests.m: -------------------------------------------------------------------------------- 1 | // Oleg Andreev 2 | 3 | #import "BTCProtocolSerialization+Tests.h" 4 | #import "BTCData.h" 5 | 6 | @implementation BTCProtocolSerialization (Tests) 7 | 8 | + (void) assertNumber:(uint64_t)number serializesToHex:(NSString*)hexForm { 9 | NSUInteger requiredLength = hexForm.length / 2; 10 | 11 | NSData* data = [BTCProtocolSerialization dataForVarInt:number]; 12 | //NSLog(@"data = %@", data); 13 | NSAssert([data isEqualToData:BTCDataFromHex(hexForm)], @"Should encode correctly"); 14 | uint64_t value = 0; 15 | NSUInteger len = [BTCProtocolSerialization readVarInt:&value fromData:data]; 16 | NSAssert(len == requiredLength, @"Should read correct number of bytes"); 17 | NSAssert(value == number, @"Should read original value"); 18 | 19 | NSInputStream* stream = [NSInputStream inputStreamWithData:data]; 20 | [stream open]; 21 | len = [BTCProtocolSerialization readVarInt:&value fromStream:stream]; 22 | [stream close]; 23 | NSAssert(len == requiredLength, @"Should read 1 byte"); 24 | NSAssert(value == number, @"Should read original value"); 25 | } 26 | 27 | + (void) runAllTests { 28 | [self assertNumber:0 serializesToHex:@"00"]; 29 | [self assertNumber:252 serializesToHex:@"fc"]; 30 | [self assertNumber:255ULL serializesToHex:@"fdff00"]; 31 | [self assertNumber:12345ULL serializesToHex:@"fd3930"]; 32 | [self assertNumber:65535ULL serializesToHex:@"fdffff"]; 33 | [self assertNumber:65536ULL serializesToHex:@"fe00000100"]; 34 | [self assertNumber:1234567890ULL serializesToHex:@"fed2029649"]; 35 | [self assertNumber:1234567890123ULL serializesToHex:@"ffcb04fb711f010000"]; 36 | [self assertNumber:UINT64_MAX serializesToHex:@"ffffffffffffffffff"]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCProtocolSerialization.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // A collection of routines dealing with parsing and writing various protocol messages. 6 | @interface BTCProtocolSerialization : NSObject 7 | 8 | // This implementation of variable-length integer is known as "CompactSize" in Satoshi code (BitcoinQT). 9 | // 10 | // Value Storage length Format 11 | // < 0xfd 1 uint8_t 12 | // <= 0xffff 3 0xfd followed by the value as uint16_t 13 | // <= 0xffffffff 5 0xfe followed by the value as uint32_t 14 | // > 0xffffffff 9 0xff followed by the value as uint64_t 15 | // 16 | // Note: BitcoinQT later added VarInt which is different, more compact format 17 | // used in block storage. VarInt is not a part of the protocol and is not implemented here. 18 | 19 | // Attempts to read integer from data and returns amount of bytes read. 20 | // In case of error, returns 0. 21 | + (NSUInteger) readVarInt:(uint64_t*)valueOut fromData:(NSData*)data; 22 | + (NSUInteger) readVarInt:(uint64_t*)valueOut fromStream:(NSInputStream*)stream; 23 | 24 | // Attempts to read string prepended by its length in varInt format. 25 | // On success, returns data. On failure, returns nil. 26 | // lengthOut is an optional out parameter that contains total bytes read (including the length prefix) 27 | + (NSData*) readVarStringFromData:(NSData*)data; 28 | + (NSData*) readVarStringFromData:(NSData*)data readBytes:(NSUInteger*)lengthOut; 29 | + (NSData*) readVarStringFromStream:(NSInputStream*)stream; 30 | 31 | // Encodes value in a varint binary form. 32 | + (NSData*) dataForVarInt:(uint64_t)value; 33 | 34 | // Prepends binary string with its length in varInt format. 35 | + (NSData*) dataForVarString:(NSData*)binaryString; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCQRCode.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #if TARGET_OS_IPHONE 5 | #import 6 | #import 7 | #endif 8 | 9 | @interface BTCQRCode : NSObject 10 | 11 | #if TARGET_OS_IPHONE 12 | /*! 13 | * Returns a QR code image with a given size. 14 | * The `string` is typically a bitcoin address in Base58Check format. 15 | */ 16 | + (UIImage*) imageForString:(NSString*)string size:(CGSize)size scale:(CGFloat)scale; 17 | 18 | /*! 19 | * Returns a QR code image with a given size. 20 | * The `url` is typically a bitcoin payment request "bitcoin:
?amount=..." 21 | */ 22 | + (UIImage*) imageForURL:(NSURL*)url size:(CGSize)size scale:(CGFloat)scale; 23 | 24 | /*! 25 | * Returns a scanning view and retains a detection block. 26 | * 27 | * Block is called for every QR code detected. To stop recognition, remove view from the window. 28 | * 29 | * Block is released when view is removed from window. 30 | */ 31 | + (UIView*) scannerViewWithBlock:(void(^)(NSString* message))detectionBlock; 32 | 33 | 34 | /*! 35 | * Returns a scanning view and retains a detection block. 36 | * 37 | * Block is called for every QR code detected. To stop recognition, remove view from the window. 38 | * 39 | * Block is released when view is removed from window. 40 | * 41 | * The device position helps selecting the camera (front or back) 42 | */ 43 | + (UIView*) scannerViewUsingDevice:(AVCaptureDevicePosition) devicePosition 44 | orientation:(AVCaptureVideoOrientation) orientation 45 | block:(void(^)(NSString* message))detectionBlock; 46 | #endif 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCScript+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import "BTCScript.h" 4 | 5 | @interface BTCScript (Tests) 6 | 7 | + (void) runAllTests; 8 | 9 | + (NSArray*) invalidBitcoinQTScripts; 10 | + (NSArray*) validBitcoinQTScripts; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCSecretSharing.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | typedef NS_ENUM(NSInteger, BTCSecretSharingVersion) { 6 | // Identifies configuration for compact 128-bit secrets with up to 16 shares. 7 | BTCSecretSharingVersionCompact96 = 96, 8 | BTCSecretSharingVersionCompact104 = 104, 9 | BTCSecretSharingVersionCompact128 = 128, 10 | }; 11 | 12 | @class BTCBigNumber; 13 | @interface BTCSecretSharing : NSObject 14 | 15 | @property(nonatomic, readonly) BTCSecretSharingVersion version; 16 | @property(nonatomic, readonly, nonnull) BTCBigNumber* order; 17 | @property(nonatomic, readonly) NSInteger bitlength; 18 | 19 | - (id __nonnull) initWithVersion:(BTCSecretSharingVersion)version; 20 | 21 | - (NSArray* __nullable) splitSecret:(NSData* __nonnull)secret threshold:(NSInteger)m shares:(NSInteger)n error:(NSError* __nullable * __nullable)errorOut; 22 | 23 | - (NSData* __nullable) joinShares:(NSArray* __nonnull)shares error:(NSError* __nullable * __nullable)errorOut; 24 | 25 | @end -------------------------------------------------------------------------------- /CoreBitcoin/BTCSignatureHashType.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #ifndef CoreBitcoin_BTCSignatureHashType_h 4 | #define CoreBitcoin_BTCSignatureHashType_h 5 | 6 | // Hash type determines how OP_CHECKSIG hashes the transaction to create or 7 | // verify the signature in a transaction input. 8 | // Depending on hash type, transaction is modified in some way before its hash is computed. 9 | // Hash type is 1 byte appended to a signature in a transaction input. 10 | typedef NS_ENUM(unsigned char, BTCSignatureHashType) 11 | { 12 | // First three types are mutually exclusive (tested using "type & 0x1F"). 13 | 14 | // Default. Signs all inputs and outputs. 15 | // Other inputs have scripts and sequences zeroed out, current input has its script 16 | // replaced by the previous transaction's output script (or, in case of P2SH, 17 | // by the signatures and the redemption script). 18 | // If (type & 0x1F) is not NONE or SINGLE, then this type is used. 19 | SIGHASH_ALL = 1, 20 | BTCSignatureHashTypeAll = SIGHASH_ALL, 21 | 22 | // All outputs are removed. "I don't care where it goes as long as others pay". 23 | // Note: this is not safe when used with ANYONECANPAY, because then anyone who relays the transaction 24 | // can pick your input and use in his own transaction. 25 | // It's also not safe if all inputs are SIGHASH_NONE as well (or it's the only input). 26 | SIGHASH_NONE = 2, 27 | BTCSignatureHashTypeNone = SIGHASH_NONE, 28 | 29 | // Hash only the output with the same index as the current input. 30 | // Preceding outputs are "nullified", other outputs are removed. 31 | // Special case: if there is no matching output, hash is "0000000000000000000000000000000000000000000000000000000000000001" (32 bytes) 32 | SIGHASH_SINGLE = 3, 33 | BTCSignatureHashTypeSingle = SIGHASH_SINGLE, 34 | 35 | // This mask is used to determine one of the first types independently from ANYONECANPAY option: 36 | // E.g. if (type & SIGHASH_OUTPUT_MASK == SIGHASH_NONE) { blank all outputs } 37 | SIGHASH_OUTPUT_MASK = 0x1F, 38 | BTCSignatureHashTypeOutputMask = SIGHASH_OUTPUT_MASK, 39 | 40 | // Removes all inputs except for current txin before hashing. 41 | // This allows to sign the transaction outputs without knowing who and how adds other inputs. 42 | // E.g. a crowdfunding transaction with 100 BTC output can be signed independently by any number of people 43 | // and will become valid only when someone combines all inputs in a single transaction to make it valid. 44 | // Can be used together with any of the above types. 45 | SIGHASH_ANYONECANPAY = 0x80, 46 | BTCSignatureHashTypeAnyoneCanPay = SIGHASH_ANYONECANPAY, 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /CoreBitcoin/BTCTransaction+Tests.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // 4 | // BTCTransaction+Tests.h 5 | // CoreBitcoin 6 | // 7 | // Created by Oleg Andreev on 24.01.2014. 8 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 9 | // 10 | 11 | #import "BTCTransaction.h" 12 | 13 | @interface BTCTransaction (Tests) 14 | 15 | + (void) runAllTests; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CoreBitcoin/CoreBitcoin+Categories.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import 5 | #import 6 | -------------------------------------------------------------------------------- /CoreBitcoin/CoreBitcoin.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import 5 | #import 6 | #import 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #import 50 | #import 51 | #import 52 | #import 53 | -------------------------------------------------------------------------------- /CoreBitcoin/NS+BTCBase58.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import "BTCBase58.h" 5 | 6 | // These categories are optional and provided for convenience only. 7 | // For documentation look into BTCBase58.h. 8 | // They are also used in CoreBitcoin unit tests. 9 | @interface NSString (BTCBase58) 10 | 11 | // Returns data for Base58 string without checksum 12 | // Data is mutable so you can clear sensitive information as soon as possible. 13 | - (NSMutableData*) dataFromBase58; 14 | 15 | // Returns data for Base58 string with checksum 16 | - (NSMutableData*) dataFromBase58Check; 17 | 18 | @end 19 | 20 | @interface NSMutableData (BTCBase58) 21 | 22 | // Returns data for Base58 string without checksum 23 | // Data is mutable so you can clear sensitive information as soon as possible. 24 | + (NSMutableData*) dataFromBase58CString:(const char*)cstring; 25 | 26 | // Returns data for Base58 string with checksum 27 | + (NSMutableData*) dataFromBase58CheckCString:(const char*)cstring; 28 | 29 | @end 30 | 31 | @interface NSData (BTCBase58) 32 | 33 | // String in Base58 without checksum, you need to free it yourself. 34 | // It's mutable so you can clear it securely yourself. 35 | - (char*) base58CString; 36 | 37 | // String in Base58 with checksum, you need to free it yourself. 38 | // It's mutable so you can clear it securely yourself. 39 | - (char*) base58CheckCString; 40 | 41 | // String in Base58 without checksum 42 | - (NSString*) base58String; 43 | 44 | // String in Base58 with checksum 45 | - (NSString*) base58CheckString; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /CoreBitcoin/NS+BTCBase58.m: -------------------------------------------------------------------------------- 1 | // Oleg Andreev 2 | 3 | #import "NS+BTCBase58.h" 4 | 5 | // TODO. 6 | 7 | @implementation NSString (BTCBase58) 8 | 9 | - (NSMutableData*) dataFromBase58 { return BTCDataFromBase58(self); } 10 | - (NSMutableData*) dataFromBase58Check { return BTCDataFromBase58Check(self); } 11 | @end 12 | 13 | 14 | @implementation NSMutableData (BTCBase58) 15 | 16 | + (NSMutableData*) dataFromBase58CString:(const char*)cstring { 17 | return BTCDataFromBase58CString(cstring); 18 | } 19 | 20 | + (NSMutableData*) dataFromBase58CheckCString:(const char*)cstring { 21 | return BTCDataFromBase58CheckCString(cstring); 22 | } 23 | 24 | @end 25 | 26 | 27 | @implementation NSData (BTCBase58) 28 | 29 | - (char*) base58CString { 30 | return BTCBase58CStringWithData(self); 31 | } 32 | 33 | - (char*) base58CheckCString { 34 | return BTCBase58CheckCStringWithData(self); 35 | } 36 | 37 | - (NSString*) base58String { 38 | return BTCBase58StringWithData(self); 39 | } 40 | 41 | - (NSString*) base58CheckString { 42 | return BTCBase58CheckStringWithData(self); 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CoreBitcoin/NSData+BTCData.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import "BTCData.h" 5 | 6 | // This category is for user's convenience only. 7 | // For documentation look into BTCData.h. 8 | // If you link CoreBitcoin library without categories enabled, nothing will break. 9 | // This is also used in unit tests in CoreBitcoin. 10 | @interface NSData (BTCData) 11 | 12 | // Core hash functions 13 | - (NSData*) SHA1; 14 | - (NSData*) SHA256; 15 | - (NSData*) BTCHash256; // SHA256(SHA256(self)) aka Hash or Hash256 in BitcoinQT 16 | 17 | #if BTCDataRequiresOpenSSL 18 | - (NSData*) RIPEMD160; 19 | - (NSData*) BTCHash160; // RIPEMD160(SHA256(self)) aka Hash160 in BitcoinQT 20 | #endif 21 | 22 | // Formats data as a lowercase hex string 23 | - (NSString*) hex; 24 | - (NSString*) uppercaseHex; 25 | 26 | - (NSString*) hexString DEPRECATED_ATTRIBUTE; 27 | - (NSString*) hexUppercaseString DEPRECATED_ATTRIBUTE; 28 | 29 | 30 | // Encrypts/decrypts data using the key. 31 | // IV should either be nil or at least 128 bits long 32 | + (NSMutableData*) encryptData:(NSData*)data key:(NSData*)key iv:(NSData*)initializationVector; 33 | + (NSMutableData*) decryptData:(NSData*)data key:(NSData*)key iv:(NSData*)initializationVector; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CoreBitcoin/SwiftBridgingHeader.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | // 4 | // SwiftBridgingHeader.h 5 | // 6 | // 7 | 8 | #import "CoreBitcoin.h" 9 | #import "NSData+BTCData.h" 10 | #import "NS+BTCBase58.h" 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include -------------------------------------------------------------------------------- /CoreBitcoinIOS/CoreBitcoinIOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.oleganza.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | NO 29 | CFPlugInFactories 30 | 31 | CFPlugInTypes 32 | 33 | CFPlugInUnloadFunction 34 | 35 | NSHumanReadableCopyright 36 | CoreBitcoin by Oleg Andreev <oleganza@gmail.com>, WTFPL. 37 | 38 | 39 | -------------------------------------------------------------------------------- /CoreBitcoinIOS/CoreBitcoinIOS-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /CoreBitcoinIOS/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CoreBitcoinIOSlib/CoreBitcoinIOSlib-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /CoreBitcoinOSX/CoreBitcoinOSX-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.oleganza.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSHumanReadableCopyright 26 | CoreBitcoin by Oleg Andreev <oleganza@gmail.com>, WTFPL. 27 | NSPrincipalClass 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /CoreBitcoinOSX/CoreBitcoinOSX-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /CoreBitcoinOSX/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CoreBitcoinOSXlib/CoreBitcoinOSXlib-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/BTCBlockchainInfoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BTCBlockchainInfoTests.swift 3 | // CoreBitcoin 4 | // 5 | // Created by Robert S Mozayeni on 4/20/15. 6 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import XCTest 11 | 12 | class BTCBlockchainInfoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testEmptyUnspents() { 25 | 26 | do { 27 | let outputs = try BTCBlockchainInfo().unspentOutputsWithAddresses([BTCAddress(string: "1LKF45kfvHAaP7C4cF91pVb3bkAsmQ8nBr")!]) 28 | XCTAssert(outputs.count == 0, "should return an empty array") 29 | } catch { 30 | XCTFail("Error: \(error)") 31 | } 32 | 33 | } 34 | 35 | func testNonEmptyUnspents() { 36 | 37 | do { 38 | let outputs = try BTCBlockchainInfo().unspentOutputsWithAddresses([BTCAddress(string: "1CBtcGivXmHQ8ZqdPgeMfcpQNJrqTrSAcG")!]) 39 | XCTAssert(outputs.count > 0, "should return a non-empty array") 40 | XCTAssert((outputs.first as! BTCTransactionOutput?) != nil, "should contain BTCTransactionOutput objects") 41 | } catch { 42 | XCTFail("Error: \(error)") 43 | } 44 | 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/BTCCurrencyConverterTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BTCCurrencyConverterTests.swift 3 | // CoreBitcoin 4 | // 5 | // Created by Robert S Mozayeni on 5/19/15. 6 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import XCTest 11 | 12 | class BTCCurrencyConverterTests: XCTestCase { 13 | 14 | func testRateUpdates() { 15 | let converter = BTCCurrencyConverter() 16 | converter.buyRate = NSDecimalNumber(string: "210.0") 17 | converter.sellRate = NSDecimalNumber(string: "200.0") 18 | 19 | XCTAssertEqual(converter.averageRate.doubleValue, 205.0, "Average should be from buy and sell rates") 20 | 21 | converter.averageRate = NSDecimalNumber(string: "300.0") 22 | 23 | XCTAssertEqual(converter.sellRate.doubleValue, 300, "Setting average should reassign sell rate") 24 | XCTAssertEqual(converter.buyRate.doubleValue, 300, "Setting average should reassign buy rate") 25 | 26 | } 27 | 28 | func testAsksAndBids() { 29 | let converter = BTCCurrencyConverter() 30 | converter.buyRate = NSDecimalNumber(string: "210.0") 31 | converter.sellRate = NSDecimalNumber(string: "200.0") 32 | 33 | let asks = [[NSNumber(double: 209.0), NSNumber(double: 1.0)]] 34 | 35 | converter.asks = asks 36 | XCTAssertNotNil(converter.asks, "Should be valid ask array") 37 | 38 | let bids = [[NSNumber(double: 201.0), NSNumber(double: 1.0)]] 39 | 40 | converter.bids = bids 41 | XCTAssertNotNil(converter.bids, "Should be valid bids array") 42 | 43 | 44 | } 45 | 46 | func testFiatConversions() { 47 | let converter = BTCCurrencyConverter() 48 | converter.buyRate = NSDecimalNumber(string: "205.0") 49 | converter.sellRate = NSDecimalNumber(string: "195.0") 50 | 51 | 52 | 53 | converter.mode = BTCCurrencyConverterMode.Average 54 | let averageBTCAmount = converter.bitcoinFromFiat(NSDecimalNumber(string: "10.0")) 55 | 56 | XCTAssertEqual(averageBTCAmount, 5000000, "10.0 fiat with average BTC price of 200 should buy 5 million satoshis") 57 | 58 | 59 | 60 | converter.mode = BTCCurrencyConverterMode.Buy 61 | let buyBTCAmount = converter.bitcoinFromFiat(NSDecimalNumber(string: "10.0")) 62 | 63 | XCTAssertEqual(buyBTCAmount, 4878049, "10.0 fiat with buy rate of 205 should buy 4878049 satoshis") 64 | 65 | 66 | 67 | converter.mode = BTCCurrencyConverterMode.Sell 68 | let sellBTCAmount = converter.bitcoinFromFiat(NSDecimalNumber(string: "10.0")) 69 | XCTAssertEqual(sellBTCAmount, 5128205, "10.0 fiat with sell rate of 195 should convert to 5128205 satoshis") 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/BTCEncryptedMessageTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BTCEncryptedMessageTests.swift 3 | // CoreBitcoin 4 | // 5 | // Created by Robert S Mozayeni on 12/6/15. 6 | // Copyright © 2015 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class BTCEncryptedMessageTests: XCTestCase { 12 | 13 | func testAll() { 14 | let em = BTCEncryptedMessage() 15 | em.senderKey = BTCKey(WIF: "L1Ejc5dAigm5XrM3mNptMEsNnHzS7s51YxU7J61ewGshZTKkbmzJ") 16 | em.recipientKey = BTCKey(WIF: "KxfxrUXSMjJQcb3JgnaaA6MqsrKQ1nBSxvhuigdKRyFiEm6BZDgG") 17 | 18 | let message = "attack at dawn".dataUsingEncoding(NSUTF8StringEncoding) 19 | let expectedCiphertext = BTCDataFromHex("0339e504d6492b082da96e11e8f039796b06cd4855c101e2492a6f10f3e056a9e712c732611c6917ab5c57a1926973bc44a1586e94a783f81d05ce72518d9b0a80e2e13c7ff7d1306583f9cc7a48def5b37fbf2d5f294f128472a6e9c78dede5f5") 20 | 21 | let ciphertext = em.encrypt(message) 22 | XCTAssertEqual(ciphertext, expectedCiphertext, "Must encrypt correctly") 23 | 24 | //Must decrypt 25 | let plaintext = em.decrypt(expectedCiphertext) 26 | XCTAssertEqual(plaintext, message, "Must decrypt correctly") 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/BTCMerkleTreeTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BTCMerkleTreeTests.swift 3 | // CoreBitcoin 4 | // 5 | // Created by Robert S Mozayeni on 12/6/15. 6 | // Copyright © 2015 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class BTCMerkleTreeTests: XCTestCase { 12 | 13 | func testAll() { 14 | 15 | do { 16 | let tree = BTCMerkleTree(hashes: nil) 17 | XCTAssertNil(tree, "Empty tree is not allowed") 18 | } 19 | 20 | do { 21 | let tree = BTCMerkleTree(hashes: []) 22 | XCTAssertNil(tree, "Empty tree is not allowed") 23 | } 24 | 25 | do { 26 | let a = BTCDataFromHex("5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456") 27 | let tree = BTCMerkleTree(hashes: [a]) 28 | XCTAssertEqual(tree.merkleRoot, a, "One-hash tree should have the root == that hash") 29 | } 30 | 31 | do { 32 | let a = BTCDataFromHex("9c2e4d8fe97d881430de4e754b4205b9c27ce96715231cffc4337340cb110280") 33 | let b = BTCDataFromHex("0c08173828583fc6ecd6ecdbcca7b6939c49c242ad5107e39deb7b0a5996b903") 34 | let r = BTCDataFromHex("7de236613dd3d9fa1d86054a84952f1e0df2f130546b394a4d4dd7b76997f607") 35 | let tree = BTCMerkleTree(hashes: [a,b]) 36 | XCTAssertEqual(tree.merkleRoot, r, "Two-hash tree should have the root == Hash(a+b)") 37 | } 38 | 39 | do { 40 | let a = BTCDataFromHex("9c2e4d8fe97d881430de4e754b4205b9c27ce96715231cffc4337340cb110280") 41 | let b = BTCDataFromHex("0c08173828583fc6ecd6ecdbcca7b6939c49c242ad5107e39deb7b0a5996b903") 42 | let c = BTCDataFromHex("80903da4e6bbdf96e8ff6fc3966b0cfd355c7e860bdd1caa8e4722d9230e40ac") 43 | let r = BTCDataFromHex("5b7534123197114fa7e7459075f39d89ffab74b5c3f31fad48a025b931ff5a01") 44 | let tree = BTCMerkleTree(hashes: [a,b,c]) 45 | XCTAssertEqual(tree.merkleRoot, r, "Root(a,b,c) == Hash(Hash(a+b)+Hash(c+c))") 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/BTCPaymentProtocolTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BTCPaymentProtocolTests.swift 3 | // CoreBitcoin 4 | // 5 | // Created by Oleg Andreev on 03.06.2015. 6 | // Copyright (c) 2015 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import XCTest 11 | 12 | class BTCPaymentProtocolTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testOpenAssetsPaymentRequestDetails() { 25 | 26 | let pr = BTCPaymentDetails(data: BTCDataFromHex("121c0888271217a914bb22ad9011886eef754e2be30931f6cd89d13a668712371217a914278f4f9e5c8b2bbbcabd0711a84730c0317c9374878afa0114346282702ba85eda1796a580aa318034308a27c490fa01a09c0118c1cdbda60520a0f6bea6052a0e74686973206973206120746573743211687474703a2f2f676f6f676c652e636f6d42240a20807164529ec1b7866d7801d7dbc34edc326a991633573b549116c62dfd9b4f4f1000"))! 27 | 28 | XCTAssertEqual(pr.memo!, "this is a test", "Memo should be present") 29 | XCTAssertEqual(pr.paymentURL!.absoluteString, "http://google.com", "Payment URL should be google.com") 30 | XCTAssertEqual(pr.inputs.count, 1, "Has 1 input") 31 | XCTAssertEqual(pr.outputs.count, 2, "Has 2 outputs") 32 | 33 | let in1 = pr.inputs[0] as! BTCTransactionInput 34 | let out1 = pr.outputs[0] as! BTCTransactionOutput 35 | let out2 = pr.outputs[1] as! BTCTransactionOutput 36 | 37 | XCTAssertEqual(in1.previousIndex, 0, "First input has output index 0") 38 | XCTAssertEqual(BTCHexFromData(in1.previousHash), "807164529ec1b7866d7801d7dbc34edc326a991633573b549116c62dfd9b4f4f", "First input has output txid 807164529...") 39 | 40 | XCTAssertEqual(pr.outputs.map{$0.script!.standardAddress.string}, ["3JkVptF3n9VS6FGR6NjrEr8NnUCh4TPvMs", "35JBxSyefxmVj34obKC2od3r98MuaJ34am"], "Outputs should have P2SH addresses") 41 | 42 | XCTAssertEqual(out1.value, 5000, "First output has 5000") 43 | XCTAssert(out1.userInfo["assetID"] == nil, "First output has no asset info") 44 | XCTAssert(out1.userInfo["assetAmount"] == nil, "First output has no asset info") 45 | 46 | XCTAssertEqual(out2.value, BTCUnspecifiedPaymentAmount, "Second output has no amount specified") 47 | XCTAssertEqual((out2.userInfo["assetID"]! as! BTCAssetID).string, "ALYro2zndzUpPKcZXXqSYE1npuM4ycY1MA", "Second output has asset ID ALYro2...") 48 | XCTAssertEqual(out2.userInfo["assetAmount"]! as? Int, 20000, "Second output has asset amount 1234") 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/BTCProtocolSerializationTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BTCProtocolSerializationTests.swift 3 | // CoreBitcoin 4 | // 5 | // Created by Robert S Mozayeni on 12/6/15. 6 | // Copyright © 2015 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import Foundation 11 | 12 | class BTCProtocolSerializationTests: XCTestCase { 13 | 14 | 15 | func assertNumber(number: UInt64, serializesToHex hexForm: String) { //Using NSString because an Xcode bug is preventing String.count from being used 16 | let requiredLength = (hexForm as NSString).length / 2 17 | let data = BTCProtocolSerialization.dataForVarInt(number) 18 | print("data = \(data)") 19 | XCTAssertEqual(data, BTCDataFromHex(hexForm), "Should encode correctly") 20 | var value: UInt64 = 0 21 | var len = BTCProtocolSerialization.readVarInt(&value, fromData: data) 22 | XCTAssertEqual(Int(len), requiredLength, "Should read correct number of bytes") 23 | XCTAssertEqual(value, number, "Should read original value") 24 | 25 | let stream = NSInputStream(data: data) 26 | stream.open() 27 | len = BTCProtocolSerialization.readVarInt(&value, fromStream: stream) 28 | stream.close() 29 | XCTAssertEqual(Int(len), requiredLength, "Should read 1 byte") 30 | XCTAssertEqual(value, number, "Should read original value") 31 | } 32 | 33 | func testAll() { 34 | self.assertNumber(0, serializesToHex: "00") 35 | self.assertNumber(252, serializesToHex: "fc") 36 | self.assertNumber(CUnsignedLongLong(255), serializesToHex: "fdff00") 37 | self.assertNumber(CUnsignedLongLong(12345), serializesToHex: "fd3930") 38 | self.assertNumber(CUnsignedLongLong(65535), serializesToHex: "fdffff") 39 | self.assertNumber(CUnsignedLongLong(65536), serializesToHex: "fe00000100") 40 | self.assertNumber(CUnsignedLongLong(1234567890), serializesToHex: "fed2029649") 41 | self.assertNumber(CUnsignedLongLong(1234567890123), serializesToHex: "ffcb04fb711f010000") 42 | self.assertNumber(UINT64_MAX, serializesToHex: "ffffffffffffffffff") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.oleganza.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /CoreBitcoinTestsOSX/TestsSwiftBridgingHeader.h: -------------------------------------------------------------------------------- 1 | 2 | #import "SwiftBridgingHeader.h" 3 | #import "BTCScriptTestData.h" 4 | -------------------------------------------------------------------------------- /INSTALLATION.txt: -------------------------------------------------------------------------------- 1 | How to build and use as a framework: 2 | 3 | 0. check out from github 4 | 5 | 1. run update_openssl.sh 6 | This will build the OpenSSL library for all the architectures you may need 7 | 8 | 2. run build_libraries.sh 9 | This will create the frameworks and static libraries containing everything 10 | you need to include CoreBitcoin in other projects. 11 | 12 | 3. Drag and drop one of the .framework files into your project. If you have 13 | targets for both OSX and iOS in the same project you have to use both frameworks. 14 | In this case you need to uncheck "Copy items into destination group's folder", as the 15 | two files have the same name. 16 | 17 | 4. Add the framework(s) to the target(s) where you want to use them. (if you haven't done 18 | so when adding the files to the project) 19 | 20 | 5. include the header files where you need them, such as: 21 | #import -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2014 Oleg Andreev 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /MEME_GLOSSARY.md: -------------------------------------------------------------------------------- 1 | Bitcoin Meme Glossary 2 | ===================== 3 | 4 | Collection of various Bitcoin memes. 5 | 6 | If you find an inaccuracy, please report it to oleganza@gmail.com or clone this repo and submit pull requests. Thanks! 7 | 8 | ### Bitcorn, professor 9 | 10 | ### Chancellor on brink of second bailout for banks 11 | 12 | ### Dogecoin 13 | 14 | ### Govcoin, Fedcoin 15 | 16 | ### Goxcoin 17 | 18 | ### Goxxed 19 | 20 | ### HODL 21 | 22 | ### Hold, spartans 23 | 24 | ### I am pretty confident we are the new wealthy elite, gentlemen. 25 | 26 | ### In two weeks 27 | 28 | ### It's actually good news 29 | 30 | ### Supernintendo Lawsky 31 | 32 | ### Soonish 33 | 34 | ### This time it's different 35 | 36 | ### To the moon 37 | 38 | 39 | About 40 | ----- 41 | 42 | Bitcoin Meme Glossary is made by Oleg Andreev ([oleganza@gmail.com](mailto:oleganza@gmail.com)). Twitter: [@oleganza](http://twitter.com/oleganza). 43 | 44 | Send your thanks here: 1CBtcGivXmHQ8ZqdPgeMfcpQNJrqTrSAcG. 45 | 46 | This glossary is released under [WTFPL](http://www.wtfpl.net). Do what you want with it, but I would appreciate if you give full credit in case you republish it. 47 | 48 | Please report any mistakes or create pull requests on Github. Contributors will be listed here. Thanks! 49 | -------------------------------------------------------------------------------- /ScriptStringRepresentation.md: -------------------------------------------------------------------------------- 1 | 2 | There is no single fully reversible textual format for scripts. 3 | 4 | BitcoinQT uses this format in its unit tests: 5 | 6 | -?[0-9]+ is interpreted as int64. If it's from -1 to 16, interprets as "OP_", otherwise pushes bignum data. 7 | '[^']*' is interpreted as ASCII string 8 | 0x[0-9a-fA-F]+ is interpreted as a raw binary to be inserted in script (not just data) 9 | (OP_)? is replaced by an opcode byte. 10 | 11 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework.xcodeproj/project.xcworkspace/xcshareddata/TestiOSFramework.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 445F7623-2910-4E28-B8C1-08564E5E4137 9 | IDESourceControlProjectName 10 | TestiOSFramework 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | FA92D138-A8ED-4673-975C-064C0B607556 14 | ssh://github.com/oleganza/CoreBitcoin.git 15 | 16 | IDESourceControlProjectPath 17 | UnitTests/TestProjects/TestiOSFramework/TestiOSFramework.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | FA92D138-A8ED-4673-975C-064C0B607556 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/oleganza/CoreBitcoin.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | FA92D138-A8ED-4673-975C-064C0B607556 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | FA92D138-A8ED-4673-975C-064C0B607556 36 | IDESourceControlWCCName 37 | CoreBitcoin 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/Base.lproj/Main_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/Base.lproj/Main_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/TestAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestAppDelegate.h 3 | // TestiOSFramework 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/TestAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestAppDelegate.m 3 | // TestiOSFramework 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import "TestAppDelegate.h" 10 | #import 11 | 12 | @implementation TestAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | BTCKey* key = [[BTCKey alloc] init]; 17 | 18 | NSLog(@"key = %@ / %@", key.privateKey, key.publicKey); 19 | 20 | // Override point for customization after application launch. 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application 25 | { 26 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 27 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application 31 | { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application 37 | { 38 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application 42 | { 43 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application 47 | { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/TestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.h 3 | // TestiOSFramework 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/TestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.m 3 | // TestiOSFramework 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import "TestViewController.h" 10 | 11 | @interface TestViewController () 12 | 13 | @end 14 | 15 | @implementation TestViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning 24 | { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/TestiOSFramework-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.oleganza.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main_iPhone 29 | UIMainStoryboardFile~ipad 30 | Main_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/TestiOSFramework-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFramework/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TestiOSFramework 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "TestAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([TestAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFrameworkTests/TestiOSFrameworkTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.oleganza.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFrameworkTests/TestiOSFrameworkTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestiOSFrameworkTests.m 3 | // TestiOSFrameworkTests 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestiOSFrameworkTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation TestiOSFrameworkTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSFramework/TestiOSFrameworkTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | pod 'CoreBitcoin', :podspec => 'https://raw.github.com/oleganza/CoreBitcoin/master/CoreBitcoin.podspec' 4 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CoreBitcoin (0.1.0): 3 | - OpenSSL (~> 1.0.1) 4 | - OpenSSL (1.0.1) 5 | 6 | DEPENDENCIES: 7 | - CoreBitcoin (from `https://raw.github.com/oleganza/CoreBitcoin/master/CoreBitcoin.podspec`) 8 | 9 | EXTERNAL SOURCES: 10 | CoreBitcoin: 11 | :podspec: https://raw.github.com/oleganza/CoreBitcoin/master/CoreBitcoin.podspec 12 | 13 | SPEC CHECKSUMS: 14 | CoreBitcoin: 5ec9637f3e755b6a50be257c17dfc9dc2c8f19e6 15 | OpenSSL: 9b85178853701b1e9bbf70df695a4c149799e772 16 | 17 | COCOAPODS: 0.29.0 18 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCAddress.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCAddress.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCBase58.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCBase58.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCBigNumber.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCBigNumber.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCBlockchainInfo.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCBlockchainInfo.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCCurvePoint.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCCurvePoint.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCData.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCData.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCErrors.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCErrors.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCKey.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCKey.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCKeychain.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCKeychain.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCOpcode.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCOpcode.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCProtocolSerialization.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCProtocolSerialization.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCScript.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCScript.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCScriptMachine.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCScriptMachine.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCSignatureHashType.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCSignatureHashType.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCTransaction.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCTransaction.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCTransactionInput.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCTransactionInput.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCTransactionOutput.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCTransactionOutput.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/BTCUnitsAndLimits.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCUnitsAndLimits.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/CoreBitcoin+Categories.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/CoreBitcoin+Categories.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/CoreBitcoin.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/CoreBitcoin.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/NS+BTCBase58.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/NS+BTCBase58.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/CoreBitcoin/NSData+BTCData.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/NSData+BTCData.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/aes.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/aes.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/asn1.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/asn1.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/asn1_mac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/asn1_mac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/asn1t.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/asn1t.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/bio.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/bio.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/blowfish.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/blowfish.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/bn.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/bn.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/buffer.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/buffer.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/camellia.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/camellia.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/cast.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/cast.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/cmac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/cmac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/cms.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/cms.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/comp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/comp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/conf.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/conf.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/conf_api.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/conf_api.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/crypto.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/crypto.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/des.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/des.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/des_old.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/des_old.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/dh.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dh.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/dsa.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dsa.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/dso.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dso.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/dtls1.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dtls1.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/e_os2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/e_os2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ebcdic.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ebcdic.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ec.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ec.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ecdh.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ecdh.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ecdsa.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ecdsa.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/engine.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/engine.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/err.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/err.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/evp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/evp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/hmac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/hmac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/idea.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/idea.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/krb5_asn.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/krb5_asn.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/kssl.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/kssl.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/lhash.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/lhash.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/md4.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/md4.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/md5.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/md5.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/mdc2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/mdc2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/modes.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/modes.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/obj_mac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/obj_mac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/objects.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/objects.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ocsp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ocsp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/opensslconf.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/opensslconf.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/opensslv.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/opensslv.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ossl_typ.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ossl_typ.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/pem.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pem.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/pem2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pem2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/pkcs12.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pkcs12.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/pkcs7.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pkcs7.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/pqueue.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pqueue.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/rand.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rand.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/rc2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rc2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/rc4.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rc4.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ripemd.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ripemd.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/rsa.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rsa.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/safestack.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/safestack.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/seed.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/seed.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/sha.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/sha.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/srp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/srp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/srtp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/srtp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ssl.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ssl2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ssl23.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl23.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ssl3.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl3.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/stack.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/stack.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/symhacks.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/symhacks.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/tls1.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/tls1.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ts.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ts.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/txt_db.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/txt_db.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ui.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ui.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/ui_compat.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ui_compat.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/whrlpool.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/whrlpool.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/x509.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/x509.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/x509_vfy.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/x509_vfy.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/BuildHeaders/OpenSSL/x509v3.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/x509v3.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCBase58.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // Base58 is used for compact human-friendly representation of Bitcoin addresses and private keys. 6 | // Typically Base58-encoded text also contains a checksum. 7 | // Addresses look like 19FGfswVqxNubJbh1NW8A4t51T9x9RDVWQ 8 | // Private keys look like 5KQntKuhYWSRXNqp2yhdXzjekYAR7US3MT1715Mbv5CyUKV6hVe 9 | // 10 | // Here is what Satoshi said about Base58: 11 | // Why base-58 instead of standard base-64 encoding? 12 | // - Don't want 0OIl characters that look the same in some fonts and 13 | // could be used to create visually identical looking account numbers. 14 | // - A string with non-alphanumeric characters is not as easily accepted as an account number. 15 | // - E-mail usually won't line-break if there's no punctuation to break at. 16 | // - Double-clicking selects the whole number as one word if it's all alphanumeric. 17 | 18 | 19 | // See NS+BTCBase58.h for easy to use categories. 20 | 21 | // Returns data for a Base58 string without checksum 22 | // Data is mutable so you can clear sensitive information as soon as possible. 23 | NSMutableData* BTCDataFromBase58(NSString* string); 24 | NSMutableData* BTCDataFromBase58CString(const char* cstring); 25 | 26 | // Returns data for a Base58 string with checksum 27 | NSMutableData* BTCDataFromBase58Check(NSString* string); 28 | NSMutableData* BTCDataFromBase58CheckCString(const char* cstring); 29 | 30 | // String in Base58 without checksum, you need to free it yourself. 31 | // It's mutable so you can clear it securely yourself. 32 | char* BTCBase58CStringWithData(NSData* data); 33 | 34 | // Same as above, but returns an immutable autoreleased string. Suitable for non-sensitive data. 35 | NSString* BTCBase58StringWithData(NSData* data); 36 | 37 | // String in Base58 with checksum, you need to free it yourself. 38 | // It's mutable so you can clear it securely yourself. 39 | char* BTCBase58CheckCStringWithData(NSData* data); 40 | 41 | // Same as above, but returns an immutable autoreleased string. Suitable for non-sensitive data. 42 | NSString* BTCBase58CheckStringWithData(NSData* data); 43 | 44 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCBlockchainInfo.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // Collection of useful APIs for Blockchain.info 6 | @interface BTCBlockchainInfo : NSObject 7 | 8 | // Getting unspent outputs. 9 | 10 | // Builds a request from a list of BTCAddress objects. 11 | - (NSMutableURLRequest*) requestForUnspentOutputsWithAddresses:(NSArray*)addresses; 12 | // List of BTCTransactionOutput instances parsed from the response. 13 | - (NSArray*) unspentOutputsForResponseData:(NSData*)responseData error:(NSError**)errorOut; 14 | // Makes sync request for unspent outputs and parses the outputs. 15 | - (NSArray*) unspentOutputsWithAddresses:(NSArray*)addresses error:(NSError**)errorOut; 16 | 17 | 18 | // Broadcasting transaction 19 | 20 | // Request to broadcast a raw transaction data. 21 | - (NSMutableURLRequest*) requestForTransactionBroadcastWithData:(NSData*)data; 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCCurvePoint.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #include 5 | 6 | // Represents a point on the elliptic curve secp256k1. 7 | // Combined with BTCBigNumber arithmetic, you can do usual EC operations to manipulate private and public keys. 8 | // Private key is a big integer (represented by raw NSData or BTCBigNumber). 9 | // Public key is a point on the curve represented by BTCCurvePoint or BTCKey. 10 | // BTCCurvePoint is mutable. There is no immutable counterpart. 11 | @class BTCKey; 12 | @class BTCBigNumber; 13 | @interface BTCCurvePoint : NSObject 14 | 15 | // Serialized form of a curve point as a compressed public key (32-byte X coordinate with 1-byte prefix) 16 | @property(nonatomic, readonly) NSData* data; 17 | 18 | // Underlying data structure in OpenSSL. 19 | @property(nonatomic, readonly) const EC_POINT* EC_POINT; 20 | 21 | // Returns the generator point. Same as [BTCCurvePoint alloc] init]. 22 | + (id) generator; 23 | 24 | // Returns order of the secp256k1 curve (FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141). 25 | + (BTCBigNumber*) curveOrder; 26 | 27 | // Initializes point with its binary representation (corresponds to -data). 28 | - (id) initWithData:(NSData*)data; 29 | 30 | // Initializes point with OpenSSL EC_POINT. 31 | - (id) initWithEC_POINT:(const EC_POINT*)ecpoint; 32 | 33 | // Returns YES if the point is at infinity. 34 | - (BOOL) isInfinity; 35 | 36 | // These modify the receiver and return self (or nil in case of error). To create another point use -copy: [[point copy] multiply:number] 37 | - (instancetype) multiply:(BTCBigNumber*)number; 38 | - (instancetype) add:(BTCCurvePoint*)point; 39 | 40 | // Efficiently adds n*G to the receiver. Equivalent to [point add:[[G copy] multiply:number]] 41 | - (instancetype) addGeneratorMultipliedBy:(BTCBigNumber*)number; 42 | 43 | // Coordinates of the point 44 | - (BTCBigNumber*) x; 45 | - (BTCBigNumber*) y; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCErrors.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | extern NSString* const BTCErrorDomain; 6 | 7 | typedef NS_ENUM(NSUInteger, BTCErrorCode) { 8 | 9 | // Canonical pubkey/signature check errors 10 | BTCErrorNonCanonicalPublicKey = 4001, 11 | BTCErrorNonCanonicalScriptSignature = 4002, 12 | 13 | // Script verification errors 14 | BTCErrorScriptError = 5001, 15 | }; -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCErrors.m: -------------------------------------------------------------------------------- 1 | #import "BTCErrors.h" 2 | 3 | NSString* const BTCErrorDomain = @"org.corebitcoin"; 4 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCProtocolSerialization.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | // A collection of routines dealing with parsing and writing various protocol messages. 6 | @interface BTCProtocolSerialization : NSObject 7 | 8 | // This implementation of varInt is known as "CompactSize" in Satoshi code (BitcoinQT). 9 | // 10 | // Value Storage length Format 11 | // < 0xfd 1 uint8_t 12 | // <= 0xffff 3 0xfd followed by the value as uint16_t 13 | // <= 0xffffffff 5 0xfe followed by the value as uint32_t 14 | // > 0xffffffff 9 0xff followed by the value as uint64_t 15 | // 16 | // Note: BitcoinQT later added VarInt which is different, more compact format 17 | // used in block storage. VarInt is not a part of the protocol and is not implemented here. 18 | 19 | // Attempts to read integer from data and returns amount of bytes read. 20 | // In case of error, returns 0. 21 | + (NSUInteger) readVarInt:(uint64_t*)valueOut fromData:(NSData*)data; 22 | + (NSUInteger) readVarInt:(uint64_t*)valueOut fromStream:(NSInputStream*)stream; 23 | 24 | // Attempts to read string prepended by its length in varInt format. 25 | // On success, returns data. On failure, returns nil. 26 | + (NSData*) readVarStringFromData:(NSData*)data; 27 | + (NSData*) readVarStringFromStream:(NSInputStream*)stream; 28 | 29 | // Encodes value in a varint binary form. 30 | + (NSData*) dataForVarInt:(uint64_t)value; 31 | 32 | // Prepends binary string with its length in varInt format. 33 | + (NSData*) dataForVarString:(NSData*)binaryString; 34 | 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCSignatureHashType.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #ifndef CoreBitcoin_BTCSignatureHashType_h 4 | #define CoreBitcoin_BTCSignatureHashType_h 5 | 6 | // Hash type determines how OP_CHECKSIG hashes the transaction to create or 7 | // verify the signature in a transaction input. 8 | // Depending on hash type, transaction is modified in some way before its hash is computed. 9 | // Hash type is a single byte appended to a signature in a transaction input. 10 | typedef NS_ENUM(unsigned char, BTCSignatureHashType) 11 | { 12 | // First three types are mutually exclusive (tested using "type & 0x1F"). 13 | 14 | // Default. Signs all inputs and outputs. 15 | // Other inputs have scripts and sequences zeroed out, current input has its script 16 | // replaced by the previous transaction's output script (or, in case of P2SH, 17 | // by the signatures and the redemption script). 18 | // If (type & 0x1F) is not NONE or SINGLE, then this type is used. 19 | SIGHASH_ALL = 1, 20 | BTCSignatureHashTypeAll = SIGHASH_ALL, 21 | 22 | // All outputs are removed. "I don't care where it goes as long as others pay". 23 | // Note: this is not safe when used with ANYONECANPAY, because then anyone who relays the transaction 24 | // can pick your input and use in his own transaction. 25 | // It's also not safe if all inputs are SIGHASH_NONE as well (or it's the only input). 26 | SIGHASH_NONE = 2, 27 | BTCSignatureHashTypeNone = SIGHASH_NONE, 28 | 29 | // Hash only the output with the same index as the current input. 30 | // Preceding outputs are "nullified", other outputs are removed. 31 | // Special case: if there is no matching output, hash is "0000...0001" (32 bytes) 32 | SIGHASH_SINGLE = 3, 33 | BTCSignatureHashTypeSingle = SIGHASH_SINGLE, 34 | 35 | // This mask is used to determine one of the first types independently from ANYONECANPAY option: 36 | // E.g. if (type & SIGHASH_OUTPUT_MASK == SIGHASH_NONE) { blank all outputs } 37 | SIGHASH_OUTPUT_MASK = 0x1F, 38 | BTCSignatureHashTypeOutputMask = SIGHASH_OUTPUT_MASK, 39 | 40 | // Removes all inputs except for current txin before hashing. 41 | // This allows to sign the transaction outputs without knowing who and how adds other inputs. 42 | // E.g. a crowdfunding transaction with 100 BTC output can be signed independently by any number of people 43 | // and will become valid only when someone combines all inputs in a single transaction to make it valid. 44 | // Can be used together with any of the above types. 45 | SIGHASH_ANYONECANPAY = 0x80, 46 | BTCSignatureHashTypeAnyoneCanPay = SIGHASH_ANYONECANPAY, 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCTransactionInput.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | 5 | @class BTCScript; 6 | @class BTCTransaction; 7 | 8 | // Transaction input (aka "txin") represents a reference to another transaction's output. 9 | // Reference is defined by tx hash + tx output index. 10 | // Signature script is used to prove ownership of the corresponding tx output. 11 | // Sequence is used to require different signatures when tx is updated. It is only relevant when tx lockTime > 0. 12 | @interface BTCTransactionInput : NSObject 13 | 14 | // Hash of the previous transaction. 15 | @property(nonatomic) NSData* previousHash; 16 | 17 | // Index of the previous transaction's output. 18 | @property(nonatomic) uint32_t previousIndex; 19 | 20 | // Script that proves ownership of the previous transaction output. 21 | @property(nonatomic) BTCScript* signatureScript; 22 | 23 | // Input sequence. Default is maximum value 0xFFFFFFFF. 24 | // Sequence is used to update a timelocked tx stored in memory of the nodes. It is only relevant when tx lockTime > 0. 25 | // Currently, for DoS and security reasons, nodes do not store timelocked transactions making the sequence number meaningless. 26 | @property(nonatomic) uint32_t sequence; 27 | 28 | // Serialized binary representation of the txin. 29 | @property(nonatomic, readonly) NSData* data; 30 | 31 | // Set when input is added via [tx addInput:input] 32 | @property(weak, nonatomic) BTCTransaction* transaction; 33 | 34 | // Parses tx input from a data buffer. 35 | - (id) initWithData:(NSData*)data; 36 | 37 | // Read tx input from the stream. 38 | - (id) initWithStream:(NSInputStream*)stream; 39 | 40 | // Constructs transaction input from a dictionary representation 41 | - (id) initWithDictionary:(NSDictionary*)dictionary; 42 | 43 | // Returns a dictionary representation suitable for encoding in JSON or Plist. 44 | - (NSDictionary*) dictionaryRepresentation; 45 | 46 | // Returns YES if this txin generates new coins. 47 | - (BOOL) isCoinbase; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCTransactionOutput.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import "BTCUnitsAndLimits.h" 5 | 6 | @class BTCScript; 7 | @class BTCAddress; 8 | @class BTCTransaction; 9 | 10 | static uint32_t const BTCTransactionOutputIndexUnknown = 0xffffffff; 11 | 12 | // Transaction output (aka "tx out") is a value with rules attached in form of a script. 13 | // To spend money one need to choose a transaction output and provide an appropriate 14 | // input which makes the script execute with success. 15 | @interface BTCTransactionOutput : NSObject 16 | 17 | // Creates an output with a standard script redeeming to an address (OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG). 18 | // Also supports P2SH addresses. 19 | + (instancetype) outputWithValue:(BTCSatoshi)value address:(BTCAddress*)address; 20 | 21 | // Serialized binary form of the output (payload) 22 | @property(nonatomic, readonly) NSData* data; 23 | 24 | // Value of output in satoshis. 25 | @property(nonatomic) BTCSatoshi value; 26 | 27 | // Script defining redemption rules for this output (aka scriptPubKey or pk_script) 28 | @property(nonatomic) BTCScript* script; 29 | 30 | // Reference to owning transaction. Set on [tx addOutput:...] and reset to nil on [tx removeAllOutputs]. 31 | @property(weak, nonatomic) BTCTransaction* transaction; 32 | 33 | // These are informational properties updated in certain context. 34 | // E.g. when loading unspent outputs from blockchain.info (BTCBlockchainInfo), all these properties will be set. 35 | // index and transactionHash are kept up to date when output is added/removed from the transaction. 36 | 37 | // Index of this output in its transaction. Default is BTCTransactionOutputIndexUnknown 38 | @property(nonatomic) uint32_t index; 39 | 40 | // Number of confirmations. Default is NSNotFound. 41 | @property(nonatomic) NSUInteger confirmations; 42 | 43 | // Identifier of the transaction. Default is nil. 44 | @property(nonatomic) NSData* transactionHash; 45 | 46 | // Parses tx output from a data buffer. 47 | - (id) initWithData:(NSData*)data; 48 | 49 | // Read tx output from the stream. 50 | - (id) initWithStream:(NSInputStream*)stream; 51 | 52 | // Constructs transaction output from a dictionary representation 53 | - (id) initWithDictionary:(NSDictionary*)dictionary; 54 | 55 | // Returns a dictionary representation suitable for encoding in JSON or Plist. 56 | - (NSDictionary*) dictionaryRepresentation; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/BTCUnitsAndLimits.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #ifndef CoreBitcoin_BTCUnits_h 4 | #define CoreBitcoin_BTCUnits_h 5 | 6 | // The smallest unit in Bitcoin is 1 satoshi. 7 | // Satoshis are 64-bit signed integers. 8 | // The value is signed to allow special value -1 in BTCTransactionOutput. 9 | typedef int64_t BTCSatoshi; 10 | 11 | // 100 mln satoshis is one Bitcoin 12 | static const BTCSatoshi BTCCoin = 100000000; 13 | 14 | // Bitcent is 0.01 BTC 15 | static const BTCSatoshi BTCCent = 1000000; 16 | 17 | 18 | 19 | // Network Rules (changing these will result in incompatibility with other nodes) 20 | 21 | // The maximum allowed size for a serialized block, in bytes 22 | static const unsigned int BTC_MAX_BLOCK_SIZE = 1000000; 23 | 24 | // The maximum allowed number of signature check operations in a block 25 | static const unsigned int BTC_MAX_BLOCK_SIGOPS = BTC_MAX_BLOCK_SIZE/50; 26 | 27 | // No amount larger than this (in satoshi) is valid 28 | static const BTCSatoshi BTC_MAX_MONEY = 21000000 * BTCCoin; 29 | 30 | // Coinbase transaction outputs can only be spent after this number of new blocks 31 | static const int BTC_COINBASE_MATURITY = 100; 32 | 33 | // Threshold for -[BTCTransaction lockTime]: below this value it is interpreted as block number, otherwise as UNIX timestamp. */ 34 | static const unsigned int BTC_LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC (max block number is in year ≈11521) 35 | 36 | // P2SH BIP16 didn't become active until Apr 1 2012. All txs before this timestamp should not be verified with P2SH rule. 37 | static const uint32_t BTC_BIP16_TIMESTAMP = 1333238400; 38 | 39 | // Scripts longer than 10000 bytes are invalid. 40 | static const NSUInteger BTC_MAX_SCRIPT_SIZE = 10000; 41 | 42 | // Maximum number of bytes per "pushdata" operation 43 | static const NSUInteger BTC_MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes 44 | 45 | // Number of public keys allowed for OP_CHECKMULTISIG 46 | static const NSUInteger BTC_MAX_KEYS_FOR_CHECKMULTISIG = 20; 47 | 48 | // Maximum number of operations allowed per script (excluding pushdata operations and OP_) 49 | // Multisig op additionally increases count by a number of pubkeys. 50 | static const NSUInteger BTC_MAX_OPS_PER_SCRIPT = 201; 51 | 52 | // Soft Rules (can bend these without becoming incompatible with everyone) 53 | 54 | // The maximum number of entries in an 'inv' protocol message 55 | static const unsigned int BTC_MAX_INV_SZ = 50000; 56 | 57 | // The maximum size for mined blocks 58 | static const unsigned int BTC_MAX_BLOCK_SIZE_GEN = BTC_MAX_BLOCK_SIZE/2; 59 | 60 | // The maximum size for transactions we're willing to relay/mine 61 | static const unsigned int BTC_MAX_STANDARD_TX_SIZE = BTC_MAX_BLOCK_SIZE_GEN/5; 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/CoreBitcoin+Categories.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import 5 | #import 6 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/CoreBitcoin.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import 5 | #import 6 | #import 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/NS+BTCBase58.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import "BTCBase58.h" 5 | 6 | // These categories are optional and provided for convenience only. 7 | // For documentation look into BTCBase58.h. 8 | // They are also used in CoreBitcoin unit tests. 9 | @interface NSString (BTCBase58) 10 | 11 | // Returns data for Base58 string without checksum 12 | // Data is mutable so you can clear sensitive information as soon as possible. 13 | - (NSMutableData*) dataFromBase58; 14 | 15 | // Returns data for Base58 string with checksum 16 | - (NSMutableData*) dataFromBase58Check; 17 | 18 | @end 19 | 20 | @interface NSMutableData (BTCBase58) 21 | 22 | // Returns data for Base58 string without checksum 23 | // Data is mutable so you can clear sensitive information as soon as possible. 24 | + (NSMutableData*) dataFromBase58CString:(const char*)cstring; 25 | 26 | // Returns data for Base58 string with checksum 27 | + (NSMutableData*) dataFromBase58CheckCString:(const char*)cstring; 28 | 29 | @end 30 | 31 | @interface NSData (BTCBase58) 32 | 33 | // String in Base58 without checksum, you need to free it yourself. 34 | // It's mutable so you can clear it securely yourself. 35 | - (char*) base58CString; 36 | 37 | // String in Base58 with checksum, you need to free it yourself. 38 | // It's mutable so you can clear it securely yourself. 39 | - (char*) base58CheckCString; 40 | 41 | // String in Base58 without checksum 42 | - (NSString*) base58String; 43 | 44 | // String in Base58 with checksum 45 | - (NSString*) base58CheckString; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/NS+BTCBase58.m: -------------------------------------------------------------------------------- 1 | // Oleg Andreev 2 | 3 | #import "NS+BTCBase58.h" 4 | 5 | // TODO. 6 | 7 | @implementation NSString (BTCBase58) 8 | 9 | - (NSMutableData*) dataFromBase58 { return BTCDataFromBase58(self); } 10 | - (NSMutableData*) dataFromBase58Check { return BTCDataFromBase58Check(self); } 11 | @end 12 | 13 | 14 | @implementation NSMutableData (BTCBase58) 15 | 16 | + (NSMutableData*) dataFromBase58CString:(const char*)cstring 17 | { 18 | return BTCDataFromBase58CString(cstring); 19 | } 20 | 21 | + (NSMutableData*) dataFromBase58CheckCString:(const char*)cstring 22 | { 23 | return BTCDataFromBase58CheckCString(cstring); 24 | } 25 | 26 | @end 27 | 28 | 29 | @implementation NSData (BTCBase58) 30 | 31 | - (char*) base58CString 32 | { 33 | return BTCBase58CStringWithData(self); 34 | } 35 | 36 | - (char*) base58CheckCString 37 | { 38 | return BTCBase58CheckCStringWithData(self); 39 | } 40 | 41 | - (NSString*) base58String 42 | { 43 | return BTCBase58StringWithData(self); 44 | } 45 | 46 | - (NSString*) base58CheckString 47 | { 48 | return BTCBase58CheckStringWithData(self); 49 | } 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/CoreBitcoin/NSData+BTCData.h: -------------------------------------------------------------------------------- 1 | // CoreBitcoin by Oleg Andreev , WTFPL. 2 | 3 | #import 4 | #import "BTCData.h" 5 | 6 | // This category is for user's convenience only. 7 | // For documentation look into BTCData.h. 8 | // If you link CoreBitcoin library without categories enabled, nothing will break. 9 | // This is also used in unit tests in CoreBitcoin. 10 | @interface NSData (BTCData) 11 | 12 | // Core hash functions 13 | - (NSData*) SHA1; 14 | - (NSData*) SHA256; 15 | - (NSData*) BTCHash256; // SHA256(SHA256(self)) aka Hash or Hash256 in BitcoinQT 16 | 17 | #if BTCDataRequiresOpenSSL 18 | - (NSData*) RIPEMD160; 19 | - (NSData*) BTCHash160; // RIPEMD160(SHA256(self)) aka Hash160 in BitcoinQT 20 | #endif 21 | 22 | // Formats data as a lowercase hex string 23 | - (NSString*) hexString; 24 | - (NSString*) hexUppercaseString; 25 | 26 | // Encrypts/decrypts data using the key. 27 | + (NSMutableData*) encryptData:(NSData*)data key:(NSData*)key iv:(NSData*)initializationVector; 28 | + (NSMutableData*) decryptData:(NSData*)data key:(NSData*)key iv:(NSData*)initializationVector; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/CoreBitcoin/LICENSE.txt: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2013 Oleg Andreev 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCAddress.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCAddress.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCBase58.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCBase58.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCBigNumber.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCBigNumber.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCBlockchainInfo.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCBlockchainInfo.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCCurvePoint.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCCurvePoint.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCData.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCData.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCErrors.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCErrors.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCKey.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCKey.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCKeychain.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCKeychain.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCOpcode.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCOpcode.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCProtocolSerialization.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCProtocolSerialization.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCScript.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCScript.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCScriptMachine.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCScriptMachine.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCSignatureHashType.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCSignatureHashType.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCTransaction.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCTransaction.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCTransactionInput.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCTransactionInput.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCTransactionOutput.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCTransactionOutput.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/BTCUnitsAndLimits.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/BTCUnitsAndLimits.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/CoreBitcoin+Categories.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/CoreBitcoin+Categories.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/CoreBitcoin.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/CoreBitcoin.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/NS+BTCBase58.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/NS+BTCBase58.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/CoreBitcoin/NSData+BTCData.h: -------------------------------------------------------------------------------- 1 | ../../CoreBitcoin/CoreBitcoin/NSData+BTCData.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/aes.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/aes.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/asn1.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/asn1.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/asn1_mac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/asn1_mac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/asn1t.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/asn1t.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/bio.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/bio.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/blowfish.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/blowfish.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/bn.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/bn.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/buffer.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/buffer.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/camellia.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/camellia.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/cast.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/cast.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/cmac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/cmac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/cms.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/cms.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/comp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/comp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/conf.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/conf.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/conf_api.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/conf_api.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/crypto.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/crypto.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/des.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/des.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/des_old.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/des_old.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/dh.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dh.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/dsa.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dsa.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/dso.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dso.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/dtls1.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/dtls1.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/e_os2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/e_os2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ebcdic.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ebcdic.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ec.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ec.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ecdh.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ecdh.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ecdsa.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ecdsa.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/engine.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/engine.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/err.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/err.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/evp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/evp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/hmac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/hmac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/idea.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/idea.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/krb5_asn.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/krb5_asn.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/kssl.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/kssl.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/lhash.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/lhash.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/md4.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/md4.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/md5.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/md5.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/mdc2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/mdc2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/modes.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/modes.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/obj_mac.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/obj_mac.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/objects.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/objects.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ocsp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ocsp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/opensslconf.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/opensslconf.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/opensslv.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/opensslv.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ossl_typ.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ossl_typ.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/pem.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pem.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/pem2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pem2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/pkcs12.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pkcs12.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/pkcs7.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pkcs7.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/pqueue.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/pqueue.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/rand.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rand.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/rc2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rc2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/rc4.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rc4.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ripemd.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ripemd.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/rsa.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/rsa.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/safestack.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/safestack.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/seed.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/seed.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/sha.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/sha.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/srp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/srp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/srtp.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/srtp.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ssl.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ssl2.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl2.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ssl23.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl23.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ssl3.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ssl3.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/stack.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/stack.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/symhacks.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/symhacks.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/tls1.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/tls1.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ts.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ts.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/txt_db.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/txt_db.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ui.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ui.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/ui_compat.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/ui_compat.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/whrlpool.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/whrlpool.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/x509.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/x509.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/x509_vfy.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/x509_vfy.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Headers/OpenSSL/x509v3.h: -------------------------------------------------------------------------------- 1 | ../../OpenSSL/include/openssl/x509v3.h -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Local Podspecs/CoreBitcoin.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "CoreBitcoin" 3 | s.version = "0.1.0" 4 | s.summary = "CoreBitcoin is an implementation of Bitcoin protocol in Objective-C." 5 | s.description = <<-DESC 6 | CoreBitcoin is an implementation of Bitcoin protocol in Objective-C. 7 | When it is completed, it will let you create an application that acts 8 | as a full Bitcoin node. You can encode/decode addresses, apply various 9 | hash functions, sign and verify messages and parse some data structures. 10 | Transaction support is still incomplete. 11 | DESC 12 | s.homepage = "https://github.com/oleganza/CoreBitcoin" 13 | s.license = 'WTFPL' 14 | s.author = { "Oleg Andreev" => "oleganza@gmail.com" } 15 | s.ios.deployment_target = '7.0' 16 | s.osx.deployment_target = '10.9' 17 | s.source = { :git => "https://github.com/oleganza/CoreBitcoin.git" } 18 | s.source_files = 'CoreBitcoin' 19 | s.exclude_files = 'CoreBitcoin/**/*+Tests.{h,m}' 20 | s.requires_arc = true 21 | s.framework = 'Foundation' 22 | s.dependency 'OpenSSL', '~> 1.0.1' 23 | end 24 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CoreBitcoin (0.1.0): 3 | - OpenSSL (~> 1.0.1) 4 | - OpenSSL (1.0.1) 5 | 6 | DEPENDENCIES: 7 | - CoreBitcoin (from `https://raw.github.com/oleganza/CoreBitcoin/master/CoreBitcoin.podspec`) 8 | 9 | EXTERNAL SOURCES: 10 | CoreBitcoin: 11 | :podspec: https://raw.github.com/oleganza/CoreBitcoin/master/CoreBitcoin.podspec 12 | 13 | SPEC CHECKSUMS: 14 | CoreBitcoin: 5ec9637f3e755b6a50be257c17dfc9dc2c8f19e6 15 | OpenSSL: 9b85178853701b1e9bbf70df695a4c149799e772 16 | 17 | COCOAPODS: 0.29.0 18 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/OpenSSL/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | #define HEADER_COMP_H 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct comp_ctx_st COMP_CTX; 12 | 13 | typedef struct comp_method_st 14 | { 15 | int type; /* NID for compression library */ 16 | const char *name; /* A text string to identify the library */ 17 | int (*init)(COMP_CTX *ctx); 18 | void (*finish)(COMP_CTX *ctx); 19 | int (*compress)(COMP_CTX *ctx, 20 | unsigned char *out, unsigned int olen, 21 | unsigned char *in, unsigned int ilen); 22 | int (*expand)(COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | /* The following two do NOTHING, but are kept for backward compatibility */ 26 | long (*ctrl)(void); 27 | long (*callback_ctrl)(void); 28 | } COMP_METHOD; 29 | 30 | struct comp_ctx_st 31 | { 32 | COMP_METHOD *meth; 33 | unsigned long compress_in; 34 | unsigned long compress_out; 35 | unsigned long expand_in; 36 | unsigned long expand_out; 37 | 38 | CRYPTO_EX_DATA ex_data; 39 | }; 40 | 41 | 42 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 43 | void COMP_CTX_free(COMP_CTX *ctx); 44 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 45 | unsigned char *in, int ilen); 46 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | COMP_METHOD *COMP_rle(void ); 49 | COMP_METHOD *COMP_zlib(void ); 50 | void COMP_zlib_cleanup(void); 51 | 52 | #ifdef HEADER_BIO_H 53 | #ifdef ZLIB 54 | BIO_METHOD *BIO_f_zlib(void); 55 | #endif 56 | #endif 57 | 58 | /* BEGIN ERROR CODES */ 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes 60 | * made after this point may be overwritten when the script is next run. 61 | */ 62 | void ERR_load_COMP_strings(void); 63 | 64 | /* Error codes for the COMP functions. */ 65 | 66 | /* Function codes. */ 67 | #define COMP_F_BIO_ZLIB_FLUSH 99 68 | #define COMP_F_BIO_ZLIB_NEW 100 69 | #define COMP_F_BIO_ZLIB_READ 101 70 | #define COMP_F_BIO_ZLIB_WRITE 102 71 | 72 | /* Reason codes. */ 73 | #define COMP_R_ZLIB_DEFLATE_ERROR 99 74 | #define COMP_R_ZLIB_INFLATE_ERROR 100 75 | #define COMP_R_ZLIB_NOT_SUPPORTED 101 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif 81 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/OpenSSL/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | #define HEADER_EBCDIC_H 5 | 6 | #include 7 | 8 | /* Avoid name clashes with other applications */ 9 | #define os_toascii _openssl_os_toascii 10 | #define os_toebcdic _openssl_os_toebcdic 11 | #define ebcdic2ascii _openssl_ebcdic2ascii 12 | #define ascii2ebcdic _openssl_ascii2ebcdic 13 | 14 | extern const unsigned char os_toascii[256]; 15 | extern const unsigned char os_toebcdic[256]; 16 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 17 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/OpenSSL/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_WHRLPOOL_H 2 | #define HEADER_WHRLPOOL_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define WHIRLPOOL_DIGEST_LENGTH (512/8) 12 | #define WHIRLPOOL_BBLOCK 512 13 | #define WHIRLPOOL_COUNTER (256/8) 14 | 15 | typedef struct { 16 | union { 17 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 18 | /* double q is here to ensure 64-bit alignment */ 19 | double q[WHIRLPOOL_DIGEST_LENGTH/sizeof(double)]; 20 | } H; 21 | unsigned char data[WHIRLPOOL_BBLOCK/8]; 22 | unsigned int bitoff; 23 | size_t bitlen[WHIRLPOOL_COUNTER/sizeof(size_t)]; 24 | } WHIRLPOOL_CTX; 25 | 26 | #ifndef OPENSSL_NO_WHIRLPOOL 27 | #ifdef OPENSSL_FIPS 28 | int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 29 | #endif 30 | int WHIRLPOOL_Init (WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits); 33 | int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/OpenSSL/lib/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oleganza/CoreBitcoin/314e5b7490af6abcfff8167b51687bfe5e5dfbe1/UnitTests/TestProjects/TestiOSPodfile/Pods/OpenSSL/lib/libcrypto.a -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/OpenSSL/lib/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oleganza/CoreBitcoin/314e5b7490af6abcfff8167b51687bfe5e5dfbe1/UnitTests/TestProjects/TestiOSPodfile/Pods/OpenSSL/lib/libssl.a -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-CoreBitcoin-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-CoreBitcoin.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/CoreBitcoin" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/CoreBitcoin" "${PODS_ROOT}/Headers/OpenSSL" 4 | OTHER_LDFLAGS = -ObjC ${PODS_COREBITCOIN_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-CoreBitcoin-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_CoreBitcoin : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_CoreBitcoin 5 | @end 6 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-CoreBitcoin-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-CoreBitcoin.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_COREBITCOIN_OTHER_LDFLAGS = -framework Foundation -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-OpenSSL-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-OpenSSL.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/OpenSSL" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/CoreBitcoin" "${PODS_ROOT}/Headers/OpenSSL" 4 | LIBRARY_SEARCH_PATHS = ${PODS_OPENSSL_LIBRARY_SEARCH_PATHS} 5 | OTHER_LDFLAGS = -ObjC ${PODS_OPENSSL_OTHER_LDFLAGS} 6 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-OpenSSL-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_OpenSSL : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_OpenSSL 5 | @end 6 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-OpenSSL-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-OpenSSL.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_OPENSSL_LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/OpenSSL/lib" 2 | PODS_OPENSSL_OTHER_LDFLAGS = -lcrypto -lssl -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // CoreBitcoin 10 | #define COCOAPODS_POD_AVAILABLE_CoreBitcoin 11 | #define COCOAPODS_VERSION_MAJOR_CoreBitcoin 0 12 | #define COCOAPODS_VERSION_MINOR_CoreBitcoin 1 13 | #define COCOAPODS_VERSION_PATCH_CoreBitcoin 0 14 | 15 | // OpenSSL 16 | #define COCOAPODS_POD_AVAILABLE_OpenSSL 17 | #define COCOAPODS_VERSION_MAJOR_OpenSSL 1 18 | #define COCOAPODS_VERSION_MINOR_OpenSSL 0 19 | #define COCOAPODS_VERSION_PATCH_OpenSSL 1 20 | 21 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/Pods/Pods.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/CoreBitcoin" "${PODS_ROOT}/Headers/OpenSSL" 3 | LIBRARY_SEARCH_PATHS = "$(PODS_ROOT)/OpenSSL/lib" 4 | OTHER_CFLAGS = $(inherited) "-isystem${PODS_ROOT}/Headers" "-isystem${PODS_ROOT}/Headers/CoreBitcoin" "-isystem${PODS_ROOT}/Headers/OpenSSL" 5 | OTHER_LDFLAGS = -ObjC -lcrypto -lssl -framework Foundation 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile.xcodeproj/project.xcworkspace/xcshareddata/TestiOSPodfile.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 4ABCA78B-E0D7-4CD3-8654-8B4068392943 9 | IDESourceControlProjectName 10 | TestiOSPodfile 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | FA92D138-A8ED-4673-975C-064C0B607556 14 | ssh://github.com/oleganza/CoreBitcoin.git 15 | 16 | IDESourceControlProjectPath 17 | UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | FA92D138-A8ED-4673-975C-064C0B607556 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/oleganza/CoreBitcoin.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | FA92D138-A8ED-4673-975C-064C0B607556 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | FA92D138-A8ED-4673-975C-064C0B607556 36 | IDESourceControlWCCName 37 | CoreBitcoin 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile.xcworkspace/xcshareddata/TestiOSPodfile.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 9C1C9F6A-C365-4D04-A052-0A38D213AE06 9 | IDESourceControlProjectName 10 | TestiOSPodfile 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | FA92D138-A8ED-4673-975C-064C0B607556 14 | ssh://github.com/oleganza/CoreBitcoin.git 15 | 16 | IDESourceControlProjectPath 17 | UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | FA92D138-A8ED-4673-975C-064C0B607556 21 | ../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/oleganza/CoreBitcoin.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | FA92D138-A8ED-4673-975C-064C0B607556 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | FA92D138-A8ED-4673-975C-064C0B607556 36 | IDESourceControlWCCName 37 | CoreBitcoin 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/Base.lproj/Main_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/Base.lproj/Main_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/TestAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestAppDelegate.h 3 | // TestiOSPodfile 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/TestAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestAppDelegate.m 3 | // TestiOSPodfile 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import "TestAppDelegate.h" 10 | #import 11 | 12 | @implementation TestAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | BTCKey* key = [[BTCKey alloc] init]; 17 | 18 | NSLog(@"key = %@ / %@", key.privateKey, key.publicKey); 19 | 20 | // Override point for customization after application launch. 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application 25 | { 26 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 27 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 28 | } 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application 31 | { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application 37 | { 38 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 39 | } 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application 42 | { 43 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application 47 | { 48 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/TestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.h 3 | // TestiOSPodfile 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/TestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.m 3 | // TestiOSPodfile 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import "TestViewController.h" 10 | 11 | @interface TestViewController () 12 | 13 | @end 14 | 15 | @implementation TestViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning 24 | { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/TestiOSPodfile-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.oleganza.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main_iPhone 29 | UIMainStoryboardFile~ipad 30 | Main_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/TestiOSPodfile-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfile/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TestiOSPodfile 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "TestAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([TestAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfileTests/TestiOSPodfileTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.oleganza.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfileTests/TestiOSPodfileTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestiOSPodfileTests.m 3 | // TestiOSPodfileTests 4 | // 5 | // Created by Oleg Andreev on 23.02.2014. 6 | // Copyright (c) 2014 Oleg Andreev. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestiOSPodfileTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation TestiOSPodfileTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /UnitTests/TestProjects/TestiOSPodfile/TestiOSPodfileTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /UnitTests/UnitTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'UnitTests' target in the 'UnitTests' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /UnitTests/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "BTC256+Tests.h" 4 | #import "BTCData+Tests.h" 5 | #import "BTCMnemonic+Tests.h" 6 | #import "BTCBigNumber+Tests.h" 7 | #import "BTCBase58+Tests.h" 8 | #import "BTCAddress+Tests.h" 9 | #import "BTCProtocolSerialization+Tests.h" 10 | #import "BTCKey+Tests.h" 11 | #import "BTCKeychain+Tests.h" 12 | #import "BTCCurvePoint+Tests.h" 13 | #import "BTCBlindSignature+Tests.h" 14 | #import "BTCEncryptedBackup+Tests.h" 15 | #import "BTCEncryptedMessage+Tests.h" 16 | #import "BTCFancyEncryptedMessage+Tests.h" 17 | #import "BTCScript+Tests.h" 18 | #import "BTCTransaction+Tests.h" 19 | #import "BTCBlockchainInfo+Tests.h" 20 | #import "BTCPriceSource+Tests.h" 21 | #import "BTCMerkleTree+Tests.h" 22 | #import "BTCBitcoinURL+Tests.h" 23 | #import "BTCCurrencyConverter+Tests.h" 24 | 25 | int main(int argc, const char * argv[]) 26 | { 27 | @autoreleasepool 28 | { 29 | BTC256RunAllTests(); 30 | [NSData runAllTests]; 31 | [BTCMnemonic runAllTests]; 32 | [BTCBigNumber runAllTests]; 33 | BTCBase58RunAllTests(); 34 | [BTCAddress runAllTests]; 35 | [BTCProtocolSerialization runAllTests]; 36 | [BTCKey runAllTests]; 37 | [BTCCurvePoint runAllTests]; 38 | [BTCKeychain runAllTests]; 39 | [BTCBlindSignature runAllTests]; 40 | [BTCEncryptedBackup runAllTests]; 41 | [BTCEncryptedMessage runAllTests]; 42 | [BTCFancyEncryptedMessage runAllTests]; 43 | [BTCScript runAllTests]; 44 | [BTCMerkleTree runAllTests]; 45 | [BTCBlockchainInfo runAllTests]; 46 | [BTCPriceSource runAllTests]; 47 | [BTCBitcoinURL runAllTests]; 48 | [BTCCurrencyConverter runAllTests]; 49 | 50 | [BTCTransaction runAllTests]; // has some interactive features to ask for private key 51 | NSLog(@"All tests passed."); 52 | } 53 | return 0; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /openssl-1.0.1e.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oleganza/CoreBitcoin/314e5b7490af6abcfff8167b51687bfe5e5dfbe1/openssl-1.0.1e.tar.gz -------------------------------------------------------------------------------- /openssl/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | #define HEADER_COMP_H 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct comp_ctx_st COMP_CTX; 12 | 13 | typedef struct comp_method_st 14 | { 15 | int type; /* NID for compression library */ 16 | const char *name; /* A text string to identify the library */ 17 | int (*init)(COMP_CTX *ctx); 18 | void (*finish)(COMP_CTX *ctx); 19 | int (*compress)(COMP_CTX *ctx, 20 | unsigned char *out, unsigned int olen, 21 | unsigned char *in, unsigned int ilen); 22 | int (*expand)(COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | /* The following two do NOTHING, but are kept for backward compatibility */ 26 | long (*ctrl)(void); 27 | long (*callback_ctrl)(void); 28 | } COMP_METHOD; 29 | 30 | struct comp_ctx_st 31 | { 32 | COMP_METHOD *meth; 33 | unsigned long compress_in; 34 | unsigned long compress_out; 35 | unsigned long expand_in; 36 | unsigned long expand_out; 37 | 38 | CRYPTO_EX_DATA ex_data; 39 | }; 40 | 41 | 42 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 43 | void COMP_CTX_free(COMP_CTX *ctx); 44 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 45 | unsigned char *in, int ilen); 46 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | COMP_METHOD *COMP_rle(void ); 49 | COMP_METHOD *COMP_zlib(void ); 50 | void COMP_zlib_cleanup(void); 51 | 52 | #ifdef HEADER_BIO_H 53 | #ifdef ZLIB 54 | BIO_METHOD *BIO_f_zlib(void); 55 | #endif 56 | #endif 57 | 58 | /* BEGIN ERROR CODES */ 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes 60 | * made after this point may be overwritten when the script is next run. 61 | */ 62 | void ERR_load_COMP_strings(void); 63 | 64 | /* Error codes for the COMP functions. */ 65 | 66 | /* Function codes. */ 67 | #define COMP_F_BIO_ZLIB_FLUSH 99 68 | #define COMP_F_BIO_ZLIB_NEW 100 69 | #define COMP_F_BIO_ZLIB_READ 101 70 | #define COMP_F_BIO_ZLIB_WRITE 102 71 | 72 | /* Reason codes. */ 73 | #define COMP_R_ZLIB_DEFLATE_ERROR 99 74 | #define COMP_R_ZLIB_INFLATE_ERROR 100 75 | #define COMP_R_ZLIB_NOT_SUPPORTED 101 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif 81 | -------------------------------------------------------------------------------- /openssl/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | #define HEADER_EBCDIC_H 5 | 6 | #include 7 | 8 | /* Avoid name clashes with other applications */ 9 | #define os_toascii _openssl_os_toascii 10 | #define os_toebcdic _openssl_os_toebcdic 11 | #define ebcdic2ascii _openssl_ebcdic2ascii 12 | #define ascii2ebcdic _openssl_ascii2ebcdic 13 | 14 | extern const unsigned char os_toascii[256]; 15 | extern const unsigned char os_toebcdic[256]; 16 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 17 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /openssl/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_WHRLPOOL_H 2 | #define HEADER_WHRLPOOL_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define WHIRLPOOL_DIGEST_LENGTH (512/8) 12 | #define WHIRLPOOL_BBLOCK 512 13 | #define WHIRLPOOL_COUNTER (256/8) 14 | 15 | typedef struct { 16 | union { 17 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 18 | /* double q is here to ensure 64-bit alignment */ 19 | double q[WHIRLPOOL_DIGEST_LENGTH/sizeof(double)]; 20 | } H; 21 | unsigned char data[WHIRLPOOL_BBLOCK/8]; 22 | unsigned int bitoff; 23 | size_t bitlen[WHIRLPOOL_COUNTER/sizeof(size_t)]; 24 | } WHIRLPOOL_CTX; 25 | 26 | #ifndef OPENSSL_NO_WHIRLPOOL 27 | #ifdef OPENSSL_FIPS 28 | int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 29 | #endif 30 | int WHIRLPOOL_Init (WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits); 33 | int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /postprocess_openssl_includes_in_framework.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | framework_path = ARGV[0] || "binaries/**/CoreBitcoin.framework" 4 | 5 | Dir.glob("#{framework_path}/**/*.h").each do |src| 6 | # puts "REWRITING INCLUDES IN #{src}" 7 | 8 | data = File.read(src) 9 | 10 | #include => #include 11 | data.gsub!(%r{#(include|import) #import 14 | data.gsub!(%r{#(include|import) "(BTC.*?\.h)"}, "#\\1 ") 15 | 16 | File.open(src, "w"){|f| f.write(data)} 17 | end 18 | -------------------------------------------------------------------------------- /update_headers.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | header_comment = %{// CoreBitcoin by Oleg Andreev , WTFPL.} 4 | 5 | header_filenames = [] 6 | header_ext_filenames = [] 7 | 8 | # Collect all headers and update their license/authorship notices. 9 | Dir.glob("CoreBitcoin/**/*.h").each do |header_filename| 10 | name = header_filename.gsub("CoreBitcoin/", "") 11 | if !name["CoreBitcoin"] && !name["+Tests"] 12 | if name["+"] 13 | header_ext_filenames << header_filename 14 | else 15 | header_filenames << header_filename 16 | end 17 | end 18 | 19 | data = File.read(header_filename) 20 | 21 | # Update first line with an authorship comment. 22 | 23 | data.gsub!(%r{\A(//[^\n]+\n)+\n}mi, header_comment + "\n\n") 24 | if !data[header_comment] 25 | data = header_comment + "\n\n" + data 26 | end 27 | 28 | if false 29 | puts "------- BEGIN FILE #{header_filename} ----------" 30 | 31 | puts data 32 | 33 | puts "------- END FILE #{header_filename} ----------" 34 | puts "" 35 | end 36 | 37 | File.open(header_filename, "w"){|f| f.write data } 38 | end 39 | 40 | # Update combined headers 41 | 42 | File.open("CoreBitcoin/CoreBitcoin.h", "w") do |f| 43 | f.write(header_comment + "\n\n") 44 | header_filenames.each do |path| 45 | f.write("#import <#{path}>\n") 46 | end 47 | end 48 | 49 | File.open("CoreBitcoin/CoreBitcoin+Categories.h", "w") do |f| 50 | f.write(header_comment + "\n\n") 51 | f.write("#import \n") 52 | header_ext_filenames.each do |path| 53 | f.write("#import <#{path}>\n") 54 | end 55 | end 56 | 57 | --------------------------------------------------------------------------------