Add JSON parsing from stdin.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Add --rpc option to allow connection to JSON-RPC.

socat works well for this on Unix:
	socat - UNIX-CONNECT:/tmp/rpc

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pettycoin_query: tool to query a running pettycoin.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Neaten up JSON support.

Share code between pettycoin's JSON RPC and pettycoin_query.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rename --rpc to --rpc-file, make default pettycoin-rpc, full async.

Also do some pretty-printing of results.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
More json-rpc shuffling.

Expose structure to callbacks, since they'll need it if they want to
do notifications or tal() off it.

Allow injection of new outputs (required for notification).

Rename 'echo' to 'dev-echo'.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Allow base58 decode on unterminated strings.

Required for handling json tokens.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tal_arr: helpers for managing arrays of pointers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Don't return empty-string for non-bitcoin-style base58 printing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
More json helpers, with testing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Handle undefined extern struct decls in mock generation.
(and neaten function generation slightly).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
getinfo json command.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autogenerate error code names.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
sendrawtransaction command.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Expose hex encode helper, fix empty params parsing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Handle cleanly when pettycoin disconnects.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rename inject to pettycoin-tx, and use JSON-RPC to send the tx.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Make common --pettycoin-dir and --rpc-file options, rename _ -> - in binary.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Add dev-gettodo JSON-RPC command.

And autogenerate names of packet types.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fix dangling GET_SHARD todos.

First, we shouldn't ask for shards if we've just mined a block.  Secondly,
we need to mark off the TODO when we get a shard successfully.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>