Bitcoin Java Daemon Wrapper

Type-safe, open source Java - bitcoind wrapper.

Лицензия

Лицензия

Группа

Группа

org.btc4j
Идентификатор

Идентификатор

btc4j-daemon
Последняя версия

Последняя версия

0.0.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

Bitcoin Java Daemon Wrapper
Type-safe, open source Java - bitcoind wrapper.
Ссылка на сайт

Ссылка на сайт

http://btc4j.github.io/btc4j-daemon
Организация-разработчик

Организация-разработчик

btc4j
Система контроля версий

Система контроля версий

https://github.com/btc4j/btc4j-daemon

Скачать btc4j-daemon

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.btc4j/btc4j-daemon/ -->
<dependency>
    <groupId>org.btc4j</groupId>
    <artifactId>btc4j-daemon</artifactId>
    <version>0.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.btc4j/btc4j-daemon/
implementation 'org.btc4j:btc4j-daemon:0.0.3'
// https://jarcasting.com/artifacts/org.btc4j/btc4j-daemon/
implementation ("org.btc4j:btc4j-daemon:0.0.3")
'org.btc4j:btc4j-daemon:jar:0.0.3'
<dependency org="org.btc4j" name="btc4j-daemon" rev="0.0.3">
  <artifact name="btc4j-daemon" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.btc4j', module='btc4j-daemon', version='0.0.3')
)
libraryDependencies += "org.btc4j" % "btc4j-daemon" % "0.0.3"
[org.btc4j/btc4j-daemon "0.0.3"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.btc4j : btc4j-core jar 0.0.3
org.apache.httpcomponents : httpclient jar 4.3.1
org.glassfish : javax.json jar 1.0.4

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

Bitcoin Java Daemon Wrapper

Type-safe, open source Java - bitcoind wrapper.

Development build status: Build Status

btc4j-daemon calls the bitcoind Json-Rpc service (Bitcoin-Qt v0.8.6) using:

btc4j-daemon implements all 61 commands in bitcoind API as defined in org.btc4j.core.BtcApi. It also contains a notification component to process alerts, and block and wallet events received by bitcoind.

Development status: Currently working on v0.0.4.

Using btc4j-daemon

btc4j-daemon is free software under The MIT License (MIT). It is maintained by ggbusto@gmx.com.

Maven pom.xml dependency:

<dependency>
	<groupId>org.btc4j</groupId>
	<artifactId>btc4j-daemon</artifactId>
	<version>0.0.3</version>
</dependency>

or, download artifacts directly from https://github.com/btc4j/btc4j-daemon/releases.

Connect to a bitcoind process:

// bitcoind URL, rpc user/account, rpc password
BtcDaemon daemon = new BtcDaemon(new URL("https://127.0.0.1:18332"),
					"rpcuser", "GBxDyFeDMYEHucz6XFRpXDDB2woCU4wi96KD9widEmsj");
BtcInfo info = daemon.getInfo();
String address = daemon.getAccountAddress("rpcuser");
daemon.walletPassphrase("GBxDyFeDMYEHucz6XFRpXDDB2woCU4wi96KD9widEmsj");
daemon.sendToAddress("mm48fadf1wJVF341ArWmtwZZGV8s34UGWD", BigDecimal.valueOf(0.72)); 
daemon.walletLock();
daemon.stop(); // will stop bitcoind, not required

or, with notifications enabled:

// bitcoind URL, rpc user/account, rpc password, notification ports 
BtcDaemon daemon = new BtcDaemon(new URL("http://127.0.0.1:18332"),
					"user", "password", 18334, 18335, 18336);
daemon.getWalletListener().addObserver(new Observer() {
	@Override
	public void update(Observable o, Object obj) {
		if (obj instanceof BtcTransaction) {
			BtcTransaction transaction = (BtcTransaction) obj;
			System.out.println("received wallet event: " + transaction);
		}
	}
});
BigDecimal amount = daemon.getReceivedByAccount("user");
Map<String, BtcAccount> accounts = daemon.listAccounts();
daemon.backupWallet(new File("wallet.dat"));
daemon.stopListening(); // stops the listeners if notifications enabled
String stop = daemon.stop(); // will stop bitcoind

For notifications to work, bitcoind has to be started with the notification args:

./bitcoind -testnet -rpcuser=user -rpcpassword=password
			-alertnotify="java -cp btc4j-daemon-0.0.3-SNAPSHOT.jar org.btc4j.daemon.BtcDaemonNotifier 127.0.0.1 18334 %s"
			-blocknotify="java -cp btc4j-daemon-0.0.3-SNAPSHOT.jar org.btc4j.daemon.BtcDaemonNotifier 127.0.0.1 18335 %s"
			-walletnotify="java -cp btc4j-daemon-0.0.3-SNAPSHOT.jar org.btc4j.daemon.BtcDaemonNotifier 127.0.0.1 18336 %s"

org.btc4j.daemon.BtcDaemonNotifier is a simple utility that sends a line of text to a port on a given host.

  • usage: java BitcoinDaemonNotifier <host> <port> <message>
  • OS command: you could use an OS command instead such as netcat or nc

For more examples see BtcDaemonTest.java.

Issues

Report bugs, issues, or suggestions: https://github.com/btc4j/btc4j-daemon/issues.

Contributions

Project location: https://github.com/btc4j/btc4j-daemon.

  • git: git@github.com:btc4j/btc4j-daemon.git
  • svn: https://github.com/btc4j/btc4j-daemon

Donations

If you find the software useful and would like to make a donation, please send bitcoins to 1ACz6GKw3B6vjoYwGA2hnXDnbR5koFhC4j.

Copyright © 2013, 2014 by ggbusto@gmx.com.

org.btc4j

Bitcoin Java

Bitcoin Java (btc4j.org)

Версии библиотеки

Версия
0.0.3