コード例 #1
0
 public String sendOffline(String destinationAddress, long amountSatoshis)
     throws InsufficientMoneyException {
   Address addressj;
   try {
     addressj = new Address(params, destinationAddress);
   } catch (AddressFormatException e) {
     e.printStackTrace();
     throw new RuntimeException(e);
   }
   Coin amount = Coin.valueOf(amountSatoshis);
   // create a SendRequest of amount to destinationAddress
   Wallet.SendRequest sendRequest = Wallet.SendRequest.to(addressj, amount);
   // set dynamic fee
   sendRequest.feePerKb = getRecommendedFee();
   // complete & sign tx
   kit.wallet().completeTx(sendRequest);
   kit.wallet().signTransaction(sendRequest);
   // return tx bytes as hex encoded String
   return Hex.encodeHexString(sendRequest.tx.bitcoinSerialize());
 }
コード例 #2
0
 public Wallet.SendRequest toSendRequest() {
   Wallet.SendRequest req = Wallet.SendRequest.forTx(this);
   req.shuffleOutputs = false;
   req.feePerKb = this.REFERENCE_DEFAULT_MIN_TX_FEE.multiply(3); // TODO
   return req;
 }