Pages:
Author

Topic: [ANNOUNCE] picocoin and libccoin -- C-based bitcoin library and client (Read 30760 times)

newbie
Activity: 4
Merit: 0
thank you marcus_of_augustus
legendary
Activity: 3920
Merit: 2349
Eadem mutata resurgo
thank you Aido.

how much effort, in your opinion, will take to have a full featured SPV node and HD wallet starting from the picocoin code?
do you know about any other SPV implementations in pure C?


I don't think there are any SPV clients in pure C out there.

mSIGNA https://github.com/ciphrex/mSIGNA is a c++ SPV client that is feature-rich
newbie
Activity: 4
Merit: 0
thank you Aido.

how much effort, in your opinion, will take to have a full featured SPV node and HD wallet starting from the picocoin code?
do you know about any other SPV implementations in pure C?

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

If you look at the code you will see that both the client (picocoin) and the block relay daemon (brd) both have a init_blkdb() function. This creates the emplty blkdb file.

brd also has a block_process() function which uses blkdb_add() for adding blocks to the file. This is what my query to Jeff was about in the previous post.

The client (picocoin) does not have a block_process() function so nothing more is done to the blkdb file after it is created.
newbie
Activity: 4
Merit: 0
thank you for the replay Aido,

I read that post but I thought it was related to the brd client that, if I understand, should be implementing a full node.
picocoin executable should be implementing the SPV node instead.
am I correct?
I will give a more deep read to the code..
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
Hi marcopal,

 Maybe this helps.......

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

Actually, that reminds me. I never did have a go at adding LMDB to picocoin.
newbie
Activity: 4
Merit: 0
I am trying to run picocoin (bitsy) as an SPV client.
I create a wallet and then I run the netsync command.
I always get an empty picocoin.blkdb file.
am I doing anythin wrong?
newbie
Activity: 14
Merit: 0
HI,

I see some seemingly contradiction in the code and documentation in the develope reference of bitcoin

https://bitcoin.org/en/developer-reference#data-messages

The currently-available type identifiers are:
Type IdentifierNameDescription
1MSG_TXThe hash is a TXID
2MSG_BLOCKThe hash is of a block header.
3MSG_FILTERED_BLOCKThe hash is of a block header; identical to MSG_BLOCK. When used in a getdata message, this indicates the response should be a merkleblock message rather than a block message (but this only works if a bloom filter was previously configured). Only for use in getdata messages.
Type identifier zero and type identifiers greater than three are reserved for future implementations. Bitcoin Core ignores all inventories with one of these unknown types.


Now if we look at code we see that type (3) is not mentioned in the code, when processing "inv" command.  (module brd.c)

 switch (inv->type) {
                case MSG_TX: strcpy(typestr, "tx"); break;
                case MSG_BLOCK: strcpy(typestr, "block"); break;
                default: sprintf(typestr, "unknown 0x%x", inv->type); break;
                }

Why does the brd.c not use MSG_FILTERED_BLOCK??  I am trying to understand the code with the bitcoin dev wiki.
Thanks for any answers you may give.
newbie
Activity: 14
Merit: 0
I added some logging to make the comminication more clear in brd
[20:27:53   GMT-23/04/2016][nc_conn_start][:818], connect start to:88.112.146.73
[20:27:54   GMT-23/04/2016][nc_conn_send][:315], attempting to send:[version] to 88.112.146.73
[20:27:55   GMT-23/04/2016][nc_conn_message][:665], version command received from 88.112.146.73.
[20:27:55   GMT-23/04/2016][nc_conn_send][:315], attempting to send:[verack] to 88.112.146.73
[20:27:56   GMT-23/04/2016][nc_conn_message][:678], verack command received from 88.112.146.73.
[20:27:56   GMT-23/04/2016][nc_conn_send][:315], attempting to send:[getaddr] to 88.112.146.73
[20:27:56   GMT-23/04/2016][nc_conn_send][:315], attempting to send:[getblocks] to 88.112.146.73
[20:27:56   GMT-23/04/2016][nc_conn_message][:691], addr command received from 88.112.146.73.
[20:27:57   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:03   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:03   GMT-23/04/2016][nc_conn_send][:315], attempting to send:[getdata] to 88.112.146.73
[20:28:03   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:04   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:04   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:16   GMT-23/04/2016][nc_conn_message][:691], addr command received from 88.112.146.73.
[20:28:16   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:16   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:16   GMT-23/04/2016][nc_conn_message][:697], inv command received from 88.112.146.73.
[20:28:16   GMT-23/04/2016][nc_conn_message][:703], block command received from 88.112.146.73.
brd: blkdb add fail  (havent figured this out why this happens)
blocks: process-block failed

newbie
Activity: 14
Merit: 0
Hi can some-one please confirm message sequence below?

Hi I am trying to understand the message sequence of BRD deamon, when initial connection is established

From the code i can see  (P1 initiates connection to P2)

P1 ---> connect--> P2
P1 --> sends 'version'  --> P2
P1 <--  reply 'version' -- P2   , in the code i see if the first received message is not "version" its an error
P1 --> sends verack -->P2   ,
P1 <-- reply verack <-- P2  , in code i see this must be the second message received
P1 -->request "getaddr" --> P2
P1 --> request "getblocks" --> P2

Is this correct so far? Thanks

newbie
Activity: 14
Merit: 0
questions questions questions

First i see that a new event (libevent) is created with when a "connect" is made with a socket, the event type is  EV_WRITE.  why not EV_READ aswell, Huh

 /* add to our list of monitored event sources */
                conn->ev = event_new(nci->eb, conn->fd, EV_WRITE,
                                     nc_conn_evt_connected, conn);


newbie
Activity: 14
Merit: 0
function "nc_conn_group_active" is a "dud" function?  I see it is called from "nc_conns_open"

Can someone explain the rational, you want to limit the number on a "group classification" basis?
.
.
   /* are we already connected to this network group? */
                if (nc_conn_group_active(nci, &conn->peer)) {
                        fprintf(plog, "net: already grouped to %s\n",
                                conn->addr_str);
                        goto err_loop;
                }

.
.


-- FUNCTION  nc_conn_group_active

static bool nc_conn_group_active(struct net_child_info *nci,
                                 const struct peer *peer)

{
        // FIXME
        return false;

        unsigned int group_len = peer->group_len;
        unsigned int i;
        for (i = 0; i < nci->conns->len; i++) {
                struct nc_conn *conn;

                conn = parr_idx(nci->conns, i);
                if ((group_len == conn->peer.group_len) &&
                    !memcmp(peer->group, conn->peer.group, group_len))
                        return true;
        }

        return false;
}
newbie
Activity: 14
Merit: 0
comment on my prev question

normally I use static linkage  

noinst_LIBRARIES = xxxxx.a

xxxxx_a_SOURCES = ... list of sources


The picocoin/lib/makefile.am uses LT and it iseems to install the binaries in .libs

Not worked much with the LIBTOOL as i mostly build static libs

lib_LTLIBRARIES..mmm time to break out the autotools book)
newbie
Activity: 14
Merit: 0
picocoin and brd are NOT BINARY executables?


#! /bin/sh

# picocoin - temporary wrapper script for .libs/picocoin
# Generated by libtool (GNU libtool) 2.4.2
#
# The picocoin program cannot be directly executed until all the libtool
# libraries that it depends on are installed.

#
# This wrapper script should never be moved out of the build directory.
# If it is, it will not operate correctly.

# Sed substitution that helps us do robust quoting.  It backslashifies
# metacharacters that are still active within double-quoted strings.



PS: I have libtool installed!!

sudo yum install libtool
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirror.root.lu
 * epel: mirro[Suspicious link removed]t-systems.com
 * extras: centos.mirror.root.lu
 * ius: mirrors.ircam.fr
 * nux-dextop: mirror.li.nux.ro
 * rpmforge: miroir.univ-paris13.fr
 * updates: mirror.23media.de
Package libtool-2.4.2-21.el7_2.x86_64 already installed and latest version
Nothing to do


 

newbie
Activity: 14
Merit: 0
sorry, 2a is a question..... forget '?'  ))
newbie
Activity: 14
Merit: 0
Hi,

couple of things

1) I want to use argp in all executables (brd and picocoin doesnt use them). this would be nice because we can put documentation in    --help.
2) I want to put the origin of a peer (from which seeds it comes from, as defined in dns.c  "dns_seeds" array ) into the bp_address structure( char *pointer). Part of a bunch of statistics I want to reveil in my frontend.
   a) Peers only come from the dns_seeds and are not discovered by being forwarded through other peers ( aka bitorrent)

3) Make an option to only to get ipv4 addresses from bootstrap nodes; default ipv6

If you want i will do the work.


Regards,
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
Yes, this would be doable.
newbie
Activity: 14
Merit: 0
Hi  Lucifer333,

Is it possible to enable IPv6 on your compu/ ISP?

Maybe we can make it configurable with a command line option (default would be ivp6)?
newbie
Activity: 14
Merit: 0
Hi  Lucifer333,

Is it possible to enable IPv6 on your compu/ ISP?

My adsl modem doesnt understand ipv6, I think many ppl still have the old hardware
sr. member
Activity: 248
Merit: 252
1. Collect underpants 2. ? 3. Profit
Hi  Lucifer333,

Is it possible to enable IPv6 on your compu/ ISP?
Pages:
Jump to: