MasternodeSignature duplicate() { MasternodeSignature copy = new MasternodeSignature(params, getBytes(), 0); return copy; }
public static MasternodeSignature signHash(Sha256Hash hash, ECKey key) { ECKey.ECDSASignature signature = key.sign(hash); return new MasternodeSignature(signature.encodeToDER()); }
public static MasternodeSignature signMessage(String strMessage, StringBuilder errorMessage, ECKey key) { //ECKey ecKey = ECKey.fromPublicOnly(key.getBytes()); try { byte dataToHash [] = (Utils.BITCOIN_SIGNED_MESSAGE_HEADER_BYTES+strMessage).getBytes(Charsets.UTF_8); ECKey.ECDSASignature signature = key.sign(Sha256Hash.twiceOf(dataToHash)); return new MasternodeSignature(signature.encodeToDER()); } catch (KeyCrypterException x) { } errorMessage.append("Sign failed"); return null; } public static boolean verifyMessage(PublicKey pubkey, MasternodeSignature vchSig, String strMessage, StringBuilder errorMessage)
@Override protected void parse() throws ProtocolException { nSporkID = (int)readUint32(); nValue = readInt64(); nTimeSigned = readInt64(); sig = new MasternodeSignature(params, payload, cursor); cursor += sig.getMessageSize(); length = cursor - offset; }
@Override protected void parse() throws ProtocolException { vin = new TransactionInput(params, null, payload, cursor); cursor += vin.getMessageSize(); blockHash = readHash(); sigTime = readInt64(); vchSig = new MasternodeSignature(params, payload, cursor); cursor += vchSig.getMessageSize(); length = cursor - offset; }
@Override protected void parse() throws ProtocolException { cursor = offset; txHash = readHash(); outpoint = new TransactionOutPoint(params, payload, cursor); cursor += outpoint.getMessageSize(); outpointMasternode = new TransactionOutPoint(params, payload, cursor); cursor+= outpointMasternode.getMessageSize(); vchMasternodeSignature = new MasternodeSignature(params, payload, cursor); cursor += vchMasternodeSignature.getMessageSize(); confirmedHeight = -1; timeCreated = Utils.currentTimeSeconds(); length = cursor - offset; } @Override
@Override protected void parse() throws ProtocolException { vin = new TransactionInput(params, null, payload, cursor); cursor += vin.getMessageSize(); address = new MasternodeAddress(params, payload, cursor, 0); cursor += address.getMessageSize(); pubKeyCollateralAddress = new PublicKey(params, payload, cursor); cursor += pubKeyCollateralAddress.getMessageSize(); pubKeyMasternode = new PublicKey(params, payload, cursor); cursor += pubKeyMasternode.getMessageSize(); sig = new MasternodeSignature(params, payload, cursor); cursor += sig.getMessageSize(); sigTime = readInt64(); protocolVersion = (int)readUint32(); lastPing = new MasternodePing(params, payload, cursor); cursor += lastPing.getMessageSize(); //nLastDsq = readInt64(); length = cursor - offset; }
cursor += pubKeyMasternode.getMessageSize(); sig = new MasternodeSignature(params, payload, cursor); cursor += sig.getMessageSize();