9

BitCoinJ In addition to @D.H's answer, BitCoinJ provides the following for developers open source through Subversion easy to use Java API easy to integrate via Maven access to either release or snapshot editions depending on your risk profile BitCoinJ also uses the Bouncy Castle encryption algorithm implementations. Some of these were missing or poorly ...


7

Hopefully, bitcoinj will now be maintained by other people that based projects on it. From what I've read and the commit list it seems that Andreas Schildbach, who also initiated the Bitcoin Wallet for Android, now takes a leading role in maintaining of bitcoinj.


6

BitcoinJ is the most mature library to my knowledge (though it is still at an early development stage). It has been developed by Google employee Mike Hearn. BitCoinJ implements the "simplified payment verification" mode of Satoshis paper. It does not store a full copy of the block chain, rather, it stores what it needs in order to verify transactions ...


6

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 address! What you do (when you're not dealing with a coinbase transaction) is that you look up the transaction with the txid, and look at the transaction output ...


6

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 Transaction API of bitcoinj so I cannot go further than that. Your post suggests that your private key is given as a WiF so I have taken this as an assumption. The main ...


5

There are lots of differences in features supported, but the crucial difference is the architecture: Embedded vs. Client-Server Bitcoin Protocol Node and Wallet. BitcoinJ is a Java library to embed a Simplified or Full Verifying Bitcoin Node and a Wallet into your application. The Bits of Proof Enterprise Bitcoin Server is a configurable Full Verifying ...


5

There was a 3 part article in JavaWorld about bitcoinj in 2011. It is obviously a bit dated but is a thorough introduction to it. First part: http://javaworld.com/javaworld/jw-11-2011/111122-bitcoin-for-beginners-part-1.html


5

Check out https://github.com/ValleZ/Paper-Wallet - it is android lite project what does this task. Start with createTransaction method in https://github.com/ValleZ/Paper-Wallet/blob/master/app/src/main/java/ru/valle/btc/BTCUtils.java


5

You can send bitcoins to the same address you are sending from, if you create a raw transaction manually, or if you use a wallet that does not create a new change address each time a transaction is made. One reason why this new address process exists is to protect privacy. If you consider that the outputs of a transaction with change, where one of the ...


5

Bloom filters are probabilistic, each attempted match you make with it has a specific chance of being a false positive. The rate of false positives is determined by the construction of the filter (how wide it is and how many elements have been added to it). A transaction either probably matches, or certainly doesn't match a given bloom filter. BIP37 does ...


4

Mike Hearn's WalletTool (included in the bitcoinj library) is a pretty good starting point. If you have a look at the 'send' method in WalletTool you can see that it: 1) Creates a SendRequest 2) Decrypts the private key if necessary 3) Completes the tx to get the inputs and find the fee 4) Signs the tx 5) Starts up a PeerGroup 6) Broadcasts it For an ...


4

I would try option 1 first, if you can find the right version of the library. I'd be willing to try making a general purpose tool to do it, but don't have an Android phone. Is there any way you can make a new, empty wallet and put a copy online somewhere along with a corresponding bitcoin address or two? If you're attempting option 2, you probably know at ...


4

[Obsolete answer, see below] As an update: current versions of the Bitcoin app have a "Back up Keys" feature. This writes a backup of all the keys in the wallet to a file named bitcoin-wallet-keys-YYYY-MM-DD (using the current date) in the phone's storage, which you can then copy or transfer wherever you want. The file is encrypted with a password you ...


4

The first byte, 1D, is the length. The next three bytes are the high bytes of the hash. So we have 00ffff, then we add ff bytes onto the end to get to 29 bytes. Then we're done. We wind up with 3 bytes of leading zeroes because 32-29 is 3. And we get one byte of zeroes from the second byte of the compact bits. So the final result is 00,00,00,00,ff,ff,ff...


4

For future reference: In bitcoinJ (java version) the input/output addresses of transactions are located in TransactionInput and TransactionOutput objects. For example: for Transaction tx: List<TransactionInput> inputs = tx.getInputs(); List<TransactionOutput> outputs = tx.getOutputs(); for(TransactionOutput out : outputs){ System.out....


4

You're interested in the following API calls: public List<TransactionInput> Transaction.getInputs() public Script TransactionInput.getScriptSig() throws ScriptException public void Script.correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey) Use them like so: Transaction tx = ... List<TransactionInput> inputs =...


4

So if I were to create the same transaction using bitcoinjs and bitcoinj, the end result of the signed transaction would be the same with both libraries, is that correct? They certainly should. That's why they're called deterministic. Any particular library could have a bug in it, however. I would check against examples given in the spec to make sure a ...


4

Does the current release of BitcoinJ add both a public key and its hash value to its Bloom filters? If not, which release stopped it from occuring? Yes. The following code implements it: /** Inserts the given key and equivalent hashed form (for the address). */ public synchronized void insert(ECKey key) { insert(key.getPubKey()); insert(key....


4

Yes. ECKey key = ...; String addr = key.toAddress(MainNetParams.get()).toString(); https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/core/ECKey.html#toAddress-org.bitcoinj.core.NetworkParameters-


4

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 above. % echo 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f | bx sha256 | ...


4

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 why the testnet faucets say the address is invalid. From the documentation of BitcoinJ, it seems that you can configure your code to use the testnet with: ...


4

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


3

Actually Ive done this. What I would say is that if you are planning to it your self it requires some amount of time and expertise if you really want to implement a custom solution that can integrate with your web platform. I did some research and in the end this is how I did it. I use Bitcoind It runs on a private server well away from the web server. On ...


3

The class WalletAppKit is a good start. Here's a snippet of code that dumps the most recent block, you can probably take it from here. It will take a while to download the block chain and then it will print out the most recent transactions. public class DumpLastBlock { public static void main(String args[]) throws Exception { WalletAppKit kit = new ...


3

From this discussion: How to create a checkpoint file Run mvn exec:java -Dexec.mainClass=com.google.bitcoin.tools.BuildCheckpoints in the tools/ directory from the bitcoinj repository. BuildCheckpoints expects you to have a fully synced local Bitcoin-Qt/bitcoind instance running.


3

ECKey keyA = <something> ECKey keyB = <something> ECKey keyC = <something> Transaction aTransaction = new Transaction(params); List<ECKey> keyList = ImmutableList.of(keyA, keyB, keyC); Script script = ScriptBuilder.createMultiSigOutputScript(2, keyList); //2 of 3 multisig Coin value = Coin.valueOf(0,10); // 0.1 btc aTransaction....


3

I found the solution for this question. I used this class: /** * This class implements a {@link org.bitcoinj.wallet.CoinSelector} which attempts to select all outputs * from a designated address. Outputs are selected in order of highest priority. Note that this means we may * end up "spending" more priority than would be required to get the ...


3

CoinWallet began a different kind of stress test within the past several days. After concerns about the method in which it conducts stress tests being a violation of laws in the UK, it decided to stress test the system by giving away 200 BTC for free to the public in a manner which will have the same effect without being a criminal act. CoinWallet is ...


3

I suppose you use the BitCoinJ library. You are not creating a signature the correct way; an ECDSASignature object should be initialized with the ECDSA signature parameters (r,s), not the actual private and public keys. The constructor you are using, implies that the ECDSA signature has been computed already, you somehow got r and s and you initiate the ...


3

You can't make an OP_RETURN-based output out to any specific address, since the OP_RETURN opcode marks an output as invalid (thus provably unspendable). In fact, an OP_RETURN-based output will not even enter the UTXO. A zero amount is okay (and even encouraged) for OP_RETURN. The OP_RETURN is paid for via the fee; putting a non-zero amount in OP_RETURN ...


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