Coder Social home page Coder Social logo

Comments (13)

jjos2372 avatar jjos2372 commented on June 5, 2024 1

@jjos2372 is your fork still up to date?

When I want to use a wallet for the dogecoin blockchain, what parts of bitcoinj I need to use and want are the parts of libdohj?
Is it enought to use

NetworkParameters params = DogecoinMainNetParams.get();

and use this params for the wallet and the webkitapi of bitcoinj ?

@Tockra I've been using https://github.com/jjos2372/altcoinj since I published it with no problem, as you said:

NetworkParameters params = DogecoinMainNetParams.get();

Is enough as long as you have the dependencies:

repositories {
	maven { url 'https://jitpack.io' }
}
dependencies {
	compile 'com.github.jjos2372:altcoinj:f26e20bb13'
	compile 'org.bitcoinj:bitcoinj-core:0.15.6'
}

In addition I also have support for LTC on it.

from libdohj.

msgilligan avatar msgilligan commented on June 5, 2024

Attn: @JeremyRand

from libdohj.

jjos2372 avatar jjos2372 commented on June 5, 2024

I just made this fork compatible with bitcoinj 0.15 https://github.com/jjos2372/altcoinj

from libdohj.

Tockra avatar Tockra commented on June 5, 2024

@jjos2372 is your fork still up to date?

When I want to use a wallet for the dogecoin blockchain, what parts of bitcoinj I need to use and want are the parts of libdohj?
Is it enought to use

NetworkParameters params = DogecoinMainNetParams.get();

and use this params for the wallet and the webkitapi of bitcoinj ?

from libdohj.

Tockra avatar Tockra commented on June 5, 2024

Okay, I hope I did it right.
So I can fully ignore everything else from altcoinj instead of DogecoinMainNetParams.get();.
That sounds easy.

Maybe you can help me further.
I read in a bitcoinj tutorial, that I need to save the wallet multiple times in a file. I don't understand why.

I just want to have a wallet, where I can get the balance and I want to create fresh addresses to which multiple transactions can be sent. Sometimes I want to send balance from that wallet to a other.
When and why I need to write a new version of the wallet to a file?

And what happens if I make wallet transactions (getBalance, sendCoin, ...) before the blockchain is fully synced?

from libdohj.

jjos2372 avatar jjos2372 commented on June 5, 2024

You would be actually using all bitcoinj infrastructure, so check their docs. I particularly create a kit:

kit = new WalletAppKit(params, ...)

And them sync the chain before using it:

		kit.startAsync();
		kit.awaitRunning();

You probably should start with DogecoinTestNet3Params.get() first.

from libdohj.

Tockra avatar Tockra commented on June 5, 2024

Okay thank you. I will look ^^.
I hope my questions will be answered here : bitcoinj/bitcoinj#2020

from libdohj.

Tockra avatar Tockra commented on June 5, 2024

Following code causes into this exception:

[00:25:51 WARN]: [org.bitcoinj.net.ConnectionHandler] Error handling SelectionKey: java.nio.channels.CancelledKeyException
app    | java.nio.channels.CancelledKeyException: null
app    | 	at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:74) ~[?:?]
app    | 	at sun.nio.ch.SelectionKeyImpl.readyOps(SelectionKeyImpl.java:133) ~[?:?]
app    | 	at java.nio.channels.SelectionKey.isWritable(SelectionKey.java:378) ~[?:?]
app    | 	at org.bitcoinj.net.ConnectionHandler.handleKey(ConnectionHandler.java:244) ~[?:?]
app    | 	at org.bitcoinj.net.NioClientManager.handleKey(NioClientManager.java:86) ~[?:?]
app    | 	at org.bitcoinj.net.NioClientManager.run(NioClientManager.java:122) ~[?:?]
app    | 	at com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(AbstractExecutionThreadService.java:66) ~[patched_1.16.1.jar:git-Paper-"0b33230f2"]
app    | 	at com.google.common.util.concurrent.Callables$4.run(Callables.java:122) ~[patched_1.16.1.jar:git-Paper-"0b33230f2"]
app    | 	at org.bitcoinj.utils.ContextPropagatingThreadFactory$1.run(ContextPropagatingThreadFactory.java:51) ~[?:?]
app    | 	at java.lang.Thread.run(Thread.java:832) [?:?]
NetworkParameters params = DogecoinMainNetParams.get();
        this.walletKit = new WalletAppKit(params,new File(config.getWalletPath()),"wallet.dat");
        this.walletKit.setBlockingStartup(true);
        this.walletKit.startAsync();
        this.walletKit.awaitRunning();

from libdohj.

jjos2372 avatar jjos2372 commented on June 5, 2024

I use something like this for an existing wallet folder (previously created with bitcoinj randomly, using a seed, etc.):

		kit = new WalletAppKit(params, folderFile, filePrefix) {
			@Override
			protected void onSetupCompleted() {
				log.info("kit setup complete");
			}
		};
		// Download the block chain and wait until it's done.
		kit.startAsync();
		kit.awaitRunning();

Recall that filePrefix is the wallet file name without the .wallet, not sure where are you getting this .dat file.

from libdohj.

Tockra avatar Tockra commented on June 5, 2024

I copied it somewhere.
But I still get the java.nio.channels.CancelledKeyException at application start. That isn't cool. Because they spam my console...

from libdohj.

Tockra avatar Tockra commented on June 5, 2024

So I did a unsafe workaround. I just filter all Exceptions out of my log, which happens without valid reason:
log4j2.xml:

...
    <Loggers>
        <Root level="info">
            <filters>
                <MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
                <RegexFilter regex=".*java.nio.channels.CancelledKeyException.*" onMatch="DENY" onMismatch="NEUTRAL"/>
                <RegexFilter regex=".*Error\swriting\smessage\sto\sconnection,\sclosing\sconnection.*" onMatch="DENY" onMismatch="NEUTRAL"/>
                <RegexFilter regex=".*java.net.SocketException.*" onMatch="DENY" onMismatch="NEUTRAL"/>
                <RegexFilter regex=".*java.net.ConnectException.*" onMatch="DENY" onMismatch="NEUTRAL"/>
                <RegexFilter regex=".*SelectionKey.*java.lang.IllegalStateException.*" onMatch="DENY" onMismatch="NEUTRAL"/>
                <RegexFilter regex=".*Received\sRejectMessage\sbefore\sversion\shandshake\sis\scomplete.*" onMatch="DENY" onMismatch="NEUTRAL"/>
                <RegexFilter regex=".*java.net.NoRouteToHostException.*Host\sis\sunreachable.*" onMatch="DENY" onMismatch="NEUTRAL"/>
            </filters>
        </Root>
    </Loggers>

from libdohj.

rnicoll avatar rnicoll commented on June 5, 2024

I've finally had some free time, reviews of #44 would be appreciated

from libdohj.

rnicoll avatar rnicoll commented on June 5, 2024

Oops this was merged a while ago, closing now.

from libdohj.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.