Advertisement
shmoula

Untitled

Jan 2nd, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. @RequestMapping("/testnet/**")
  2. @Controller
  3. public class TestnetController {
  4.     private NetworkParameters params;
  5.     private WalletAppKit kit;
  6.    
  7.     public TestnetController() {
  8.         params = TestNet3Params.get();
  9.        
  10.         kit = new WalletAppKit(params, new File("."), "_") {
  11.             @Override
  12.             protected void onSetupCompleted() {
  13.                 if (wallet().getKeychainSize() < 1)
  14.                     wallet().addKey(new ECKey());
  15.             }
  16.         };
  17.  
  18.         kit.startAndWait();
  19.     }
  20.  
  21.     @RequestMapping(value = "/wallet/{addressVariable}", method = RequestMethod.GET)
  22.     @ResponseBody
  23.     public String walletWatcher(@PathVariable String addressVariable) throws AddressFormatException {
  24.         Address address = new Address(params, addressVariable);
  25.        
  26.         kit.wallet().addWatchedAddress(address);
  27.        
  28.         return kit.wallet().toString();
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement