zold-io / java-api Goto Github PK
View Code? Open in Web Editor NEWZold Java API
Home Page: https://www.zold.io
License: MIT License
Zold Java API
Home Page: https://www.zold.io
License: MIT License
There is a lot of use of Mockito in the tests, it makes it very hard to read and a pain to write.
Using Fakes (see https://www.yegor256.com/2014/09/23/built-in-fake-objects.html) instead would improve the quality of the tests as well as provide a secondary implementation of the main concepts of the Zold java-api, which can only be good for the project.
The Network
interface should contain method, that will allow pulling all wallets.
public interface Network {
// Pull all wallets from the network.
Wallets wallets();
}
The puzzle 40-432fb579
from #40 has to be resolved:
java-api/src/main/java/io/zold/api/Taxes.java
Lines 34 to 40 in 4a0b4b4
The puzzle was created by Victor Noël on 28-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 29-4f17ced3
from #29 has to be resolved:
java-api/src/main/java/io/zold/api/CpTransaction.java
Lines 30 to 32 in 72b9c48
The puzzle was created by Victor Noël on 25-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 61-7c0a7e0c
from #61 has to be resolved:
java-api/src/main/java/io/zold/api/Taxes.java
Lines 34 to 41 in 07545a9
The puzzle was created by rultor on 04-Dec-18.
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
We have code duplication in RtTransaction
. Each method parses transaction string in a same manner:
final String value = new UncheckedText(
new IoCheckedScalar<>(
new ItemAt<>(
index, new SplitText(this.transaction, ";")
)
).value()
).asString();
We can extract this to a method or a class.
Furthermore we can simplify the above example to:
final String ident = new IoCheckedScalar<>(
() -> new ItemAt<>(0, new SplitText(this.transaction, ";"))
.value().asString()
).value();
The puzzle 12-1be65647
from #12 has to be resolved:
java-api/src/main/java/io/zold/api/WalletsIn.java
Lines 93 to 95 in 50f250c
The puzzle was created by rultor on 08-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 15-f9a60893
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 78 to 80 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The README.md is outdated. There is no find
method in Wallets.
Also no pull
method in Wallet.
The Amount
interface does not exist.
With outdated documentation, it's hard to understand how the interfaces are intended to be used.
The puzzle 21-829d3247
from #21 has to be resolved:
java-api/src/test/java/io/zold/api/WalletTest.java
Lines 81 to 84 in 03cd479
The puzzle was created by Paulo Lobo on 13-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
In the process of solving #40, I am faced with a problem with the existing code.
The javadoc of Network.push
says:
/**
* Push the wallet to the network. The network will select the
* remote node with the highest score (with a minimum of {@code 16}).
* @param wallet The wallet
*/
void push(Wallet wallet);
But I don't think that is correct: the papers talks about selecting nodes with high score and a minimum of 16 when paying taxes. This has nothing to do with pushing, which should be done to every known nodes (even though they can decide not to accept the wallet).
The concept of paying taxes and of pushing should be separated (it is the case in the ruby implementation).
Either Wallet
should be responsible of paying taxes, or Network
should.
I would be favour of letting Network
do that simply because it would be best, design-wise, to have Wallet
being ignorant of Network
and Remote
s matters. Network
already manipulates both Remote
s and Wallet
s.
@llorllale what do you think?
@paulodamaso since you did create the @todo
s I suppose you have maybe an opinion?
New qulice version brings following important changes:
@author
tag (it is prohibited now)@version
tag (it is prohibited now)/*
instead of /**
- this will fix problem with IntelliJ reporting it as a javadoc that is not attached to any classThe puzzle 16-27c16652
from #16 has to be resolved:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 205 to 213 in 6c86827
The puzzle was created by rultor on 12-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
Current implementation of RtTransaction.hashCode
directly delegate to this.transaction.hashCode
, but this breaks the contract of Object
that says that equals
and hashCode
should be coherent together.
In particular it means that a transaction and a plain string can have the same hash code, but calling equals
on them will return false.
The solution is trivial: use Objects.hash
that ensure this does not happen.
The puzzle 12-99ac50e5
from #12 has to be resolved:
java-api/src/test/java/io/zold/api/WalletsInTest.java
Lines 84 to 89 in 50f250c
The puzzle was created by rultor on 08-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 54-605ff193
from #54 has to be resolved:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 200 to 202 in 156d5b5
The puzzle was created by rultor on 11-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 6-af7c6ffd
from #6 has to be resolved:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 131 to 134 in 55c445e
The puzzle was created by rultor on 04-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
It will be useful for tests to have class WalletMatcher
. It can be used as follows:
MatcherAssert.assertThat(
new WalletsIn(this.path).create(),
WalletMatcher.hasId(id)
);
The puzzle 54-c02fec87
from #54 has to be resolved:
java-api/src/main/java/io/zold/api/CpTransaction.java
Lines 30 to 33 in 156d5b5
The puzzle was created by rultor on 11-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 15-4f67a35d
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 53 to 55 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
On running maven clean install -Pqulice throw the following error on Windows:
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (default) on project java-api: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "xcop": CreateProcess error=2,
[ERROR] around Ant part ...... @ 18:50 in C:\zold\java-api\target\antrun\build-main.xml
For com.jcabi required to install xcop by gem and add to PATH variable.
The puzzle 15-ad2b4fa5
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 94 to 96 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The Wallets
interface has a method to create a new Wallet
instance. In order to create Wallet we need header information:
I'm not sure, that the Wallets.create()
should accept that information through parameters. Who should maintain the ids? From where we will receive it? Through the constructor of WalletsIn()
?
The puzzle 4-aab61a84
from #4 has to be resolved:
java-api/src/main/java/io/zold/api/WalletsIn.java
Lines 79 to 82 in 93fa5fc
The puzzle was created by Tolegen Izbassar on 03-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
Let's implement Wallets
:
java-api/src/main/java/io/zold/api/Wallets.java
Lines 34 to 40 in f323e05
Let's name the implementation WalletsIn
.
Let's implement Wallet
:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 35 to 63 in f323e05
According to the white paper, we should sign each transaction with RSA. For that, we need an RSA private key. Where to get it? Will it be generated for each wallet?
The puzzle 16-e32ec38b
from #16 has to be resolved:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 47 to 50 in 6c86827
The puzzle was created by rultor on 12-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 5-dec07794
from #5 has to be resolved:
java-api/src/main/java/io/zold/api/RtNetwork.java
Lines 63 to 67 in e7bf162
The puzzle was created by Paulo Lobo on 19-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 4-968ad704
from #4 has to be resolved:
java-api/src/main/java/io/zold/api/WalletsIn.java
Lines 70 to 73 in 93fa5fc
The puzzle was created by Tolegen Izbassar on 03-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 6-f97f5c14
from #6 has to be resolved:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 123 to 125 in 55c445e
The puzzle was created by rultor on 04-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
Let's create a skeleton and deploy it to Maven Central.
According to the whitepaper merging of two wallets is an operation of merging copies
into a local one.
Merge algorithm first sorts the copies
and then merges transactions from that copies.
Currently, sorting is done outside Wallet.merge()
method. It is part of Remote.pull()
method.
I propose to add an additional method to Wallet
: Wallet merge(Copies copies)
and remove explicit sorting from Remote.pull()
.
Similar to what we have in ruby version
The puzzle 15-0d2d728d
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 104 to 106 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 5-c56bb757
from #5 has to be resolved:
java-api/src/main/java/io/zold/api/RtNetwork.java
Lines 52 to 55 in e7bf162
The puzzle was created by Paulo Lobo on 19-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 15-1e017e66
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 62 to 64 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 56-e2c92447
from #56 has to be resolved:
java-api/src/main/java/io/zold/api/Copies.java
Lines 85 to 87 in d6a83ae
The puzzle was created by Vatavuk on 14-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 15-0b8da355
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 123 to 126 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 33-65714492
from #33 has to be resolved:
java-api/src/test/java/io/zold/api/WalletTest.java
Lines 43 to 46 in 0179105
The puzzle was created by George Aristy on 12-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 41-44da2a34
from #41 has to be resolved:
java-api/src/main/java/io/zold/api/Copies.java
Lines 35 to 41 in 7002ecb
The puzzle was created by Victor Noël on 23-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 15-a01f2b41
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 70 to 72 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
Let's implement Network
:
java-api/src/main/java/io/zold/api/Network.java
Lines 34 to 48 in f323e05
It's not clear how to connect to Zold network. Is there some REST API
that we should use? Or there is some master address, and we need to issue some commands?
The puzzle 6-2cc9aa8f
from #6 has to be resolved:
java-api/src/main/java/io/zold/api/Wallet.java
Lines 142 to 144 in 55c445e
The puzzle was created by rultor on 04-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 56-02b4f5e6
from #56 has to be resolved:
java-api/src/test/java/io/zold/api/CopiesTest.java
Lines 37 to 41 in d6a83ae
The puzzle was created by Vatavuk on 06-Aug-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 15-b88242e3
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 45 to 47 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 5-38f68f69
from #5 has to be resolved:
java-api/src/test/java/io/zold/api/NetworkTest.java
Lines 38 to 41 in e7bf162
The puzzle was created by Paulo Lobo on 19-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 15-957c2199
from #15 has to be resolved:
java-api/src/main/java/io/zold/api/RtTransaction.java
Lines 86 to 88 in 1405fe3
The puzzle was created by Tolegen Izbassar on 06-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 61-94b7f6ca
from #61 has to be resolved:
java-api/src/main/java/io/zold/api/Transaction.java
Lines 145 to 148 in 07545a9
The puzzle was created by rultor on 04-Dec-18.
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
The puzzle 5-fd3c6d54
from #5 has to be resolved:
java-api/src/main/java/io/zold/api/RtNetwork.java
Lines 32 to 35 in e7bf162
The puzzle was created by Paulo Lobo on 19-Jul-18.
Estimate: 30 minutes,
If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.