Pages:
Author

Topic: [ANNOUNCE] picocoin and libccoin -- C-based bitcoin library and client - page 3. (Read 30594 times)

sr. member
Activity: 248
Merit: 250
1. Collect underpants 2. ? 3. Profit
In light of the current "51% attack" brouhaha raging on Reddit, how difficult would it be to add some p2pool mining functionality to the picocoin library?

All the core bitcoin and p2p functionality is there, ready to be built upon.
sr. member
Activity: 248
Merit: 250
1. Collect underpants 2. ? 3. Profit
How close to the regular bitcoin code is it?

  • Supports all core data structures and network messages
  • Full script implementation
  • Passes hundreds of available reference client tests
  • Supports multiple block chains: main or testnet3
  • Written by bitcoin core developer

sr. member
Activity: 364
Merit: 250
This is interesting. How close to the regular bitcoin code is it?
sr. member
Activity: 248
Merit: 250
1. Collect underpants 2. ? 3. Profit
all pull requests will be reviewed, tested and merged with lightning speed Smiley


ahem......#25 Smiley

On a more serious note, I mentioned previously that I was investigating introducing LMDB to the picocoin project. Before delving too deeply into this should the OpenLDAP Public Licence used by LMDB be a concern when used in a MIT/X11 software licensed project like picocoin?



legendary
Activity: 1596
Merit: 1091
If picocoin (or more specifically brd) is lightweight enough it could be built as a DD-WRT and/or OpenWRT package. We would then potentially have tens if not hundreds of thousands routers in peoples homes working as bitcoin relays.

It is more a question of whether or not a platform is heavyweight enough to support a full node.

At first blush, you need enough data storage to store the entire blockchain (though perhaps mount over NFS), enough CPU to verify incoming data, and enough bandwidth to send and receive data.

sr. member
Activity: 248
Merit: 250
1. Collect underpants 2. ? 3. Profit
There has been a noticeable decline in the number of active bitcoin nodes over the past few months. The following website has some nice graphs showing this decline:


Maybe picocoin is a possible solution to this declining trend.

If picocoin (or more specifically brd) is lightweight enough it could be built as a DD-WRT and/or OpenWRT package. We would then potentially have tens if not hundreds of thousands routers in peoples homes working as bitcoin relays.

sr. member
Activity: 248
Merit: 250
1. Collect underpants 2. ? 3. Profit
blkdb is required and is always used.  It is the block header database.  It is kept in RAM, as bitcoind does.  It is optionally stored in a file, in addition to RAM.  It is optionally regenerated from the 17+GB blockchain file, if blkdb is missing.

OK, thanks for the explanation.

Along with some other handy features LMDB can have multiple sub-databases. I haven't thought things out fully yet but blkdb could possibly be stored as a sub-database with the blockchain as another sub-database or collection of sub-databases, performance permitting. Or maybe plagiarise the libbitcoin database layout a bit.
legendary
Activity: 924
Merit: 1129
What I don't see in these libraries, that I would very much like to see, is comments that say which things you cannot touch or what kind of changes you can make in the block structure, without breaking compatibility with existing ASIC miners. 

Anybody know? 

Anybody know who knows? 

legendary
Activity: 1596
Merit: 1091
Hi Jeff,

I'm trying to get my head around the brd.c code with a view to introducing LMDB to the picocoin project.

There's a few things I don't yet get. It seems that brd no longer stores blocks in brd.blkdb (it's commented out in code) but uses brd.blocks instead. But, there are still attempts to write to brd.blkdb, like calling blkdb_add(), which I think will always fail.

So, can the blkdb.c code be removed or does it just need a tidy-up?

blkdb is required and is always used.  It is the block header database.  It is kept in RAM, as bitcoind does.  It is optionally stored in a file, in addition to RAM.  It is optionally regenerated from the 17+GB blockchain file, if blkdb is missing.

sr. member
Activity: 248
Merit: 250
1. Collect underpants 2. ? 3. Profit
Hi Jeff,

I'm trying to get my head around the brd.c code with a view to introducing LMDB to the picocoin project.

There's a few things I don't yet get. It seems that brd no longer stores blocks in brd.blkdb (it's commented out in code) but uses brd.blocks instead. But, there are still attempts to write to brd.blkdb, like calling blkdb_add(), which I think will always fail.

So, can the blkdb.c code be removed or does it just need a tidy-up?
legendary
Activity: 1596
Merit: 1091
Because of stupid node selection, it takes a while to cycle through dead addresses passed to your node from other nodes.  You can use addnode etc.
newbie
Activity: 4
Merit: 0
A bit more detail on test of picocoin.

picocoin debug netsync &> debug.txt

net: parent exec NC_START
net: have 46188/46188 peers
net: blkdb opened
net: gc'd 0 connections
net: open connections (have 0, want 8 more)
...     [ tries/connects to 8 ips ]
net: parent after NC_START
net: engine started. sleeping 10 minutes (cxn tmout 11 sec)
net: connected to 68.224.[scrubbed]
net: 68.224.[scrubbed] message version
net: 68.224.[scrubbed] version(70002, 0x1, 1397475165, To:[scrubbed], From:68.224.[scrubbed], /Satoshi:0.9.0/, 295782)
net: 68.224.[scrubbed] message verack
net: 68.224.[scrubbed] message alert
net: 68.224.[scrubbed] message inv
...     [ first timeout error reported - it's the first ip tried/connected ]
net: gc'd 1 connections
net: open connections (have 7, want 1 more)
...     [ keeps trying connections as previous connections timeout ]
net: 68.224.[scrubbed] message inv
net: 68.224.[scrubbed] message addr
net: 68.224.[scrubbed] addr(2 addresses, 0 old)
...     [ as before: new made, old dropped ]
...     [ a few ipv6 fails: '' ]
socket connect [scrubbed]:  Network is unreachable
net: failed to start connection to [scrubbed]
...
net: gc'd 1 connections
net: open connections (have 7, want 1 more)
net: connecting to [scrubbed]
net: 68.224.[scrubbed] message inv
net: stopping engine
peerman: 46707 peers to write

(Got 53982 peers last time tried.)


Looked at net connections: netstat -tp | grep picocoin  (ran in loop).

Shows only one ESTABLISHED others are SYN_SENT.

Not likely a firewall block, as picocoin talks to the one.
Connections being ignored?
Get SYN_SENT status only before timeouts; no further SYN-ACK or ACK steps in the connection handshake ...except for the one.

Can get other IPs to connect with block relay daemon (brd). Timeout stderr messages persist, though.

Adding an address which connected with brd doesn't increase number of connections made by picocoin; still speaks only to the one address.

Thanks for today!


(Not complaining, just saying.)
legendary
Activity: 1596
Merit: 1091
Hi,
i pulled down and tried to compile picocoin on my system.
Linux XXXXXXXXXXX 2.6.32-431.5.1.el6.i686 #1 SMP Tue Feb 11 21:56:33 UTC 2014 i686 i686 i386 GNU/Linux ( centos 6.5 final)
now with the latest and greatest i found the following small mistakes:

1. in brd.c you need to include socket.h and netinet/in.h in order to successfuly compile.
2. in blkscan.c and most probably in many other places you create a dependency on glib 2.28 to 2.30. if i might suggest:
 in blkscan.c "print_txout(bool show_from, unsigned int i, struct bp_txout *txout)" you can do the following:
 
Code:
                #if GLIB_CHECK_VERSION (2, 28, 0)
   g_list_free_full(addrs.pub, g_buffer_free);
   g_list_free_full(addrs.pubhash, g_buffer_free);
#else
  //addrs.pub cleanup
  g_list_foreach (addrs.pub, (GFunc) g_buffer_free, NULL);
  g_list_free (addrs.pub);
  //addrs.pubhash cleanup
  g_list_foreach (addrs.pubhash, (GFunc) g_buffer_free, NULL);
  g_list_free (addrs.pubhash);
#endif

3. similar as above in txmod.c "mutate_outputs(void)" you can:

Code:
if (!tx.vout){
#if GLIB_CHECK_VERSION (2, 30, 0)
tx.vout = g_ptr_array_new_full(8, g_bp_txout_free);
#else
tx.vout = g_ptr_array_sized_new (8);
g_ptr_array_set_free_func (tx.vout, (GDestroyNotify)g_bp_txout_free);
#endif
}


Thanks for pointing out several locations incompatible with older GLib versions.

In general, #ifdefs directly placed in the library code are to be avoided.  The pattern to follow is updating compat.h with

Code:
#if VERSION < X
  provide wrapper or full implementation of missing function
#endif

If there is a missing function, add the function to compat.h, inside a version check.

newbie
Activity: 4
Merit: 0
Still getting timeout errors and no connection. My mistake?

Tried 'picocoin addnode=012.345.678.9 8333 netsync', but does not (yet) succeed. I used addresses from dns-seeds.

The best I can get is a long list of peers (wc -l picocoin.peers gives almost 2000); dns-seeds lists 97-131 each time.
Also got a few 'llnet: ... read EOF' results in among the 'net: ... connection timeout' results.

Anyone else succeeding/failing to get a picocoin.blkdb with the current version? Mine is still 0 KB.


Made a few icons and 'nix Bourne shell scripts to help run picocoin.
Icons made with ImageMagick on Debian.

Scripts should go in /usr/sbin/, or wherever your script bin is. Maybe they're useful for somebody?  
Extraxt with 'tar -xvjf buttn.tar.bz2'. Sorry, no scripts for msWin users (-_-)
...maybe Darwin (mac) can use the scripts? OK for Android, too.

I hope this encourages testing, exploration, and development of the project.

One script, pcoin.sh, loads a new CLI window and runs the second script, picocoin.sh. Aterm is called in pcoin.sh and a code example for rxvt is commented. One might rename it to the shorter pcoin, as there's no conflict with the program name (also p is the SI prefix for pico).
Edit the scripts as you like.

The picocoin.sh makes '.picocoin' directory, if not yet created, in users' home and changes to it.
User is asked for a passphrase, confirmed by retyping. That's exported to environmental variable in a new subshell.
The command prompt waits for picocoin commands.

When done there is no need to 'cd' back to original directory.
With command 'exit' the window closes if run from pcoin.sh or clears if picocoin.sh is run alone. Either way the passphrase is no longer in memory. Try 'echo $PICOCOIN_PASSPHRASE' to confirm.

I prefer to have the config and generated files in one place, uncluttered, hidden from view. We don't need regular access exept through the Bitcoin client. This also prevents the dropping of files all over the filesystem when picocoin is started from different curdirs.


Included with scripts are icons and a toy html page to show/play with the icons. The first 'button' has a radio option where down image is/not very small.
Click and hold down a second, release, and wait...

Eagerly awaiting developments.


Have fun Smiley


File: buttns.tar.bz2   51787 B (52 KB)
(P2P Torrent)

magnet:?xt=urn:btih:ee75467fd552464eeb266bf5bf46fd2581e46fa5&dn=buttns.tar.bz2

[edit removed trackers from torrent]
newbie
Activity: 3
Merit: 0
Hi,
i pulled down and tried to compile picocoin on my system.
Linux XXXXXXXXXXX 2.6.32-431.5.1.el6.i686 #1 SMP Tue Feb 11 21:56:33 UTC 2014 i686 i686 i386 GNU/Linux ( centos 6.5 final)
now with the latest and greatest i found the following small mistakes:

1. in brd.c you need to include socket.h and netinet/in.h in order to successfuly compile.
2. in blkscan.c and most probably in many other places you create a dependency on glib 2.28 to 2.30. if i might suggest:
 in blkscan.c "print_txout(bool show_from, unsigned int i, struct bp_txout *txout)" you can do the following:
 
Code:
                #if GLIB_CHECK_VERSION (2, 28, 0)
   g_list_free_full(addrs.pub, g_buffer_free);
   g_list_free_full(addrs.pubhash, g_buffer_free);
#else
  //addrs.pub cleanup
  g_list_foreach (addrs.pub, (GFunc) g_buffer_free, NULL);
  g_list_free (addrs.pub);
  //addrs.pubhash cleanup
  g_list_foreach (addrs.pubhash, (GFunc) g_buffer_free, NULL);
  g_list_free (addrs.pubhash);
#endif

3. similar as above in txmod.c "mutate_outputs(void)" you can:

Code:
if (!tx.vout){
#if GLIB_CHECK_VERSION (2, 30, 0)
tx.vout = g_ptr_array_new_full(8, g_bp_txout_free);
#else
tx.vout = g_ptr_array_sized_new (8);
g_ptr_array_set_free_func (tx.vout, (GDestroyNotify)g_bp_txout_free);
#endif
}


as a side note, be aware that on centos systems the stock libevent is not working ( it is at version is 1.4)  and you have to install libevent 2.x from source

regards,
JD
newbie
Activity: 4
Merit: 0
@ jgarzik

Thanks for doing the diagnosis. It was my fault, of course.

Made no headway for quite a while tried changing... and many other fails. Gave up those routes.
Compiled new glib 2.40 from source.

Eventually it compiled very quickly Wink

Now I have it running. Test drive time.
I really like it. Keep up the good work!

Being able to move the existing bitcoid (etc.) wallet to picocon would encourage users to try it.
Maybe one should be able import the wallet-addr to picocon.wallet?

Is this possible?

It doesn't matter to me, as I have no stacks of coins to move or spend yet.
I'm still trying out the software and reading up. Learning.

Netsync still times out -- must get the right timeout value, I guess.
$ picocoin net.connect.timeout=240 netsync

You wrote on Github:
   
Quote
This is unfortunately normal -- you should try to addnode. Otherwise it takes a while to cycle through addresses, until it hits a live node.

The network peer manager code needs improvement.

Noob question: Which node/how do i find it?

Does picocoin connect through a proxy like polipo/privoxy or tor/SOCKS yet? This will be a popular feature.

Can we use nickname with 'picocoin new-address'? How about delete after address used/emptied of coins?

A secure way to "run it" on a MSWin system is from a quemu image, possibly on a removable drive.
Vbox (or portable vbox) is faster, but quemu doesn't require administrative privileges.
MSWin users can still get fork.

Of course TC and other small linux OSs can be booted from usb... without emulation or virtualization.

Maybe these are silly ideas. I'm sure you've heard them all.

I made a small script to get the passphrase and put it into the environmental var for the shell instance.
Saves me typing export... and reminds me not to use the window for anything else.

I wish I could help, but can not write -- read only  Embarrassed

legendary
Activity: 1596
Merit: 1091
../include/ccoin/compat.h:26: error: static declaration of 'g_list_free_full' follows non-static declaration
/usr/local/include/glib-2.0/glib/glist.h:53: note: previous declaration of 'g_list_free_full' was here

Diagnosis:  Typically a system either (a) needs compat.h help due to older GLib, or (b) does not need such help.  All systems should be either "a" or "b".  Your system configured as both "a" and "b".

The most likely fix is to make sure you have GLib > 2.30, properly installed with pkg-config support.

Alternately, you may try manually editing compat.h to comment out the offending lines, and see if that works for you.
Code:
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 30))
...
#endif /* GLIB_VERSION < 2.30 */
newbie
Activity: 4
Merit: 0
No recent progress, but any and all pull requests will be reviewed, tested and merged with lightning speed Smiley


I look forward to it. Thanks!


Been trying to compile picocoin on tinycore (http://tinycorelinux.net).

Complied jansson package ok. Then started with picocoin.

I did 'autoreconf -vi' and './configure'. All good.
Did not get to 'make DESTDIR=/mnt/sdb1/tmp/picocoin install-strip'.

Shame, as this looks like a great little package. I searched for and found it!
Now to test drive... I hope the SPV client is working (or soon)!


Fatal make errors are reported at 'make test' (and so 'make install' will also fail).

My c-coding is weak, so as to not make a mess of it I ask that someone take a look Huh
Perhaps my method is obviously wrong?

Rather than register at github I posted here. OK?


Here is the end of 'make test' output:


Making check in lib
make[1]: Entering directory `/mnt/sdb1/picocoin-master/lib'
gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include/glib-2.0 -I/usr/local/lib/gli
b-2.0/include   -I../include    -march=i486 -mtune=i686 -Os -pipe -MT addr_matc
h.o -MD -MP -MF .deps/addr_match.Tpo -c -o addr_match.o addr_match.c
In file included from addr_match.c:11:
../include/ccoin/compat.h:26: error: static declaration of 'g_list_free_full' f
ollows non-static declaration
/usr/local/include/glib-2.0/glib/glist.h:53: note: previous declaration of 'g_l
ist_free_full' was here
make[2]: *** [addr_match.o] Error 1
make[2]: Leaving directory `/mnt/sdb1/picocoin-master/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mnt/sdb1/picocoin-master'
make: *** [all] Error 2


Seems these pages refer to something along the same lines.
--error: static declaration of 'foo' follows non-static declaration--


http://stackoverflow.com/questions/3148244/static-declaration-follows-non-static-declaration

https://www.linuxquestions.org/questions/programming-9/error-previous-declaration-of-xxxxx-was-here-627195/


sr. member
Activity: 248
Merit: 250
1. Collect underpants 2. ? 3. Profit
I noticed that PolarSSL also provides some networking functionality like:

Code:
net_connect()
net_bind()
net_accept()
net_set_block()
net_set_nonblock()
net_usleep()
net_recv()
net_send()

I know picocoin's networking functionality works perfectly well and it's probably a case of "if it ain't broke, don't fix it". But I might investigate getting PolarSSL to do some of the networking heavy lifting if possible. It may turn out to be a quick and easy way of making picocoin IPv6 compatible (I haven't looked too closely at the networking code yet but I don't think it is currently).

Then again, I probably shouldn't be getting ahead of myself and should just wait until the PolarSSL crypto related stuff is working first.  Smiley


EDIT:

OK, a quick scan of the picocoin network code shows that picocoin may already be IPv6 compatible. Ignore above statements.

legendary
Activity: 1596
Merit: 1091
Also Jeff,

You have seen my attempts at swapping out the OpenSSL dependency in favour of PolarSSL to facilitate having picocoin run on low powered and embedded devices.

PolarSSL developers have indicated that they plan on releasing a new update early next week: https://github.com/polarssl/polarssl/issues/71

This new release should mean that PolarSSL now implements all bitcoin requirements. The PolarSSL guys have been most helpful on this.

Yep, looking forward to it.

Pages:
Jump to: