Skip to main content
7 votes
Accepted

How to sign raw transaction given a private key and SHA hash (in java)

This answer does not attempt to sign a transaction, but simply focuses on successfully calling the sign method of the ECKey class, i.e. making your code work. I am not yet familiar with the ...
Sven Williamson's user avatar
6 votes
Accepted

How to retrieve the from and to wallet addresses of a transaction?

Which part / field of the input refers to the hash of the output? The outpoint contains a txid (32 bytes) and vout (4 bytes), which specify the output you're spending. This is not the sending ...
Nick ODell's user avatar
  • 29.5k
5 votes

How do I sign and send a raw transaction using BitcoinJ?

I'm not an expert in this field by any means (and my error message was different), but I spent last week trying to make Bitcoinj sign a transaction and send in raw form (i.e. without using transport ...
Oleg Kuznetsov's user avatar
4 votes

How to retrieve the from and to wallet addresses of a transaction?

The scriptPubKey contains the public key used to synthesize the public address. Here are two pedantic approaches, not using bitcoinj, applying bx commands to synthesize the public address of interest ...
skaht's user avatar
  • 3,077
4 votes

Problem with full node

From my experience the process of syncing the blockchain is CPU bound, not IO bound (You can check this on Linux by running the top command). bitcoinj has two ways of verifying signatures, either ...
Sven Williamson's user avatar
4 votes
Accepted

Why the bitcoin address is not valid in any of the testNet faucet

Testnet uses a different address format than the main network. Testnet addresses start with an "m" or "n". The address you are using starts with a "1" and is therefore for the main network. This is ...
cpsola's user avatar
  • 1,548
4 votes
Accepted

How to develop with the Bitcoin cash?

There is a bitcoinj.cash project currently being put together. The code is not ready for use but should be by next week: https://github.com/bitcoinj-cash/bitcoinj
user3169736's user avatar
4 votes

What is the difference between bitcoin core vs bitcoinj vs bitcoind vs bitcoinqt?

bitcoind, and bitcoin-qt are all part of the same program. Bitcoind and bitcoin-qt are both Bitcoin Core and do the same thing except that bitcoind has no GUI. Both are part of the Bitcoin Core ...
Ava Chow's user avatar
  • 71.5k
4 votes

convert 12 word seed into 24 word seed

This is not possible. The mnemonic words are an encoding of the entropy used in the seed, essentially. A 12 word seed has less entropy than a 24 word one, so you cannot get 24 words out of it. ...
Raghav Sood's user avatar
  • 17.2k
4 votes
Accepted

How can I determine the address from a private key?

Both "1LoVG.." and the other one are valid legacy (1...) addresses made using the same private key. They are different since one of them uses the compressed public key (you might want to ...
MCCCS's user avatar
  • 10.2k
3 votes
Accepted

The BTC shows 10^8 times more than what is received in the account

Apparently the app shows the amount as Satoshi (the smallest unit) instead of BTC. For internal calculations that's ok because it avoids rounding errors, but for input and output you should scale by ...
Hans-Martin Mosner's user avatar
3 votes
Accepted

Sign transaction with multiple inputs using bitcoinj/peercoinj libraries

Good day! Finally I found a solution, I hope it will useful to someone. The problem was that I tried to sign inputs before adding outputs and other info into transaction. So now I add inputs with ...
Timur Panzhiev's user avatar
3 votes
Accepted

How to verify a signed message by bitcoin core?

The preimage used when signing messages with Bitcoin Core is a combination of the "Magic" phrase: Bitcoin Signed Message:\n and the Message you are signing. However there is one caveat, being you must ...
Septem151's user avatar
  • 667
2 votes
Accepted

Decrypt my private key using KeyCrypter

Attempting to implement the interface KeyCrypter is a worthy exercise but it seems to require more than a few simple lines of code. bitcoinj offers one implementation with the class KeyCrypterScrypt ...
Sven Williamson's user avatar
2 votes

Differences between MemoryBlockStore and SPVBlockStore

MemoryBlockStore keeps StoredBlocks in memory and it is used primarily for unit testing. Whereas SPVBlockStore holds a limited number of block headers in a memory mapped ring buffer. With such a ...
m2pathan's user avatar
  • 146
2 votes

Get transaction details using bitcoinj library

maybe this helps private void txHistory() { List<Transaction> txx = kit.wallet().getTransactionsByTime(); if (!txx.isEmpty()) { int i ...
Zombie's user avatar
  • 548
2 votes
Accepted

Connect to regnet from my WalletAppKit Android app

If you're connecting to a bitcoind regtest node and you're trying to connect as an RPC client to it via bitcoinj, it's possible. Figure out what your Android's IP address is, say x.y.z.w and use the -...
Alin Tomescu's user avatar
  • 1,337
2 votes
Accepted

how can I hardcode a private key in bitcoinJ - ECKey constructor?

If all you are after is getting an ECKey object for that private key, then Bitcoinj has a DumpedPrivateKey class for just such an occasion. import org.bitcoinj.core.ECKey; import org.bitcoinj.core....
morsecoder's user avatar
  • 14.2k
2 votes
Accepted

How can I create a raw transaction in hex format with Bitcoinj?

Don't build the entire parent transaction, just build the outpoint, which is all that is relevant for encoding a transaction to hex. Specifically use this constructor EDIT: More specifically, cannot ...
Chris Stewart's user avatar
2 votes

How to create raw transaction

Sure :) My solution was pretty simple: //String to a private key DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, privKey); ECKey key = dumpedPrivateKey.getKey(); //...
Dragomirus's user avatar
2 votes

What is the difference between transactioninput.getFromAddress() and transactioninput.getConnectedOutput().getAddressFromP2SH(networkparameter))?

Shabahat's answer is good, but here's how each method of getting an address works: getFromAddress() takes the last element of the scriptSig, and hashes it to find the P2SH address. If the transaction ...
Nick ODell's user avatar
  • 29.5k
2 votes

What is the difference between transactioninput.getFromAddress() and transactioninput.getConnectedOutput().getAddressFromP2SH(networkparameter))?

After going through bitcoinj API documentation regarding the methods you have asked about, the way you make the second method work, you are supposed to connect the input transaction to get the output ...
Shabahat M. Ayubi's user avatar
2 votes

What is the best way to download a "recent" UTXO set snapshot?

Yes, by default bitcoinj downloads full blocks, from the Genesis. Only if you connect a wallet it uses optimizations like checkpoints and filters. Just downloading the UTXO set (in a trust free way) ...
Andreas's user avatar
  • 549
2 votes

The BTC shows 10^8 times more than what is received in the account

Yes, and in bitcoinj there are actually two classes for formatting Coin values for humans: MonetaryFormat and BtcFormat. I strongly suggest using one of the two. Here's an example: Wallet wallet = &...
Andreas's user avatar
  • 549
2 votes

How to convert Satoshi to BTC in Java?

The Coin.valueOf(long) static constructor takes Satoshis as an input. You can use one of the toString/toFriendlyString/toPlainString methods to derive a human readable value string.
Andreas's user avatar
  • 549
2 votes
Accepted

I'm working to add multiwallet support to Bitcoin Wallet App, but now the balance is no longer updating

Remove block for else if in that you have used useTor(), it doesnt need at all
Shubham's user avatar
  • 36
2 votes

Do we have to trust at least one DNS seed?

What you are saying is correct. I'll quickly elaborate on why these hardcoded dns seeds are required. The attack you mention is called "peer list poisoning", a strategy that can be used to segregate ...
Penquin's user avatar
  • 671
2 votes

Sync too low when using BitCoinJ to create and host own wallet

To make the sync faster and the wallet creation you can do by setting the checkpoints and later at the time of calling the create wallet method you can set the checkpoints for faster sync. Like I am ...
Aman Vyas's user avatar
2 votes

HD wallet implementation

I'm doing something similar but using segwit addresses (BIP49). If you are using BIP32 with a standard derivation of m/0'/0/0 you could do something like this - See: https://github.com/bitcoinjs/...
wmpedersen's user avatar
2 votes

BIP 84, BIP 173 Implementation in BitcoinJ

i don't think bitcoinj support BIP-173 but you can read more from Bitcoinj repo For Segwit Bitconj 0.14 branch is ~2 years old and has got no support for segwit at all. For receiving on native ...
Zombie's user avatar
  • 548

Only top scored, non community-wiki answers of a minimum length are eligible