Codota Logo
com.msgilligan.bitcoinj.json.pojo
Code IndexAdd Codota to your IDE (free)

How to use com.msgilligan.bitcoinj.json.pojo

Best Java code snippets using com.msgilligan.bitcoinj.json.pojo (Showing top 13 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: ConsensusJ/consensusj

/**
 * Get a (cached after first call) serverVersion number
 * @return serverVersion number of bitcoin node
 * @throws JsonRpcStatusException JSON RPC status exception
 * @throws IOException network error
 */
private int getServerVersion() throws IOException, JsonRpcStatusException {
  if (serverVersion == 0) {
    serverVersion = getNetworkInfo().getVersion();
  }
  return serverVersion;
}
origin: ConsensusJ/consensusj

/**
 * Sends BTC from an address to the destinations, whereby no new change address is created, and any leftover is
 * returned to the sending address.
 *
 * @param fromAddress The source to spent from
 * @param outputs     The destinations and amounts to transfer
 * @return The transaction hash
 */
public Sha256Hash sendBitcoin(Address fromAddress, Map<Address, Coin> outputs) throws JsonRpcStatusException, IOException {
  String unsignedTxHex = createRawTransaction(fromAddress, outputs);
  SignedRawTransaction signingResult = signRawTransaction(unsignedTxHex);
  Boolean complete = signingResult.isComplete();
  assert complete;
  String signedTxHex = signingResult.getHex();
  Sha256Hash txid = sendRawTransaction(signedTxHex);
  return txid;
}
origin: ConsensusJ/consensusj

  amountIn += unspentOutput.getAmount().value;
  inputs.add(new Outpoint(unspentOutput.getTxid(), unspentOutput.getVout()));
SignedRawTransaction signingResult = client.signRawTransaction(unsignedTxHex);
Boolean complete = signingResult.isComplete();
assert complete;
String signedTxHex = signingResult.getHex();
Object txid = client.sendRawTransaction(signedTxHex, true);
origin: ConsensusJ/consensusj

/**
 * Construct from a bitcoinj transaction
 * @param transaction A bitcoinj confirmed or unconfirmed transaction
 */
public RawTransactionInfo(Transaction transaction) {
  this.hex = TransactionHexSerializer.bytesToHexString(transaction.bitcoinSerialize());
  this.txid = transaction.getHash();
  this.version = transaction.getVersion();
  this.locktime = transaction.getLockTime();
  this.blockhash = null;  // For now
  this.confirmations = transaction.getConfidence().getDepthInBlocks();
  this.time = 0; // TODO: block header time of block including transaction
  this.blocktime = this.time; // same as time (see API doc)
  vin = new VinList();
  for (TransactionInput input : transaction.getInputs()) {
    vin.add(new Vin(txid,
            input.getOutpoint().getIndex(),
            input.getScriptSig().toString(),
            input.getSequenceNumber()));
  }
  vout = new VoutList();
  for (TransactionOutput output : transaction.getOutputs()) {
    vout.add(new Vout(output.getValue(),
              output.getIndex(),
              output.getScriptPubKey().toString()));
  }
}
origin: io.github.ganchix/bitcoinj-spring-boot-autoconfigure

  @Override
  protected void doHealthCheck(Health.Builder builder) throws IOException {

    builder.withDetail("netVersion", bitcoinClient.getNetworkInfo().getVersion());
    builder.withDetail("blockNumber", bitcoinClient.getBlockChainInfo().getBlocks());
    builder.withDetail("difficulty", bitcoinClient.getBlockChainInfo().getDifficulty());
    builder.withDetail("chain", bitcoinClient.getBlockChainInfo().getChain());
    builder.status(Status.UP);
  }
}
origin: ConsensusJ/consensusj

  inputs.add(new Outpoint(input.getTxid(), input.getVout()));
long amountOut = 0;
for (UnspentOutput it : unspentOutputs) {
  amountIn += it.getAmount().value;
origin: ConsensusJ/consensusj

  if (txout != null && txout.getValue().value > 0) {
    log.debug("txout = {}, value = {}", txout, txout.getValue().value);
    amountGatheredSoFar += txout.getValue().value;
    inputs.add(new Outpoint(coinbaseTx, 0));
SignedRawTransaction signingResult = client.signRawTransaction(unsignedTxHex);
assert signingResult.isComplete();
String signedTxHex = signingResult.getHex();
Sha256Hash txid = client.sendRawTransaction(signedTxHex, true);
origin: ConsensusJ/consensusj

  public List<TransactionOutPoint> listUnspentOutPoints(Address fromAddress) throws JsonRpcStatusException, IOException {
    List<Address> addresses = Collections.singletonList(fromAddress);
    List<UnspentOutput> unspentOutputsRPC = listUnspent(0, defaultMaxConf, addresses); // RPC UnspentOutput objects
    List<TransactionOutPoint> unspentOutPoints = new ArrayList<TransactionOutPoint>();
    for (UnspentOutput it : unspentOutputsRPC) {
      unspentOutPoints.add(new TransactionOutPoint(getNetParams(), it.getVout(), it.getTxid()));
    }
    return unspentOutPoints;
  }
}
origin: ConsensusJ/consensusj

@Override
public ServerInfo getinfo() {
  // Dummy up a response for now.
  // Since ServerInfo is immutable, we have to build it entirely with the constructor.
  Coin balance = Coin.valueOf(0);
  boolean testNet = !netParams.getId().equals(NetworkParameters.ID_MAINNET);
  int keyPoolOldest = 0;
  int keyPoolSize = 0;
  return new ServerInfo(
      version,
      protocolVersion,
      walletVersion,
      balance,
      getblockcount(),
      timeOffset,
      getconnectioncount(),
      "proxy",
      difficulty,
      testNet,
      keyPoolOldest,
      keyPoolSize,
      Transaction.REFERENCE_DEFAULT_MIN_TX_FEE,
      Transaction.REFERENCE_DEFAULT_MIN_TX_FEE, // relayfee
      "no errors"                               // errors
  );
}
origin: ConsensusJ/consensusj

/**
 * Returns list of related addresses
 * Also useful for finding all change addresses in the wallet
 * @return a lost of address groupings
 * @throws JsonRpcStatusException JSON RPC status exception
 * @throws IOException network error
 */
public List<List<AddressGroupingItem>>  listAddressGroupings() throws JsonRpcStatusException, IOException {
  // TODO: I'm not sure how to make Jackson mapping work automatically here.
  List<List<List<Object>>> raw = send("listaddressgroupings");
  List<List<AddressGroupingItem>> result = new ArrayList<>();
  for (List<List<Object>> rawGrouping : raw) {
    List<AddressGroupingItem> grouping = new ArrayList<>();
    for (List<Object> addressItem : rawGrouping) {
      AddressGroupingItem item = new AddressGroupingItem(addressItem, getNetParams());
      grouping.add(item);
    }
    result.add(grouping);
  }
  return result;
}
origin: ConsensusJ/consensusj

/**
 * Returns the Bitcoin balance of an address where spendable outputs have at least {@code minConf} and not more
 * than {@code maxConf} confirmations.
 *
 * @param address The address (must be in wallet)
 * @param minConf Minimum amount of confirmations
 * @param maxConf Maximum amount of confirmations
 * @return The balance
 */
public Coin getBitcoinBalance(Address address, Integer minConf, Integer maxConf) throws JsonRpcStatusException, IOException {
  long btcBalance = 0;
  List<UnspentOutput> unspentOutputs = listUnspent(minConf, maxConf, Collections.singletonList(address));
  for (UnspentOutput unspentOutput : unspentOutputs) {
    btcBalance += unspentOutput.getAmount().value;
  }
  return Coin.valueOf(btcBalance);
}
origin: ConsensusJ/consensusj

/**
 * Build a list of bitcoinj <code>TransactionOutput</code>s using <code>listUnspent</code>
 * and <code>getRawTransaction</code> RPCs
 *
 * @param fromAddress Address to get UTXOs for
 * @return All unspent TransactionOutputs for fromAddress
 */
public List<TransactionOutput> listUnspentJ(Address fromAddress) throws JsonRpcStatusException, IOException {
  List<Address> addresses = Collections.singletonList(fromAddress);
  List<UnspentOutput> unspentOutputsRPC = listUnspent(0, defaultMaxConf, addresses); // RPC UnspentOutput objects
  List<TransactionOutput> unspentOutputsJ = new ArrayList<TransactionOutput>();
  for (UnspentOutput it : unspentOutputsRPC) {
    unspentOutputsJ.add(getRawTransaction(it.getTxid()).getOutput(it.getVout()));
  }
  return unspentOutputsJ;
}
origin: ConsensusJ/consensusj

@Override
public ServerInfo getinfo() {
  // Dummy up a response for now.
  // Since ServerInfo is immutable, we have to build it entirely with the constructor.
  Coin balance = Coin.valueOf(0);
  boolean testNet = !netParams.getId().equals(NetworkParameters.ID_MAINNET);
  int keyPoolOldest = 0;
  int keyPoolSize = 0;
  return new ServerInfo(
      version,
      protocolVersion,
      walletVersion,
      balance,
      getblockcount(),
      timeOffset,
      getconnectioncount(),
      "proxy",
      difficulty,
      testNet,
      keyPoolOldest,
      keyPoolSize,
      Transaction.REFERENCE_DEFAULT_MIN_TX_FEE,
      Transaction.REFERENCE_DEFAULT_MIN_TX_FEE, // relayfee
      "no errors"                               // errors
  );
}
com.msgilligan.bitcoinj.json.pojo

Most used classes

  • NetworkInfo
  • AddressGroupingItem
    For listaddressgroupings response Note: In the JSON response this is actually an array
  • BlockChainInfo
  • Outpoint
    Data class for Outpoint as used by RPC methods
  • RawTransactionInfo$Vin
  • RawTransactionInfo$Vout,
  • RawTransactionInfo$VoutList,
  • ServerInfo,
  • SignedRawTransaction,
  • TxOutInfo,
  • UnspentOutput
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now