Bitcoin Forum
December 10, 2016, 11:09:33 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: BitCoinJ 0.5  (Read 2381 times)
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
May 30, 2012, 04:00:22 PM
 #1

I'm pleased to announce the release of BitCoinJ 0.5, the library that powers Android Wallet, SatoshiDice, Bitcoin Status, the server side part of BCCAPI and much more.

This release focusses on bug fixes, making the build more standard and completing the transition to the protobuf wallet format. It also includes the first preview of the native API, allowing you to access bitcoinj from C++/Objective-C++ using a straightforward, intuitive mapping from the Java API. Much easier than JNI and no JVM is required, just the libgcj support library. Examples of a native Cocoa app for OS X and a command line hello world app are included. Because it's not fully finished/documented yet, this work is available on a branch rather than in the main release.

We now have a Google+ page where we'll post announcements and developer tips/ideas: https://plus.google.com/102614914114364947458

New in this release:
  • Address.getParameters() and Address.getParametersFromAddress() let you figure out for what network the address is for (test, production, etc). BitcoinURI no longer requires a NetworkParameters for the same reason.
  • Updated to latest bouncy castle version, remove the need for the Android artifact by using the SpongyCastle build
  • Receives pending transactions much faster than before
  • Update to the testnet2 rules
  • Wallets now store the current chain head
  • wallet-tool can now create and broadcast transactions from the command line
  • Wallets will now be auto-migrated to protobuf format if they were previously serialized Java objects
  • Now uses the standard Maven directory layout
  • Many important bugfixes

I'd like to thank Jim Burton, Miron Cuperman, Andreas Schildbach and Gary Young for their contributions to this release.

You can get it from the download page on www.bitcoinj.org
1481368173
Hero Member
*
Offline Offline

Posts: 1481368173

View Profile Personal Message (Offline)

Ignore
1481368173
Reply with quote  #2

1481368173
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481368173
Hero Member
*
Offline Offline

Posts: 1481368173

View Profile Personal Message (Offline)

Ignore
1481368173
Reply with quote  #2

1481368173
Report to moderator
1481368173
Hero Member
*
Offline Offline

Posts: 1481368173

View Profile Personal Message (Offline)

Ignore
1481368173
Reply with quote  #2

1481368173
Report to moderator
1481368173
Hero Member
*
Offline Offline

Posts: 1481368173

View Profile Personal Message (Offline)

Ignore
1481368173
Reply with quote  #2

1481368173
Report to moderator
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218


Gerald Davis


View Profile
May 30, 2012, 04:09:36 PM
 #2

Impressive.
DavinciJ15
Hero Member
*****
Offline Offline

Activity: 750


Bitcoin - helping to end bankster enslavement.


View Profile WWW
June 04, 2012, 02:56:52 AM
 #3

I am using BitcoinSharp and I can't seem to connect to any peers the just keep disconnecting me after the version message is sent.

My main code looks like this...

Code:
         // TODO: see http://code.google.com/p/bitcoinj/wiki/GettingStarted
          NetworkParameters param = NetworkParameters.ProdNet();

          // Creates a brand new keypair.
          EcKey key = new EcKey();

          // Gets the raw public key bytes. You don't normally need this.
          byte[] publicKey = key.PubKey;// GetPubKey();

          // Gets the address corresponding to the public key.
          Address addr = key.ToAddress(param);
          Debug.WriteLine(addr.ToString());   // ->  1HwBZk111V4eEEC4BcN8fZd3RVifig2WjY

          // Try to read the wallet from storage, create a new one if not possible.
          Wallet wallet;
          FileStream walletFile;
          try
          {
            walletFile = new FileStream("wallet.dat", FileMode.Open);
            wallet = Wallet.LoadFromFileStream(walletFile);
          }
          catch
          {
            walletFile = new FileStream("wallet.dat", FileMode.Create);
            wallet = new Wallet(param);
            wallet.Keychain.Add(new EcKey());
            wallet.SaveToFileStream(walletFile);
          }
          // Fetch the first key in the wallet (should be the only key).
          key = wallet.Keychain[0];

          // Load the block chain, if there is one stored locally.
          //var localIp = Dns.GetHostEntry(Dns.GetHostName()).AddressList.Where(ip => ip.AddressFamily == AddressFamily.InterNetwork).First();
          //NetworkConnection conn = NetworkConnection (IPAddress.Parse("23.20.196.190"), param, 0 /* bestInKeychain */, 0);
          IBlockStore blockStore = new DiskBlockStore(param, new FileInfo("production_net.blockchain"));
          BlockChain chain = new BlockChain(param, wallet, blockStore);
          //
          //Peer peer = new Peer(param, new PeerAddress(IPAddress.Parse("192.168.2.110")), chain);
          PeerGroup group = new PeerGroup(blockStore, param, chain);
          group.AddAddress(new PeerAddress(IPAddress.Parse("23.20.196.190")));
          //group.AddAddress(new PeerAddress(IPAddress.Parse("107.20.229.34")));
          group.AddAddress(new PeerAddress(IPAddress.Parse("107.20.229.35")));
          //group.AddAddress(new PeerAddress(IPAddress.Parse("192.168.2.110")));
          //group.AddPeerDiscovery(new BitCoinSharp.Discovery.SeedPeers(param));
          group.PeerConnected += new EventHandler<PeerConnectedEventArgs>(group_PeerConnected);
          group.PeerDisconnected += new EventHandler<PeerDisconnectedEventArgs>(group_PeerDisconnected);
          //group.
          Console.WriteLine("starting");
          group.Start();
          //Console.WriteLine("running");
          //group.Run();
          Console.WriteLine("hit enter to stop");
          Console.ReadLine();

My console output with the debugging on looks like this...

Code:
production_net.blockchain
468 [9] INFO BitCoinSharp.Store.DiskBlockStore (null) - Read chain head from dis
k: 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
468 [9] INFO BitCoinSharp.Store.DiskBlockStore (null) - Block chain read complet
e in 0ms
468 [9] INFO BitCoinSharp.BlockChain (null) - chain head is:
v1 block:
   previous block: 0000000000000000000000000000000000000000000000000000000000000
000
   merkle root: 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b

   time: [1231006505] 01/01/0001 12:04:24 AM
   difficulty target (nBits): 486604799
   nonce: 2083236893

starting
hit enter to stop
515 [PeerGroup-1-thread-1] INFO BitCoinSharp.PeerGroup (null) - Connecting to Pe
er(23.20.196.190:0)
24375 [PeerGroup-1-thread-1] DEBUG BitCoinSharp.BitcoinSerializer (null) - Sendi
ng version message: f9beb4d976657273696f6e00000000007000000060ea0000000000000000
00002f24cc4f00000000000000000000000000000000000000000000ffff7f000001208d00000000
0000000000000000000000000000ffff7f000001208d00000000000000001b2f426974436f696e53
686172703a302e362d534e415053484f542f00000000
75765 [PeerGroup-1-thread-1] INFO BitCoinSharp.PeerGroup (null) - Error talking
to Peer(107.20.229.35:0): Socket is disconnected

NOTE: I am behind a NAT router and my firewall is off but I did not port redirect to my dev box on my router, I'm assuming that's not needed since I'm making the connection.

10 bitcoins if you can help me get this going so I can send and receive bitcoins.
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
June 04, 2012, 09:23:55 AM
 #4

BitCoinSharp has unfortunately fallen far behind BitCoinJ, as you can see from the source history. So we can't really help you with code that's >6 months old, sorry.

This has reminded me to remove the link to the project from the home page.

There are tools that can do automatic translations of Java into C# these days which are fairly good, developed by the Mono guys. It may be worth experimenting with them such that a fully automated translation can be maintained. The way BitCoinJ uses Java is fairly pedestrian because we need to support Android, which is based on an older version of Java.
DavinciJ15
Hero Member
*****
Offline Offline

Activity: 750


Bitcoin - helping to end bankster enslavement.


View Profile WWW
June 04, 2012, 12:39:28 PM
 #5

BitCoinSharp has unfortunately fallen far behind BitCoinJ, as you can see from the source history. So we can't really help you with code that's >6 months old, sorry.

This has reminded me to remove the link to the project from the home page.

There are tools that can do automatic translations of Java into C# these days which are fairly good, developed by the Mono guys. It may be worth experimenting with them such that a fully automated translation can be maintained. The way BitCoinJ uses Java is fairly pedestrian because we need to support Android, which is based on an older version of Java.
Cool, Thanks for the response.

So where is your code for Bitcoinj?  I have looked at bitcoinj.org and I get...

NOTICE: This domain name expired on 06/01/2012 and is pending renewal or deletion.

Also if I go here http://code.google.com/p/bitcoinj/ and compare the code very little if anything has changed.  I would have assumed the protocol 0.3.18.00 would have changed to 6.0 by now.

Funny thing is I am using C# to leverage my abilities and the fact that I can use Mono for IPhone and Android.
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
June 04, 2012, 09:47:46 PM
 #6

Yes, go-daddy sucks. I just renewed the domain.

If you look at the code changes:

http://code.google.com/p/bitcoinj/source/list

you can see it's been changing continuously, whereas the Bitcoin# version stopped changing October last year:

http://code.google.com/p/bitcoinsharp/source/list

So you are far behind with the current code.

I suggest either switching to Java (which in any case is basically a simpler/less advanced C#) or using a translator tool to get a .NET version from the Java source.
DavinciJ15
Hero Member
*****
Offline Offline

Activity: 750


Bitcoin - helping to end bankster enslavement.


View Profile WWW
June 04, 2012, 11:06:12 PM
 #7

Yes, go-daddy sucks. I just renewed the domain.

If you look at the code changes:

http://code.google.com/p/bitcoinj/source/list

you can see it's been changing continuously, whereas the Bitcoin# version stopped changing October last year:

http://code.google.com/p/bitcoinsharp/source/list

So you are far behind with the current code.

I suggest either switching to Java (which in any case is basically a simpler/less advanced C#) or using a translator tool to get a .NET version from the Java source.

I see, that's a lot of changes I will try a translator.
Andreas Schildbach
Hero Member
*****
Offline Offline

Activity: 563



View Profile WWW
July 11, 2012, 12:16:46 PM
 #8

BitCoinJ 0.5.2 has been released. The release announcement can be read here.

Bitcoin Wallet for Android: Your own Bitcoins, in your own pocket!
https://play.google.com/store/apps/details?id=de.schildbach.wallet
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!