Hot answers tagged

7

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 ...


7

Doing this requires three things: Permutations of the seed words The address you're trying to locate The derivation path for that address. In this specific case, the address is the one this puzzle on reddit leads to, so we will assume the derivation path is m/49'/0'/0'/0/0 This is a simple nodejs script using bitcoinjs-lib to read seeds from a file, ...


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

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 ...


5

Check out xchange on github:: https://github.com/timmolter/XChange It works on multiple exchanges, and is written in Java.


4

One of the very fist GPU miners was in java using OpenCL. It was called DiabloMiner and you can find the source here;- https://github.com/Diablo-D3/DiabloMiner It hasn't been updated the the past two years but it is still fully functional.


4

Define a JAVA_HOME environment variable with the path to your jre/jdk installation in it. That worked for me.


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


4

This is valid, and there are even smaller types as well. Be aware that Bitcoin no longer really uses ASN.1 DER, but a even more restrictive subset of it. ASN.1 itself as it turns out is not deterministic or platform independent in many implementations, which is a source of consensus failure. For reference, here is how to encode signatures correctly in ...


3

The Linux installer is slightly different to the windows installer in that there are different scripts to get the host machine to recognise the bitcoin URIs. What ARE very similar is the multibit-exe.jar (used on Linux and Mac) and the multibit.exe (used in Windows). The exe is basically a wrapped jar file. On any operating system you can run MultiBit jar ...


3

I had the same issue and created an implementation here: https://github.com/johannbarbie/BitcoindClient4J


3

Because this seems like a collection of links, I will just add another one: https://github.com/priiduneemre/btcd-cli4j


3

There is at least one bitcoin implementation in Java. Not everybody "decided to go with C++", and the choice of implementation language has no bearing on the underlying network protocol. Anybody is free to implement the bitcoin algorithm in any programming language they choose. Speculating on which programming languages Satoshi did or did not know is ...


3

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 an appropriate factor (10^8 for BTC, or 10^5 for mBTC).


3

Your output is correct given the input that you used. However, If you are expecting to get an output address of 39YteymR86cG7V3Kijg8Gm2ST1r4nTeM1b, it looks like your input is incorrect. It's missing the first byte and the last 4 bytes (encoded as hex): Your Input: --56379c7bcd6b41188854e74169f844e8676cf8b8-------- Proper Input: ...


3

The getwork RPC call was removed from Bitcoin Core. It was deprecated and then superceded by the getblocktemplate RPC call. It looks like the pool that you are using uses an unspecified protocol. It's just a tcp connection where you are sending JSON formatted strings and receiving JSON formatted strings from the pool server. I figured this out by digging ...


3

Ardor time is measured in seconds since the Genesis block, represented as Java int. Currently there is no API which performs conversion to Unix time so you have to code it yourself. If you are coding a server side contract in Java use the following code: long EPOCH_BEGINNING = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(isTestnet ? "2017-12-26 14:...


3

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 have a VarInt prepended to both the "Magic" and the Message. The VarInt encodes the byte-length of the message (encoded in UTF-8). Since the "Magic" value ...


2

https://github.com/nitinsurana/Litecoin-Bitcoin-RPC-Java-Connector It uses Htmlunit instead of Apache Http Library, which makes it a bit easy to understand and extend. I actually wrote & tested it for Litecoin for one of my projects. But it has been extended to support bitcoin and all the RPC methods are available.


2

Yes, you can now store up to 80 bytes via an additional, special output: https://bitcoinfoundation.org/blog/?p=290


2

I had the same problem and while trying to find a solution I found many people suggesting to install the x86 version of Java which is stupid if you actually run a x64 operating system. Others suggested to try out MultiBit HD which isn't officially released yet, that's probably not a good idea either. Took me quite a while but I figured out how to get it ...


2

Library under Apache Licence: https://github.com/SulacoSoft/BitcoindConnector4J


2

com.google.bitcoin.core.ECKey key = new com.google.bitcoin.core.ECKey(); // keypair byte[] pub = key.getPublicKey(); // byte array String prv; prv = key.getPrivateKeyEncoded(com.google.bitcoin.core.NetworkParameters.prodNet());


2

I'm not aware of any Java mining code existing, and I would not expect it to: mining needs to be as fast as possible, so you wouldn't want to write it in a language that runs on a virtual machine. Since the reference implementation, Bitcoin Core, stands as the ultimate documentation of the protocol, and it is written in C++, I would say that anyone doing ...


2

Most private keys are essentially just random numbers, so if all you want is a private key, you just need to use a high-entropy random function to generate your private key that's 256 bits. Converting those bits into something a normal bitcoin wallet can understand (like WIF) is a little trickier, but the process is spelled out here. I'm recapping the ...


2

This is entirely possible with an optional additon to Bitcoin called BIP32. Unfortunately, BIP32 is not implemented by the standard client, but there are other clients that do implement it. Ask your customer to download the latest version of Electrum, then have them give you their extended public key. (As I said above, there are multiple clients that can ...


2

You may also want to take a look at my ccxt library on GitHub: https://github.com/kroitor/ccxt It is a JavaScript / Python / PHP library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs. The library is used to connect and trade with cryptocurrency / altcoin exchanges and payment ...


2

It is not specified what to subscribe. socket.connect("tcp://127.0.0.1:28332") socket.subscribe("hashtx"); # if you need raw data or block data, to add-> socket.subscribe("hashblock"); socket.subscribe("rawblock"); socket.subscribe("rawtx"); see. https://github.com/bitcoin/bitcoin/blob/master/contrib/zmq/zmq_sub.py


2

Yes, you can convert a 33-byte compressed public key into a 65-byte uncompressed public key in Java. Here is the code to perform the operation. It is correct, robust, and only requires Java SE classes (no other libraries) - but I apologize for the implementation length. import java.math.BigInteger; import java.util.Arrays; static final BigInteger MODULUS =...


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