code: function () {
          if (this.from.getPrivateKey() !== null) {
              this.hash = this.hashTransaction();
              this.alg = SECP256K1;
              this.sign = cryptoUtils.sign(this.hash, this.from.getPrivateKey());
          } else {
              throw new Error("transaction from address's private key is invalid");
          }
      }
docs: Sign transaction with the specified algorithm.
  
  @example
  var acc = Account.NewAccount();
  
  var tx = new Transaction({
  chainID: 1,
  from: acc,
  to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
  value: 10,
  nonce: 12,
  gasPrice: 1000000,
  gasLimit: 2000000
  });
  tx.signTransaction();