notme
Legendary
Offline
Activity: 1904
Merit: 1002
|
|
February 19, 2013, 08:59:23 PM |
|
I've almost decided now to continue using GPLv3 but with an exception for OpenSSL and another exception allowing for distribution of binary forms without the source code (thought the GPL does allow for these exceptions to be removed when conveying copies).
And my mind is settled on using a copy-left license. Sorry for all those that do not like copy-left.
I'm currently working upon an "accounter", which is code that looks for transactions with particular output scripts and can thus keep track of transactions and balances for bitcoin addresses or whatever type of output. It also keeps track of unspent outputs. Bizarrely this is more awkward than I thought it would be. This code does not manage private keys.
I will be looking at modifying the database code to store the index on disk, to prevent high memory usage, and looking to cache certain pieces of data. At the moment the entire index is loaded to memory.
Why not just use a BSD license if you're going to take the teeth out of the GPL?
|
|
|
|
onelineproof
|
|
March 11, 2013, 07:35:46 AM |
|
Hi, not sure if it's useful, but I created lightweight bitcoin wallet tool called cwallet, implemented in C: https://github.com/piratelinux/cwalletIt's good for reading the address and private key pairs in a wallet, as well as creating a paper wallet with QR codes. There's a CLI version and a GUI version. I recently did some hacking around and added a feature that let's you see the address associated with a brainwallet as well as try to "hack" the password of an address generated by a brainwallet. I still didn't add this into the repo yet. I also plan to have a feature that lets you check the balance associated with an address by querying the Bitcoin network.
|
|
|
|
paulie_w
|
|
March 13, 2013, 10:03:56 AM |
|
so how did this one handle the recent fork situation? :-)
|
|
|
|
rlh
|
|
August 23, 2013, 04:59:38 PM |
|
What's the story on this project? Any further momentum?
|
A Personal Quote on BTT from 2011: "I'd be willing to make a moderate "investment" if the value of the BTC went below $2.00. Otherwise I'll just have to live with my 5 BTC and be happy. :/" ...sigh. If only I knew.
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
August 23, 2013, 05:25:11 PM |
|
Hi. I was busy for quite a few months earlier in the year, but I'm now able to put more work towards this. The most up-to-date branch is this one: https://github.com/MatthewLM/cbitcoin/tree/accountingAndNodesI've finished the accounting code now which keeps track of balances, transactions and unspent outputs for "accounts". These accounts are calculated with a list of watched outputs, so you can watch bitcoin addresses for wallets or whatever, and store the account information. It was designed so that you could have multiple accounts. Now I'm working on finishing off the node code (both full validation and SPV). Progress has not been so bad for that. I'm currently working on producing features for the protocol version 60000, but other things such as the bloom filtering can come later.
|
|
|
|
tspacepilot
Legendary
Offline
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
|
|
August 24, 2013, 03:07:54 AM |
|
Thanks for this, I may just try it out! I didn't see what kind of licensing in your OP? Is it GPL?
|
|
|
|
|
rlh
|
|
September 04, 2013, 03:46:20 PM |
|
I have this in my Watchlist, but somehow I've missed the additional discussion. Thanks for the update. I'll be keeping my eye on this project once it near, fully implemented.
|
A Personal Quote on BTT from 2011: "I'd be willing to make a moderate "investment" if the value of the BTC went below $2.00. Otherwise I'll just have to live with my 5 BTC and be happy. :/" ...sigh. If only I knew.
|
|
|
hivewallet
|
|
October 08, 2013, 09:38:37 AM |
|
Wow, nice work. This could be great for embedded devices!
|
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
October 08, 2013, 02:15:30 PM |
|
Thanks. The library may be useful for embedded devices, though there will need to be at least a partial implementation of the C standard library, and to use all of the features you will to implement things like the cryptography, threading and network functions. At the moment cbitcoin has a core library which is in C99 only, and it has separated libraries which use POSIX libraries, libevent and OpenSSL. These separated libraries can be replaced by alternative code or ignored if they are not needed. So for instance if you want to use cbitcoin but don't want networking, the networking functions do not need to be implemented and thus there is no need to link to libevent.
|
|
|
|
hivewallet
|
|
December 11, 2013, 08:39:40 PM |
|
cbitcoin now has a fully validating node implementation. There is still much work to do. There are a lot of memory leaks that have not been resolved yet for a start.
Once again, thanks to people who have donated. The donations are now worth a good amount of money. I'm still open for more bitcoin donations (1D5A1q5d192j5gYuWiP3CSE5fcaaZxe6E9), and I would be happy to receive any offers for code contribution.
I haven't implemented a headers-only node as of yet. Before I do that I will like to test cbitcoin over the real bitcoin network by implementing a basic client. Now that should not be too difficult (I hope) since I can extend an interface on-top of the node software.
Wow Matthew, congratulations! That's a massive achievement!
|
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
December 11, 2013, 08:45:20 PM |
|
Thanks. I've not actually tested it running on the bitcoin network yet so let's hope it goes smoothly!
|
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
January 18, 2014, 07:18:10 PM |
|
I've fixed the address generation example and also added a (basic) generator for all upper-case and digit addresses such as this one I just generated: 17BK2E43VFA57KE6X5GQUAH12ECE7WL227.
cbitcoin now supports HD keys (BIP0032), it can properly construct and sign transactions of the standard types, various other things have been improved and there is a client on the way.
|
|
|
|
linuxdoctor
Newbie
Offline
Activity: 6
Merit: 0
|
|
February 11, 2014, 03:53:44 AM |
|
cbitcoin now has a fully validating node implementation. There is still much work to do. There are a lot of memory leaks that have not been resolved yet for a start.
Yes, I've found one. This is from dependencies/random/CBRand.c: bool CBGet32RandomBytes(uint8_t * bytes){ FILE * f = fopen("/dev/random", "r"); return fread(bytes, 1, 32, f) == 32; } I'm looking at the cbitcoin library for my own edification and possibly integrating it into something. I'm new to bitcoin in general and before I begin to use it (if I decide to use it) I want to know everything I can about it. Reading the code of various implementations of different parts of bitcoin (servers, miners, clients, etc.) has been an education. Anyway, in looking at this file (quite by accident incidentally) I discovered that you did not close the file after reading from it. Which means every time you get some RandomBytes you will use a new file descriptor. This will leak a lot of memory and waste file descriptors to boot. It becomes a race between running out of memory or running out of file descriptors.
|
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
February 11, 2014, 02:31:51 PM |
|
Thank you linuxdoctor. I've added a fix and it will be available in the next commit. If you want to know anything about the library make sure to get in touch.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 11, 2014, 02:36:25 PM |
|
It becomes a race between running out of memory or running out of file descriptors.
Typically the # of file descriptors is quite small compared to available memory so I'd think the latter would be the main problem but still a memory leak nonetheless. Glad to see this project is still going (has been a while since I'd followed this topic).
|
|
|
|
linuxdoctor
Newbie
Offline
Activity: 6
Merit: 0
|
|
March 22, 2014, 02:16:39 AM |
|
I've been away doing other projects but spent a few hours playing with cbitcoin this evening and found a few more bugs and possible solutions. I've compiled some unified diffs. The diffs are between the current git repository and a fork (named cbitcoin-2014-03-21). 1. Function CBNewBlockChainStorage() crashes when trying to free self->database which is never initialized at this point. At this point, the function is doing cleanup on an error but should just free self since everything before it has already been freed. --- ./library/dependencies/storage/CBBlockChainStorage.c 2014-03-21 19:53:02.744321264 -0400 +++ ../cbitcoin-2014-03-21/./library/dependencies/storage/CBBlockChainStorage.c 2014-03-21 01:17:12.000000000 -0400 @@ -38,7 +38,7 @@ CBFreeIndex(self->blockHashIndex); } CBLogError("Could not load one of the block chain storage indices."); - CBFreeDatabase(self->database); + free(self); return false; } void CBFreeBlockChainStorage(CBDepObject self){
2. Function CBOnUpToDate is never declared (nor do I know how to use it) nor is CBCallBacks callbacks initialized to point to it. This then crashes cbitcoin example server whenever some routine tries to access callbacks->updatetodate. Simple fix. --- ./client-server/src/main.c 2014-03-21 19:53:02.738321373 -0400 +++ ../cbitcoin-2014-03-21/./client-server/src/main.c 2014-03-21 18:36:45.608202593 -0400 @@ -66,6 +66,9 @@ void CBOnTransactionUnconfirmed(CBNode * node, uint8_t * txHash){ } +void CBOnUpToDate(CBNode * node, bool truefalse){ + +} CBNetworkAddress * CBReadNetworkAddress(char * ipStr, bool isPublic){ CBSocketAddress saddr = {NULL, 8333}; char * portStart; @@ -286,7 +289,8 @@ CBOnNewTransaction, CBOnTransactionConfirmed, CBOnDoubleSpend, - CBOnTransactionUnconfirmed + CBOnTransactionUnconfirmed, + CBOnUpToDate }; CBNodeFull * node = CBNewNodeFull(database, nodeFlags, otherTxsSizeLimit, callbacks); if (!node) {
3. This is a tricky one. in CBEcdsaVerify() if o2i_ECPublicKey() fails it writes a NULL into key which EC_KEY then tries to free. Result: crash. This is a work around which creates two copies of the new EC_KEY. If key gets stomped on then we can free the copy in eckey. Interestingly, ECDSA_verify harmlessly passes over any NULL value in key (although I wouldn't count on any future version doing so). --- ./library/dependencies/crypto/CBOpenSSLCrypto.c 2014-03-21 19:53:02.741321318 -0400 +++ ../cbitcoin-2014-03-21/./library/dependencies/crypto/CBOpenSSLCrypto.c 2014-03-21 19:44:44.181601752 -0400 @@ -84,9 +84,13 @@ RIPEMD160(data, len, output); } bool CBEcdsaVerify(uint8_t * signature, uint8_t sigLen, uint8_t * hash, uint8_t * pubKey, uint8_t keyLen){ - EC_KEY * key = EC_KEY_new_by_curve_name(NID_secp256k1); + EC_KEY *eckey, * key; + int res = 0; + + eckey = key = EC_KEY_new_by_curve_name(NID_secp256k1); o2i_ECPublicKey(&key, (const unsigned char **)&pubKey, keyLen); - int res = ECDSA_verify(0, hash, 32, signature, sigLen, key); - EC_KEY_free(key); + if ( key != NULL ) + res = ECDSA_verify(0, hash, 32, signature, sigLen, key); + EC_KEY_free(eckey); return res == 1; }
|
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
March 23, 2014, 04:12:30 PM |
|
Thanks very much linuxdoctor. I've added your fixes, except for the second one which is not included in my latest source code. There are several bugs I'm working on at once, I'll hopefully push them to github later or sometime soon.
|
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
March 29, 2014, 01:33:11 PM |
|
You can now donate via Paypal or Charitycoin: Paypal: Click here!Charitycoin: CSU54ZAa4VuhiVwzgyAudePmn7eJigkKU5
|
|
|
|
MatthewLM (OP)
Legendary
Offline
Activity: 1190
Merit: 1004
|
|
June 04, 2014, 02:02:23 PM |
|
cbitcoin is now using the MIT license.
|
|
|
|
|