Advertisement
franky1

daemon connection startpoint

Sep 29th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. ' add a 2 txt box and a button. TxtAddress and Txtamount tell the button
  2. 'if u want to use litecoin, the API are the same u just change the folder location from bitcoin to litecoin
  3. 'and use the litecoinD as oppose to bitcoinD obviously :D
  4. 'ensure u have the daemon running and it will work if not the APIgrabber wil sense its not running and give
  5. ' you a nice message
  6. '_code below this line_
  7.  
  8.  
  9. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  10. Dim Argumentz As String
  11. Argumentz = APIGrabber(InputBox("Input arguments"))
  12. 'this is just an example of manually typing in a API command
  13. MsgBox(Argumentz)
  14.  
  15. End Sub
  16.  
  17. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  18.  
  19. dim stringtext as string
  20. dim TransXID as string
  21. stringtext ="sendtoaddress " & txtAddress.text & " " & txtamount.text /
  22. TransXID=APIGrabber(stringtext)
  23. if TransXID <> "daemons not running fool" then
  24. msgbox("success")
  25. 'do what u like with the transaction id returned
  26. else
  27. msgbox("dumb fool done something wrong: " & transXID)
  28. endif
  29. End Sub
  30.  
  31. Private Function APIGrabber(ByVal Argumentz As String) As String
  32. If Process.GetProcessesByName("bitcoind").Count > 0 Then
  33. Dim proc = New Process
  34. proc.StartInfo.Arguments = Argumentz
  35. proc.StartInfo.FileName = "C:\Program Files\Bitcoin\daemon\bitcoind.exe"
  36. proc.StartInfo.RedirectStandardOutput = True
  37. proc.StartInfo.UseShellExecute = False
  38. proc.StartInfo.CreateNoWindow = True
  39. proc.Start()
  40. proc.WaitForExit()
  41. Return proc.StandardOutput.ReadLine
  42. Else
  43. Return "daemons not running fool"
  44. End If
  45.  
  46. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement