keeshux / bitcoinspv Goto Github PK
View Code? Open in Web Editor NEWA native Bitcoin SPV client library for iOS with BIP32 support.
License: GNU General Public License v3.0
A native Bitcoin SPV client library for iOS with BIP32 support.
License: GNU General Public License v3.0
the demo show how to use the bticoinspv
Am creating and signing new transaction just fine like this:
NSError *error;
WSAddress *address = WSAddressFromString(self.parameters, @"mu4CVtiGvVtE2wHosbHC58RE2hG4CnHnvj");
const uint64_t value = 5213;
WSTransactionBuilder *builder = [self.wallet buildTransactionToAddress:address forValue:value fee:0 error:&error];
WSSignedTransaction *tx = [self.wallet signedTransactionWithBuilder:builder error:&error];
DDLogInfo(@"Tx: %@", tx);
if (![self.peerGroup publishTransaction:tx]) {
DDLogInfo(@"Publish failed, no connected peers");
return;
}
Here is the signed tx info:
version = 1,
id = 880afa2349cc47ed3c510c433b744e2f8810327a82e7a3a83a71b4fb577742dc,
size = 227 bytes,
coinbase = NO,
lockTime = 0,
inputs =
{(
{address='mrnE6Yxhk2fgpv4XfGygFU1vRizse3eEju', outpoint=7ec02457c4a6079f852ba029552efbf0be527f5abc22355934b5d35917ede6a3:0, script='[304602210080aace26ee3cce97f219430d60c7638f66383384e3554525647d3adf4f8ceda9022100b47327cad11dda8a5db891535abcddf36dde7766338d1bf00190db9168dee1a101] [0342468eba0e276ae2d1242095690735846a216f0e6b037a9268779d854f622a00]', sequence=0xffffffff}
)},
outputs =
{(
{address='mu4CVtiGvVtE2wHosbHC58RE2hG4CnHnvj', value=5213, script='DUP HASH160 [94826312542abcdd7cf86494a55dc4ed1bd9aad0] EQUALVERIFY CHECKSIG'},
{address='moNtTSY3abxJQFyyKGDMZvBswifVg7dTJy', value=12345510, script='DUP HASH160 [563a7982692821c0d5f43b8c60410554703d8090] EQUALVERIFY CHECKSIG'}
)}
After being published I've got reject message from all the peers:
Received reject from (83.227.31.14:18333): <WSMessageReject: 0x60000046bc40> {message='tx', code=40, reason='non-mandatory-script-verify-flag (Non-canonical signature: S value is unnecessarily high)'}
Googling the issue doesn't help much. Am I missing something? @keeshux
Thanks
Hello keeshux!
I saw you recommend not to use your work since it’s still experimental.
At which point can we consider your code to be « unsafe » ?
I’d like to integrate it to general public apps but would like to know your opinion first, since it may handle real money, I need to make sure it is (at a minimum) reliable.
Bye for now!
Thanks.
Steps to reproduce:
App will crash when download is finished or nearly finished
2016-09-29 09:27:58.525635 Mana[1394:355331] *** Terminating app due to uncaught exception 'IllegalArgument', reason: 'No implicit path set, call saveToPath: first'
*** First throw call stack:
(0x18316c1c0 0x181ba455c 0x18316c094 0x1000e3d2c 0x1000edfe4 0x1000f1c2c 0x1000f13b8 0x1000d3a38 0x1000cdc28 0x10011da90 0x100112b64 0x100cf125c 0x100cf121c 0x100cfeb54 0x100cf4ce4 0x100cff0f0 0x100d00e6c 0x100d00bb8 0x1821fd2c8 0x1821fcdb4)
__pthread_kill + 8, queue = 'WSPeerGroup', stop reason = signal SIGABRT frame #0: 0x000000018213a014 libsystem_kernel.dylib
__pthread_kill + 8pthread_kill + 112 frame #2: 0x00000001820ae3f4 libsystem_c.dylib
abort + 140abort_message + 132 frame #4: 0x0000000181b96cc0 libc++abi.dylib
default_terminate_handler() + 304_objc_terminate() + 124 frame #6: 0x0000000181b9366c libc++abi.dylib
std::__terminate(void (*)()) + 16__cxa_throw + 136 frame #8: 0x0000000181ba4690 libobjc.A.dylib
objc_exception_throw + 364WSExceptionCheck(condition=NO, name=@"IllegalArgument", format=@"No implicit path set, call saveToPath: first") + 136 at WSErrors.m:60 frame #11: 0x00000001000edfe4 Mana
-[WSHDWallet save](self=0x0000000174151930, _cmd="save") + 80 at WSHDWallet.m:672-[WSHDWallet registerTransaction:didGenerateNewAddresses:batch:](self=0x0000000174151930, _cmd="registerTransaction:didGenerateNewAddresses:batch:", transaction=0x0000000170470fc0, didGenerateNewAddresses=NO, batch=NO) + 1708 at WSHDWallet.m:1144 frame #13: 0x00000001000f13b8 Mana
-[WSHDWallet registerTransaction:didGenerateNewAddresses:](self=0x0000000174151930, _cmd="registerTransaction:didGenerateNewAddresses:", transaction=0x0000000170470fc0, didGenerateNewAddresses=NO) + 88 at WSHDWallet.m:1095-[WSBlockChainDownloader handleReceivedTransaction:](self=0x0000000174123340, _cmd="handleReceivedTransaction:", transaction=0x0000000170470fc0) + 432 at WSBlockChainDownloader.m:956 frame #15: 0x00000001000cdc28 Mana
-[WSBlockChainDownloader peerGroup:peer:didReceiveTransaction:](self=0x0000000174123340, _cmd="peerGroup:peer:didReceiveTransaction:", peerGroup=0x000000017416e640, peer=0x0000000170114250, transaction=0x0000000170470fc0) + 136 at WSBlockChainDownloader.m:492-[WSPeerGroup peer:didReceiveTransaction:](self=0x000000017416e640, _cmd="peer:didReceiveTransaction:", peer=0x0000000170114250, transaction=0x0000000170470fc0) + 444 at WSPeerGroup.m:672 frame #17: 0x0000000100112b64 Mana
__27-[WSPeer receiveTxMessage:]_block_invoke((null)=0x0000000170856320) + 92 at WSPeer.m:650_dispatch_call_block_and_release + 24 frame #19: 0x0000000100cf121c libdispatch.dylib
_dispatch_client_callout + 16_dispatch_queue_serial_drain + 1136 frame #21: 0x0000000100cf4ce4 libdispatch.dylib
_dispatch_queue_invoke + 672_dispatch_queue_override_invoke + 496 frame #23: 0x0000000100d00e6c libdispatch.dylib
_dispatch_root_queue_drain + 584_dispatch_worker_thread3 + 140 frame #25: 0x00000001821fd2c8 libsystem_pthread.dylib
_pthread_wqthread + 1288First of all I'd like to say thanks for the great framework! I'm trying to figure out steps needed to create a raw transaction, sign it with wallet and broadcast to network. Could you please guide me through necessary steps? @keeshux
When i git clone the project to my desk, and pod install again, got an error that the file of DDTTYLogger.h can,t find always.
What is the reason?
Currently we're working on integrating bitcoinspv for OracolXOR wallet and we're facing issue in network connection to get balance, unspent txn, and all other server calls. Can someone please help us. Below is the WSParametersBuilder config class.
builder.magicNumber = 0xd9b4bef9;
builder.publicKeyAddressVersion = 0x89;
builder.scriptAddressVersion = 0x05;
builder.privateKeyVersion = 0x80;
builder.peerPort = 5001;
builder.bip32PublicKeyVersion = 0x0488b21e; // "xpub"
builder.bip32PrivateKeyVersion = 0x0488ade4; // "xprv"
builder.maxProofOfWork = 0x1d00ffff;
builder.retargetTimespan = 2 * WSDatesOneWeek; // the targeted timespan between difficulty target adjustments
builder.minRetargetTimespan = builder.retargetTimespan / 4;
builder.maxRetargetTimespan = builder.retargetTimespan * 4;
builder.retargetSpacing = 10 * WSDatesOneMinute;
builder.retargetInterval = builder.retargetTimespan / builder.retargetSpacing; // 2016
builder.genesisVersion = 1;
builder.genesisMerkleRoot = WSHash256FromHex(@"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b");
builder.genesisTimestamp = 1231006505;
builder.genesisBits = 0x1d00ffff;
builder.genesisNonce = 2083236893;
builder.dnsSeeds = @[@"192.227.107.209"];
builder.checkpointsHex = @"010000002f82b87670845faadde3fedd0dbf5040db62ba2b25c23e2c8408c17400000000ed73df5023c8e8f477fb965fe4c3cbfe5ee34b7d8b56c3efa3f3f9c0b275c91318526a4affff001dd953970400c04e0000064ec14ec14ec1010000001a231097b6ab6279c80f24674a2c8ee5b9a848e1d45715ad89b6358100000000a822bafe6ed8600e3ffce6d61d10df1927eafe9bbf677cb44c4d209f143c6ba8db8c784b5746651cce22211800809d000006aa83470b022201000000934c2bd5a456180b404341a380d20f51d0862b38311deb4d9505450900000000299a1702e49cf69bc3d0a6eee27510cc3cca5a427e1d000b2ccaf907116aaf4822c6124c64ba0e1c5423c2040040ec000007033108918048f5010000000e860de65c35a94d2e335be7d79aabb6e3ddf3918e6d65c61e5b230000000000e36abc2127229d3a94ae0e2067a0a75cab61629d5b2f01b927df43b6c0025a08976f954ced66471bfb11bb0300003b010007573c8422533f6201000000ddf75090bebe04fd00bd5d54945a7e775ff21a012374e284fe5a0200000000007a71100da32b454f15e1863b6dda148c830f92c0e99806c10f69ac6392ea3cb9335a214dcb04041b24da04f800c08901000806f5a2514ecc5ae0010000003d03ef67e92310f1f1161fcf6e3631bcd25a93e5e422b5ac84a30000000000007096173096e73db173c4b21ae76bbbbf655ebb5bd9662e91da721144c54eeada8c79bb4dfa98001b5898b8540080d8010008426823e1d78011b6010000000a5d88ccd0c56b9bbe4c84acae7250a2d4dc5ba92f52783dd3070000000000002c92030e6281be57bec776b084dc316febfcb2487ab96ec71708af36531955e976af494e864a091a1dda09ed004027020009047170e1c12bfa4b3001000000c48381c43b1d2ebd386c70971289aa69e974ff281fedd27f1b03000000000000fcec0145025b8ac811b486fc91f07f5a39a2170c2eee1066238dda4545af70b6c8df094fd7690d1a350999b50000760200090b2788722844ce4bff01000000b807c2dec8b735f71bba13196f69dc26d2c75ea831862bd7b4040000000000009061c7196a009b9616b0cbc1a93e70c6334e1bd6efe27908850ab034c659fef29579be4f5f8b0a1a225d77a700c0c40200091214b3a76adad52bb6010000009d6f4e09d579c93015a83e9081fee83a5c8b1ba3c86516b61f0400000000000025399317bb5c7c4daefe8fe2c4dfac0cea7e4e85913cd667030377240cadfe93a4906b50087e051a84297df70080130300091bd19c9ad8596dd8d001000000747ccc507cb0be8b458daaaf94c168f48a555fda0995a84cb3030000000000001460f2f1855d75fc1be8aaf21b58b004fecaae04ffc681b9c6cfda641f6221d7367a21515c98041a236d0dff0040620300092ae0d85d5ef4c3f67802000000410abeabf007c1247961d2acd133393fafea89af19ee6fb6d90000000000000037eb13c117f5099289a43abbd5a173fef04047db980c0cb84c6a1930f3b9c6141e30be5115de001a8c1431ed0000b103000952e3b250dd8600d6ed02000000c1ff84e95f9a73d760b37e444056b74867fcd8a382e13cc110000000000000003998741bf1f6806b26bc8496f4efbccd52ca36b27b827c2dfb6f1f055e72c3a4d8765152cab016191b45807600c0ff03000a016cc42d7fd00b16f45102000000e03f401bd7d2484a323ecd4b6bf9945a1a35de61a442355102000000000000003eb2df22382e43f5b527c0a6b8b230bccb93947043b7f9357ad3f6591f2897498e6ae2522cf50119a2ca673500804e04000a100bbd541d5a61923e1d020000006653331789442da38ff405a9f3807c7d3407a7e085b5e90e0000000000000000c5652bd21f27a0873515c5a538fc741ee61201d72413c1856e0986707ce3604dee798053422869186bda24f300409d04000a6d82e3c93a69c3f49d40020000000f6af938320a7efb354df9da98f3e5c0a1de0715a2d107160000000000000000baba50a2116b65022b437a9c912c83d18c39a161d88d5d261011413c79570b735087245493b81f1869e5702b0000ec04000b01c8cf1d42683da610ee6002000000dc0ae15cad873162f27db2ff33d9fbe2193aa492e1e9d1050000000000000000339167c2bdf04f5aa7aa56b1ab8925619e7d851e2586d771c519402c640ed5e7dfd4d85487bb1818649c7a5200c03a05000b0495913a4601568a789d0902000000063c2ef9016bf32a904eead62a7cc120cffa3cf243197206000000000000000018b6461deb0d4d9fc9c663a101474332aeaaf7750cc7b003fb71e0494e503d8c2e9d8f558e41161826b07eda00808905000b07fe7cdecae05f1402ff94";
We're not aware about params required to be updated to integrate different blockchain. We just updated dnsSeeds
and publicKeyAddressVersion
param value.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.