Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9dcc332
Minor changes.
DmRomantsov Aug 13, 2015
cee1d08
Logs and exception handling in README.md
DmRomantsov Aug 13, 2015
325c705
More detail explanation of usage walletListener in README.md
DmRomantsov Aug 13, 2015
0bae8ba
Update dependencies.
DmRomantsov Jan 21, 2016
bcaecb5
Rollback dependencies update.
DmRomantsov Jan 22, 2016
c41c530
Fix java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal.
DmRomantsov Jan 26, 2016
785830c
GetInfo call impl.
DmRomantsov Feb 3, 2016
7526b99
Add .idea files to gitignore.
DmRomantsov Feb 3, 2016
9d33c6d
Update html unit version.
DmRomantsov Feb 8, 2016
c11839f
Change net.sourceforge.htmlunit to apache httpClient.
DmRomantsov Feb 9, 2016
02471f5
Change protocol to https.
DmRomantsov Feb 23, 2016
fe4e74f
Localhost ssl fix.
DmRomantsov Feb 23, 2016
260c664
Back to http protocol.
DmRomantsov Mar 2, 2016
c1ba891
Avoiding logging listOfTx requests.
DmRomantsov Mar 2, 2016
01ba0bd
Update version in pom.xml.
DmRomantsov Mar 2, 2016
416c6f6
Implementation of move command.
DmRomantsov Apr 6, 2016
3af064e
Add comment to move transfer
DmRomantsov Apr 7, 2016
6cfdfaa
Omni protocol support.
DmRomantsov May 30, 2016
6432cf3
Update logging.
DmRomantsov Nov 4, 2016
2d21f7e
Omni protocol implementation.
DmRomantsov May 30, 2016
c7ddcc4
Update logging.
DmRomantsov Nov 4, 2016
5d92866
BitcoinD enctyption.
DmRomantsov Nov 16, 2016
91149a4
Merge branch 'master' of https://github.com/DmRomantsov/Litecoin-Bitc…
DmRomantsov Nov 16, 2016
5e93168
OmniTransaction fix.
DmRomantsov Nov 24, 2016
3176b44
v 2.2.3
DmRomantsov Nov 24, 2016
d8ae09d
Extended validation method.
DmRomantsov Nov 24, 2016
c7ecb85
Add UnsupportedOperationException()
DmRomantsov Nov 25, 2016
f8d7462
Fix omni balance
Nov 29, 2016
44b2ae0
Fix get balance from address.
DmRomantsov Nov 29, 2016
eb43d4c
IsMine in tx.
DmRomantsov Dec 22, 2016
0d022eb
Omni send fix.
DmRomantsov Dec 27, 2016
d0e7393
Omni get balance fix.
DmRomantsov Dec 27, 2016
66a41ba
Omni balance fix.
DmRomantsov Dec 27, 2016
70b909e
property id in tx.
DmRomantsov Dec 27, 2016
075aa2a
CryptoCurrency in tx info.
DmRomantsov Feb 3, 2017
de5d19c
Allow null as username and password
DmRomantsov Feb 8, 2017
8373591
Add MockCryptoCurrencyRpc.
DmRomantsov Mar 20, 2017
4e1e214
Add mock for txs.
DmRomantsov Mar 20, 2017
c46150a
Allow use reletive path in host url.
DmRomantsov Apr 26, 2017
9f19a84
Tx mock impruvment.
DmRomantsov Nov 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Intellij Idea
#################
*.iml

/.idea
#################
## Eclipse
#################
Expand Down
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,32 @@ You can register observers to capture events of wallets, and alerts:
walletListener.addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
System.out.println("Amount of transaction: " + ((Transaction)arg).getAmount());
Transaction tx = (Transaction) arg;
BigDecimal amount = tx.getDetails().get(0).getAmount(); //amount of transaction
String txId = tx.getTxid(); //id of transaction
Transaction txDetails = tx.getDetails().get(0); //transaction details

if (tx.getDetails().size() == 2) {
//both side of translation inside your bitcoind node
String sendToAddress = txDetails.getAddress();
String receiveAddress = tx.getDetails().get(1).getAddress();
BigDecimal fee = tx.getFee();
} else {
//one side of translation outside of your bitcoind node
switch (txDetails.getCategory()) {
case RECEIVE: //your account on bitcoind receive bitcoin
String receiveAddress = txDetails.getAddress();
break;
case SEND: //your account on bitcoind send bitcoin
//the address to which the coins was sent
String sendToAddress = txDetails.getAddress();
//account in your bitcoind from which the coins was sent
String sendFromAccountName = txDetails.getAccount();
BigDecimal fee = txDetails.getFee();
break;
default:
//Strange transaction: MOVE or CONFLICTED
}
}
});

Expand All @@ -68,4 +93,16 @@ Make sure to close sockets later:
walletListener.stop();
```

### Logs and exception handling

All log files are written via log4j DailyRollingFileAppender and saved in /var/log/bitcoin-rpc/ folder.

Library can generate listed below types of Runtime exception:

- AuthenticationException
- CallApiCryptoCurrencyRpcException
- CryptoCurrencyRpcException (base class)
- InsufficientFundsException
- RpcInvalidResponseException

> Written with [StackEdit](https://stackedit.io/).
25 changes: 16 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.nitinsurana</groupId>
<artifactId>Litecoin-Bitcoin-RPC-Java-Connector</artifactId>
<version>2.0.0</version>
<version>2.2.16</version>
<packaging>jar</packaging>

<name>Litecoin-Bitcoin-RPC-Java-Connector</name>
Expand Down Expand Up @@ -75,8 +75,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -148,17 +148,24 @@
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.15</version>
<scope>compile</scope>
</dependency>


<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ public enum APICalls {
SEND_RAW_TRANSACTION("sendrawtransaction"),
SET_ACCOUNT("setaccount"),
SEND_TO_ADDRESS("sendtoaddress"),
MOVE("move"),
GET_ADDRESSES_BY_ACCOUNT("getaddressesbyaccount"),
GET_RECEIVED_BY_ACCOUNT("getreceivedbyaccount"),
GET_RECEIVED_BY_ADDRESS("getreceivedbyaddress"),
GET_BALANCE("getbalance"),
GET_TRANSACTION("gettransaction"),
GET_INFO("getinfo"),
GET_CONNECTION_COUNT("getconnectioncount"),
BACKUP_WALLET("backupwallet"),
DECODE_RAW_TRANSACTION("decoderawtransaction"),
Expand All @@ -37,7 +39,16 @@ public enum APICalls {
CREATE_RAW_TRANSACTION("createrawtransaction"),
SIGN_RAW_TRANSACTION("signrawtransaction"),
VALIDATE_ADDRESS("validateaddress"),
ENCRYPT_WALLET("encryptwallet");
ENCRYPT_WALLET("encryptwallet"),
WALLET_PASSPHRASE("walletpassphrase"),

//OMNI
OMNI_SEND("omni_send"),
OMNI_GETINFO("omni_getinfo"),
OMNI_GETBALANCE("omni_getbalance"),
OMNI_GETALLBALANCESFORID("omni_getallbalancesforid"),
OMNI_GETTRANSACTION("omni_gettransaction"),
OMNI_LISTTRANSACTIONS("omni_listtransactions");

private String value;

Expand Down
Loading