org.bitcoinj.core.Transaction.addSignedInput()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.bitcoinj.core.Transaction.addSignedInput()方法的一些代码示例,展示了Transaction.addSignedInput()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.addSignedInput()方法的具体详情如下:
包路径:org.bitcoinj.core.Transaction
类名称:Transaction
方法名:addSignedInput

Transaction.addSignedInput介绍

[英]Same as #addSignedInput(TransactionOutPoint,org.bitcoinj.script.Script,ECKey,org.bitcoinj.core.Transaction.SigHash,boolean)but defaults to SigHash#ALL and "false" for the anyoneCanPay flag. This is normally what you want.
[中]与#addSignedInput(TransactionOutPoint,org.bitcoinj.script.script,ECKey,org.bitcoinj.core.Transaction.sigash,布尔值)相同,但anyoneCanPay标志默认为sigash#ALL和“false”。这通常是你想要的。

代码示例

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

/**
 * Same as {@link #addSignedInput(TransactionOutPoint, org.bitcoinj.script.Script, ECKey, org.bitcoinj.core.Transaction.SigHash, boolean)}
 * but defaults to {@link SigHash#ALL} and "false" for the anyoneCanPay flag. This is normally what you want.
 */
public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey) throws ScriptException {
  return addSignedInput(prevOut, scriptPubKey, sigKey, SigHash.ALL, false);
}

代码示例来源:origin: fr.acinq/bitcoinj-core

/**
 * Same as {@link #addSignedInput(TransactionOutPoint, org.bitcoinj.script.Script, ECKey, org.bitcoinj.core.Transaction.SigHash, boolean)}
 * but defaults to {@link SigHash#ALL} and "false" for the anyoneCanPay flag. This is normally what you want.
 */
public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey)
    throws ScriptException {
  return addSignedInput(prevOut, scriptPubKey, sigKey, SigHash.ALL, false);
}

代码示例来源:origin: HashEngineering/dashj

/**
 * Same as {@link #addSignedInput(TransactionOutPoint, org.bitcoinj.script.Script, ECKey, org.bitcoinj.core.Transaction.SigHash, boolean)}
 * but defaults to {@link SigHash#ALL} and "false" for the anyoneCanPay flag. This is normally what you want.
 */
public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey) throws ScriptException {
  return addSignedInput(prevOut, scriptPubKey, sigKey, SigHash.ALL, false);
}

代码示例来源:origin: greenaddress/GreenBits

/**
 * Same as {@link #addSignedInput(TransactionOutPoint, org.bitcoinj.script.Script, ECKey, org.bitcoinj.core.Transaction.SigHash, boolean)}
 * but defaults to {@link SigHash#ALL} and "false" for the anyoneCanPay flag. This is normally what you want.
 */
public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey) throws ScriptException {
  return addSignedInput(prevOut, scriptPubKey, sigKey, SigHash.ALL, false);
}

代码示例来源:origin: fr.acinq/bitcoinj-core

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey) {
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey);
}

代码示例来源:origin: greenaddress/GreenBits

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey) {
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey);
}

代码示例来源:origin: HashEngineering/dashj

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey, SigHash sigHash, boolean anyoneCanPay) {
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey, sigHash, anyoneCanPay);
}

代码示例来源:origin: fr.acinq/bitcoinj-core

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(
    TransactionOutput output,
    ECKey signingKey,
    SigHash sigHash,
    boolean anyoneCanPay)
{
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey, sigHash, anyoneCanPay);
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey) {
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey);
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey, SigHash sigHash, boolean anyoneCanPay) {
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey, sigHash, anyoneCanPay);
}

代码示例来源:origin: greenaddress/GreenBits

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey, SigHash sigHash, boolean anyoneCanPay) {
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey, sigHash, anyoneCanPay);
}

代码示例来源:origin: HashEngineering/dashj

/**
 * Adds an input that points to the given output and contains a valid signature for it, calculated using the
 * signing key.
 */
public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey) {
  return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey);
}

代码示例来源:origin: network.quant/overledger-sdk-bitcoin

(null == dltTransaction.getChangeAddress()) ? fromAddress : dltTransaction.getChangeAddress()));
TransactionOutPoint transactionOutPoint = new TransactionOutPoint(this.networkParameters, inputUtxo.getIndex(), inputUtxo.getHash());
transaction.addSignedInput(transactionOutPoint, inputUtxo.getScript(), this.key, Transaction.SigHash.ALL, true);
transaction.getConfidence().setSource(TransactionConfidence.Source.SELF);
transaction.setPurpose(Transaction.Purpose.USER_PAYMENT);

代码示例来源:origin: ConsensusJ/consensusj

tx.addSignedInput(it, fromKey);

代码示例来源:origin: greenaddress/GreenBits

@Test(expected = ScriptException.class)
public void testAddSignedInputThrowsExceptionWhenScriptIsNotToRawPubKeyAndIsNotToAddress() {
  ECKey key = new ECKey();
  Address addr = key.toAddress(PARAMS);
  Transaction fakeTx = FakeTxBuilder.createFakeTx(PARAMS, Coin.COIN, addr);
  Transaction tx = new Transaction(PARAMS);
  tx.addOutput(fakeTx.getOutput(0));
  Script script = ScriptBuilder.createOpReturnScript(new byte[0]);
  tx.addSignedInput(fakeTx.getOutput(0).getOutPointFor(), script, key);
}

代码示例来源:origin: greenaddress/GreenBits

t.addSignedInput(spendableOutput, new Script(spendableOutputScriptPubKey), outKey);
rollingBlock.addTransaction(t);
rollingBlock.solve();

代码示例来源:origin: greenaddress/GreenBits

t.addSignedInput(spendableOutput, new Script(spendableOutputScriptPubKey), outKey);
rollingBlock.addTransaction(t);
rollingBlock.solve();

代码示例来源:origin: greenaddress/GreenBits

t.addSignedInput(spendableOutput, new Script(spendableOutputScriptPubKey), outKey);
rollingBlock.addTransaction(t);
rollingBlock.solve();

相关文章

微信公众号

最新文章

更多

Transaction类方法