package org.bitcoinj.evolution;


import org.bitcoinj.core.*;
import org.json.JSONObject;

import java.io.IOException;
import java.io.OutputStream;

public class CoinbaseTx extends SpecialTxPayload {
    public static final int CURRENT_VERSION = 1;

    long height;
    Sha256Hash merkleRootMasternodeList;

    public CoinbaseTx(NetworkParameters params, Transaction tx) {
        super(params, tx);
    }

    @Override
    protected void parse() throws ProtocolException {
        super.parse();
        height = readUint32();
        merkleRootMasternodeList = readHash();
        length = cursor - offset;
    }

    @Override
    protected void bitcoinSerializeToStream(OutputStream stream) throws IOException {
        super.bitcoinSerializeToStream(stream);
        Utils.uint32ToByteStreamLE(height, stream);
        stream.write(merkleRootMasternodeList.getReversedBytes());
    }

    public int getCurrentVersion() {
        return CURRENT_VERSION;
    }

    public String toString() {
        return String.format("CoinbaseTx(height=%d, merkleRootMNList=%s)",
                height, merkleRootMasternodeList.toString());
    }

    @Override
    public Transaction.Type getType() {
        return Transaction.Type.TRANSACTION_COINBASE;
    }

    @Override
    public String getName() {
        return "coinbaseTx";
    }

    @Override
    public JSONObject toJson() {
        JSONObject result = new JSONObject();
        result.append("height", height);
        result.append("merkleRootMNList", merkleRootMasternodeList);
        return result;
    }

    public long getHeight() { return height; }

    public Sha256Hash getMerkleRootMasternodeList() {
        return merkleRootMasternodeList;
    }
}

@@ -243,9 +243,9 @@
 N = 
-1
+2
 ;%0A%0A 
@@ -300,16 +300,55 @@
 odeList;
+%0A    Sha256Hash merkleRootQuorums; //v2
 %0A%0A    pu
@@ -606,24 +606,93 @@
 readHash();%0A
+        if(version %3E= 2)%0A            merkleRootQuorums = readHash();%0A
         leng
@@ -983,24 +983,113 @@
 edBytes());%0A
+        if(version %3E= 2)%0A            stream.write(merkleRootQuorums.getReversedBytes());%0A
     %7D%0A%0A    p
@@ -1261,16 +1261,38 @@
 NList=%25s
+, merkleRootQuorums=%25s
 )%22,%0A    
@@ -1346,16 +1346,35 @@
 String()
+, merkleRootQuorums
 );%0A    %7D
@@ -1769,24 +1769,87 @@
 rnodeList);%0A
+        result.append(%22merkleRootQuorums%22, merkleRootQuorums);%0A
         retu
@@ -1964,24 +1964,24 @@
 odeList() %7B%0A
-
         retu
@@ -2014,11 +2014,99 @@
 t;%0A    %7D
+%0A%0A    public Sha256Hash getMerkleRootQuorums() %7B%0A        return merkleRootQuorums;%0A    %7D
 %0A%7D%0A

Add support for version 2 (Dash Core 0.14)