private Transaction deserializeTransaction(byte[] arg0) { Transaction rcvdTx = null; BitcoinSerializer bs = new BitcoinSerializer(params, false); try { rcvdTx = bs.makeTransaction(arg0); } catch (ProtocolException e) { e.printStackTrace(); } return rcvdTx; }
@Override public Block deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonToken token = p.getCurrentToken(); switch (token) { case VALUE_STRING: try { byte[] payload = HexUtil.hexStringToByteArray(p.getValueAsString()); // convert to hex return context.getParams().getDefaultSerializer().makeBlock(payload); } catch (ProtocolException e) { throw new InvalidFormatException(p, "Invalid Block", p.getValueAsString(), Block.class); } default: return (Block) ctxt.handleUnexpectedToken(Block.class, p); } }