block: add toJSON and fromJSON to Block.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
block: style concerns. fix `type` variable.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
block: add block tests. frame correct version for blocks.

Signed-off-by: Fedor Indutny <fedor@indutny.com>