Beispiel #1
0
  public Transaction(
      byte[] nonce,
      byte[] gasPrice,
      byte[] gasLimit,
      byte[] receiveAddress,
      byte[] value,
      byte[] data,
      byte[] r,
      byte[] s,
      byte v) {
    this(nonce, gasPrice, gasLimit, receiveAddress, value, data);

    ECDSASignature signature = new ECDSASignature(new BigInteger(r), new BigInteger(s));
    signature.v = v;
    this.signature = signature;
  }
Beispiel #2
0
  public void rlpParse() {

    RLPList decodedTxList = RLP.decode2(rlpEncoded);
    RLPList transaction = (RLPList) decodedTxList.get(0);

    this.nonce = transaction.get(0).getRLPData();
    this.gasPrice = transaction.get(1).getRLPData();
    this.gasLimit = transaction.get(2).getRLPData();
    this.receiveAddress = transaction.get(3).getRLPData();
    this.value = transaction.get(4).getRLPData();
    this.data = transaction.get(5).getRLPData();
    // only parse signature in case tx is signed
    if (transaction.get(6).getRLPData() != null) {
      byte v = transaction.get(6).getRLPData()[0];
      byte[] r = transaction.get(7).getRLPData();
      byte[] s = transaction.get(8).getRLPData();
      this.signature = ECDSASignature.fromComponents(r, s, v);
    } else {
      logger.debug("RLP encoded tx is not signed!");
    }
    this.parsed = true;
    this.hash = getHash();
  }