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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
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 ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 -...
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....
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 ...
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();
//...
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 ...
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 ...
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) ...
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 = &...
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.
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
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 ...
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 ...
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/...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
bitcoinj × 248java × 62
transactions × 33
bitcoin-core × 23
wallet × 18
bitcoind × 16
android × 16
blockchain × 11
address × 10
raw-transaction × 10
transaction-input × 9
private-key × 8
public-key × 7
signature × 7
bitcoin-wallet-app × 7
multi-signature × 6
development × 6
bip32-hd-wallets × 6
testnet × 6
ecdsa × 6
p2sh × 6
balance × 6
client × 5
spv × 5
json-rpc × 4