SHARE
TWEET

VB.net BTC-E.com tradebot verifyer

franky1 Aug 6th, 2012 9,891 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. donations LTC LWffnmX32ersnjGyPTNjpYhadk8YM84eb9
  2. donations BTC 1FrankZ7t5Wbf5uTMxMtCiQy9eKDsj1fUn
  3. insert onto form
  4. button1 'button named button1
  5. txtrate 'txt box to input ur price
  6. txtamount 'txt box to imput the coins
  7. lstmeth 'listbox collective data =getInfo Trade TradeHistory
  8. lstType 'listbox collective data = buy sell
  9. lstpair 'listbox collective data = btc_usd ltc_btc ltc_usd
  10.  
  11. you can ofcourse change it so that the postdata grabs from other objects instead of listboxes
  12. but this is just a quick example, leaving you the fun to play around after remember to add in your key and secret into the place where it asks (inside the button sub). you will see the only web address it links to is BTC-E.com
  13.  
  14. -copy code below this line into form coding and insert button1 onto form to test-
  15.  
  16. Imports System.Net
  17. Imports System.Text
  18. Imports System.IO
  19. Imports System.Security.Cryptography
  20.  
  21. Public Class Form1
  22.  
  23.     Private Sub Form1_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  24.         LstType.Items.Add("buy")
  25.         LstType.Items.Add("sell")
  26.         LstPair.Items.Add("ltc_usd")
  27.         LstPair.Items.Add("ltc_btc")
  28.         LstPair.Items.Add("btc_usd")
  29.         LstMeth.Items.Add("Trade")
  30.    end sub
  31.  
  32.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  33.  
  34.         Dim postData As String
  35.  
  36.         Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://btc-e.com/tapi"), HttpWebRequest)
  37.         Dim randomn As String
  38.         Dim keyer As String = LCase("YOUR_KEY") 'your key goes here
  39.        Dim secret As String = "Y0urS3cR3tC0de" 'your secret goes here
  40.        randomn = GetUnixTimestamp(Now)
  41.         postData = "method=" & Lstmeth.SelectedItem & "&nonce=" & randomn & "&pair=" & Lpair.SelectedItem & "&type=" & lstType.selecteditem & "&rate=" & Txtrate.Text & "&amount=" & TxtAmount.Text
  42.         Dim KeyByte() As Byte = Encoding.ASCII.GetBytes(secret)
  43.         Dim HMAcSha As New HMACSHA512(Encoding.ASCII.GetBytes(secret))
  44.         Dim messagebyte() As Byte = Encoding.ASCII.GetBytes(postData)
  45.         Dim hashmessage() As Byte = HMAcSha.ComputeHash(messagebyte)
  46.  
  47.         Dim Sign As String = BitConverter.ToString(hashmessage)
  48.         Sign = Sign.Replace("-", "")
  49.  
  50.         postReq.Method = "POST"
  51.         postReq.KeepAlive = False
  52.         postReq.Headers.Add("Key", keyer)
  53.         postReq.Headers.Add("Sign", LCase(Sign))
  54.  
  55.         postReq.ContentType = "application/x-www-form-urlencoded"
  56.         postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
  57.         postReq.ContentLength = messagebyte.Length
  58.  
  59.  
  60.         Dim postreqstream As Stream = postReq.GetRequestStream()
  61.         postreqstream.Write(messagebyte, 0, messagebyte.Length)
  62.         postreqstream.Close()
  63.         Dim postresponse As HttpWebResponse
  64.  
  65.         postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
  66.  
  67.         Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
  68.  
  69.         Dim thepage As String = postreqreader.ReadToEnd
  70.         thepage = thepage.Replace(Chr(34), Chr(39))
  71.  
  72.         MsgBox(thepage)
  73.  
  74.  
  75.     End Sub
  76.     Private Function StringToSHA512(ByVal content As String) As String
  77.         Dim M5 As New SHA512Managed
  78.         Dim bytestring() As Byte = Encoding.UTF8.GetBytes(content)
  79.         bytestring = M5.ComputeHash(bytestring)
  80.         Dim signer As String = Nothing
  81.         For Each bt As Byte In bytestring
  82.             signer &= bt.ToString("x2")
  83.         Next
  84.         Return signer
  85.     End Function
  86.  
  87.     Private Function GetUnixTimestamp(ByVal currDate As DateTime) As Double
  88.         'create Timespan by subtracting the value provided from the Unix Epoch
  89.        Dim span As TimeSpan = (currDate - New DateTime(2012, 1, 1, 0, 0, 0, 0).ToLocalTime())
  90.         'return the total seconds (which is a UNIX timestamp)
  91.        Return span.TotalSeconds
  92.     End Function
  93.  
  94. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top