But what are your bitcoin nodes running as for your private network? Aren't
they in "regtest" mode?

On Thu, May 5, 2016 at 12:02 PM, Álvaro Castellanos López <
[email protected]> wrote:

> I am running my own private test network extending TestNet3Params Class
> and overriding id param (and dnsSeed, ports...) for it doesn't use
> "org.bitcoin.test". I do that because it checks another checkpoints (I
> think that it checks real testnet)
>
> But When I do this:
>
> import java.io.File
> import bitcoin.network.TestNetworkParams
> import org.bitcoinj.kits.WalletAppKit
>
> object MainKit extends App {
>   val walletKit = new WalletAppKit(TestNetworkParams, new File("."), 
> "walletTestNet")
>   walletKit.startAsync
>   walletKit.awaitRunning
>
>   Console.println("Address: " + walletKit.wallet.currentReceiveAddress)
>   Console.println("Bitcoins: " + walletKit.wallet.getBalance)
> }
>
>
> it works!
>
>
> I'm going to read more about BitcoinJ because, obviously, I ignore 
> something... Thank you
>
>
>
> Regards
>
>
> On Thursday, May 5, 2016 at 3:40:14 PM UTC+2, Jameson Lopp wrote:
>>
>> If you are running your own private test network then I'm pretty sure
>> that you're going to need to pass the network ID as
>>
>> NetworkParameters.ID_REGTEST which is equivalent to "
>> *org.bitcoin.regtest"*
>>
>> - Jameson
>>
>> On Thu, May 5, 2016 at 9:03 AM, Álvaro Castellanos López <
>> [email protected]> wrote:
>>
>>> Hello,
>>>
>>> I load a wallet from a file like:
>>>
>>> import java.io.File
>>>
>>> import bitcoin.network.TestNetworkParams
>>> import org.bitcoinj.core.{BlockChain, PeerGroup, Wallet}
>>> import org.bitcoinj.store.MemoryBlockStore
>>>
>>> object Main extends App {
>>>   val wallet = Wallet.loadFromFile(new File("walletTestNet.wallet"))
>>>   val blockStore = new MemoryBlockStore(TestNetworkParams)
>>>   val blockChain = new BlockChain(TestNetworkParams, wallet, blockStore)
>>>   val peerGroup = new PeerGroup(TestNetworkParams, blockChain)
>>>   peerGroup.addWallet(wallet)
>>>   peerGroup.startAsync
>>>   peerGroup.waitForPeers(1).get
>>>
>>>   Console.println("Address: " + wallet.currentReceiveAddress)
>>>
>>>   Console.println("Bitcoins: " + wallet.getBalance)
>>>
>>> }
>>>
>>>
>>> import bitcoin.network.TestNetworkParams is just my own TestNet
>>>
>>>
>>> When I used WalletAppKit I didn't have any problem. I could connect. But I 
>>> don't want to use the kit.
>>>
>>>
>>> This piece of code throws this exception:
>>>
>>>
>>> Exception in thread "main" org.bitcoinj.store.UnreadableWalletException: 
>>> Unknown network parameters ID
>>>     at 
>>> org.bitcoinj.store.WalletProtobufSerializer.readWallet(WalletProtobufSerializer.java:397)
>>>     at org.bitcoinj.core.Wallet.loadFromFileStream(Wallet.java:1520)
>>>     at org.bitcoinj.core.Wallet.loadFromFile(Wallet.java:1450)
>>>     at console.Main$.delayedEndpoint$console$Main$1(Main.scala:14)
>>>     at console.Main$delayedInit$body.apply(Main.scala:13)
>>>     at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
>>>     at 
>>> scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
>>>     at scala.App$$anonfun$main$1.apply(App.scala:76)
>>>     at scala.App$$anonfun$main$1.apply(App.scala:76)
>>>     at scala.collection.immutable.List.foreach(List.scala:381)
>>>     at 
>>> scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
>>>     at scala.App$class.main(App.scala:76)
>>>     at console.Main$.main(Main.scala:13)
>>>     at console.Main.main(Main.scala)
>>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>     at 
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>>     at 
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>     at java.lang.reflect.Method.invoke(Method.java:498)
>>>     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
>>>
>>>
>>> So, I need to load the wallet from a file and I don't know how I can pass 
>>> it network parameters.
>>>
>>>
>>> BitcoinJ version: 0.13.6
>>>
>>>
>>> Could anyone help me?
>>>
>>>
>>>
>>> Regards
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "bitcoinj" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "bitcoinj" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to