[Pettycoin-dev] Pettycoin from Python 3

Rusty Russell rusty at rustcorp.com.au
Thu Sep 11 16:49:38 EST 2014


Nelson Castillo <nelsoneci at gmail.com> writes:
> On Wed, Sep 10, 2014 at 10:36 PM, Rusty Russell <rusty at rustcorp.com.au>
> wrote:
>
>> Nelson Castillo <nelsoneci at gmail.com> writes:
>> > Hello there.
>> >
>> > I wrote some code to call Pettycoin from Python 3.
>> >
>> >   https://github.com/arhuaco/pypettycoin/
>> >
>> > First, fun with JSON.
>> >
>> > When Pettycoin sends JSON replies the size of the reply is not known in
>> > advance, so you have to use non-blocking UNIX sockets and parse on the
>> fly.
>>
>> Hi Nelson,
>>
>>         Great work!  Did you want some option which would put the length
>> at the front to make this easier?  We could use a second socket, or just
>> have a "prependlength" command which you would issue first.
>>
>
> Hi there Rusty.
>
> Do you know the length of the reply in advance?

Yes, the code is not clever enough to marshal on the fly.

> Another way of stating the question: Does adding "prependlength" mean you
> have to use a buffer (more memory)?

Not really.  We call a callback to get the response, then send it.  It
would be trivial to write the length first.

> Now that the code to wait for Pettycoin replies is written I do not really
> care. It just works :-)

Fair enough :)

> And I think it is easy to port it to other languages, specially if the
> Pettycoin replies allow trivial parsing (never contain '{' or  '}' in
> strings).

I can't immediately see that we'll allow user comments in the output
(unlike bitcoin, I don't intend that pettycoin contain a wallet: that
will be a separate program).

Thanks,
Rusty.


More information about the Pettycoin-dev mailing list