Skip to content
This repository has been archived by the owner on Apr 10, 2020. It is now read-only.

Java library for converting txids to txrefs and back

License

Notifications You must be signed in to change notification settings

WebOfTrustInfo/txref-conversion-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5d7be32 · Aug 21, 2019

History

30 Commits
May 20, 2019
Aug 7, 2017
Aug 12, 2017
Aug 21, 2019
Jun 15, 2019
Aug 7, 2017

Repository files navigation

Built a few weeks after the BTCR Virtual Hackathon July 10th - July 16th 2017.

RWoT Logo

Note: This library has been superseded by btc-tx-lookup-java.

Information

This is an implementation of BIP 136: Bech32 Encoded Tx Position References.

Use at your own risk! Pull requests welcome.

Maven

Build:

mvn clean install

Dependency:

<dependency>
	<groupId>info.weboftrust</groupId>
	<artifactId>txref-conversion-java</artifactId>
	<version>0.1-SNAPSHOT</version>
	<scope>compile</scope>
</dependency>

Examples

Convert a TXID to a TX ref

import info.weboftrust.txrefconversion.TxrefConverter;
import info.weboftrust.txrefconversion.TxrefConverter.Chain;

public class Test {
	
	public static void main(String[] args) throws Exception {

		BitcoinConnection bitcoinConnection = BlockcypherAPIBitcoinConnection.get();
		String txref = bitcoinConnection.toTxref(Chain.MAINNET, "016b71d9ec62709656504f1282bb81f7acf998df025e54bd68ea33129d8a425b");
		System.out.println(txref); // expect "tx1:rk63-uqnf-zscg-527"
	}
}

Convert a TX ref to a TXID

import info.weboftrust.txrefconversion.TxrefConverter;
import info.weboftrust.txrefconversion.TxrefConverter.TxidAndChain;

public class Test {
	
	public static void main(String[] args) throws Exception {

		BitcoinConnection bitcoinConnection = BlockcypherAPIBitcoinConnection.get();
		ChainAndTxid chainAndTxid = bitcoinConnection.fromTxref("txtest1:xyv2-xzpq-q9wa-p7t");
		System.out.println(chainAndTxid.getChain()); // expect "TESTNET"
		System.out.println(chainAndTxid.getTxid()); // expect "f8cdaff3ebd9e862ed5885f8975489090595abe1470397f79780ead1c7528107"
	}
}

About

Rebooting Web-of-Trust - http://www.weboftrust.info/

Markus Sabadello, Danube Tech - https://danubetech.com/

About

Java library for converting txids to txrefs and back

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages