question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrate Coin, Fiat, Monetary classes to Java Money

See original GitHub issue

Originally reported on Google Code with ID 614

Now that the Java Money (JSR 354) API Backport is available and should support Android
/ Java 6, it should be possible to modify the bitcoinj Monetary classes to be more
compatible with this implementation.

As a rough proposal, I suggest the following:

1) `Coin` should extend the `NumberValue` class
2) `Fiat` should implement `MonetaryAmount` (or perhaps be deprecated in favor of MonetaryAmount)
3) A MonetaryAmount subclass should be created for a Bitcoin (value, currency) pair

I realize this is not going to be a popular request so soon after the conversion to
`Coin` and while JavaMoney is so new. But I wanted to create the issue for discussion
and to raise awareness so this change might be included in a future release.

The Specification supports many important and interesting use cases (such as crypto
currency and currency exchanges) and even includes a link to bitcoinj in the appendix.

References
---------

The JavaMoney project home page:
http://javamoney.github.io

The JavaMoney specification:
https://github.com/JavaMoney/jsr354-api/blob/master/src/main/asciidoc/JavaMoneySpecification.adoc

The JavaMoney API (Java 8+)
https://github.com/JavaMoney/jsr354-api

The JavaMoney Reference Implementation (Java 8+):
https://github.com/JavaMoney/jsr354-ri

The Java Money API Backport (Java 6/7):
https://github.com/JavaMoney/jsr354-api-bp

The JavaMoney Reference Implementation Backport (Java 7):
https://github.com/JavaMoney/jsr354-ri-bp


Reported by sean@msgilligan.com on 2015-04-10 01:17:46

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
msgilligancommented, Jul 5, 2016

@stokito I’ve created a module in my bitcoinj-addons repository that a Bitcoin currency provider based on the one from javamoney-shelter. I’ve also added a prototype adapter that will wrap and adapt the Exchange interface from the extensive XChange library of Bitcoin exchange clients. See the README section

0reactions
msgilligancommented, Sep 28, 2022

An update on this:

  1. The JavaMoney work that I have done is in the https://github.com/ConsensusJ/consensusj project in the consensusj-currency and consensusj-exchange modules. Feel free to try it out and submit issues or pull-requests.
  2. JavaMoney will not be bundled with the JDK as some had originally hoped.
  3. Although I am the one who originally opened this issue, I now believe – partly because of (2) – that it would be better not to make bitcoinj-core dependent upon JavaMoney.
  4. I do think that JavaMoney is a useful library for some applications and (via the ConsensusJ modules) can be useful in Bitcoin applications.

@schildbach I opened this issue on Google Code, but since Mike imported it to GitHub, I can’t close it. I recommend we close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Different Ways to Convert Bitcoin to Fiat Currency
Cryptocurrency Exchanges: This is the most widely used method to convert bitcoin to fiat currency. It is similar to a money exchange center ......
Read more >
Java Money and the Currency API - Baeldung
A quick guide to the Currency and Money upcoming JSR and how to use it ... To define classes representing currencies and monetary...
Read more >
Converting Bitcoins to Fiat Currency - Javatpoint
Converting Bitcoins to Fiat Currency with Tutorial, Introduction, History of Blockchain, ... It is also used to convert your bitcoin into fiat currency....
Read more >
Smart Contracts with Tokenized Fiat Currency on Sberbank's ...
Smart Contracts with Tokenized Fiat Currency on Sberbank's Platform - Oleg Abdrashitov, SberbankOleg will present a platform for issuance of ...
Read more >
How Can You Convert Your Cryptocurrency into Fiat Currency?
Join me in a free blockchain education masterclass and learn "How to Adapt to Change Using Blockchain to Transform Your Career and Help...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found