Bitcoin Forum
May 05, 2024, 12:37:35 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Local / Italiano (Italian) / Recuperare i miei dati su blockchain.info usando Excel VBA on: May 08, 2015, 11:58:39 PM
Salve a tutti. Ho un web wallet su blockchain.info. Questo a sua volta ha svariati indirizzi, alcuni con transazioni, altri non ancora.
Come posso recuperare le transazioni (inviate e ricevute), e per ogni transazione alcuni dati (data ed ora, importo, hash, indirizzo di ricezione o di invio...) usando le loro API e VBA di Excel?
Leggendo in giro ormai da un bel pò ho capito che necessito effettuare una richiesta di tipo JSON e leggere la risposta del sito.
Risposta che son riuscito a ricevere per un indirizzo X e l'ho messo in una stringa. Ecco il codice che dopo 15gg son riuscito a mettere in piedi:

Code:
Option Explicit

Sub ReadJsonAndParse()
    Dim strURL As String
    Dim xmlHttp As Object
    Dim strReturn As String
    ' Nella stringa è contenuto l'indirizzo web da cui ricevere i dati.
    strURL = "https://blockchain.info/it/address/15YMyRVQ1wyLsfwGP9Le97D3BRVG3nMjVW?format=json"

    'Apro l'url e ricevo i dati JSON.
     Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
     xmlHttp.Open "GET", strURL
     xmlHttp.setRequestHeader "Content-Type", "text/xml"
     xmlHttp.send

     'La risposta è inserita nella stringa
     strReturn = xmlHttp.responseText
End Sub

Nella "strReturn" c'è l'intera stringa recuperata; ho notato, grazie al sito http://jsonviewer.stack.hu/ (visualizzatore online dove inserendo un'intera stringa Json mostra un albero contenente tutti i dati) che già nella ROOT vi sono alcuni dati che necessito recuperare: (indirizzo in esame, totale ricevuto, totale inviato, bilancio finale e numero delle operazioni affettuate per quell'indirizzo [tutte, sia in uscita che in entrata], nel mio caso dell'indirizzo in questione N° 3 transazioni in totale per questo indirizzo ["n_tx": 3] numerate 0,1 e 2). Ognuna di queste operazioni ha un "hash", e anche quello voglio recuperarlo, ma è in tutti questi ultimi passaggi che mi perdo, ovvero non so come muovermi attraverso i nodi e i sottonodi via VBA-code per Excel.
Grazie per l'attenzione mostratami e attendo fiducioso che mi illuminiate.
Ciao
2  Economy / Service Discussion / Retrieve my bitcoin data on blockchain.info using Excel VBA on: May 08, 2015, 10:37:00 PM
I got a web wallet on blockchain.info. It has several addres.
How can i retrieve my transactions (sent and received), and for every movement some data (date and time, amount, hash, MY NOTE, address RECEIVED...) using their api and my excel VBA sheet?
I imagine reading on internet that i must use some JSON request and read the site's answer, but i don't know how to start. The API for all are described here: https://blockchain.info/it/api/blockchain_api
Can anyone here help me please?
After 2day i'm able to put json string in a Excel-VBA variable. Here's the code:
Code:
Option Explicit

Sub ReadJsonAndParse()
    Dim strURL As String
    Dim xmlHttp As Object
    Dim strReturn As String

    strURL = "https://blockchain.info/it/address/15YMyRVQ1wyLsfwGP9Le97D3BRVG3nMjVW?format=json"

    'Open URL and get JSON data
     Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
     xmlHttp.Open "GET", strURL
     xmlHttp.setRequestHeader "Content-Type", "text/xml"
     xmlHttp.send

     'Save the response to a string
     strReturn = xmlHttp.responseText
End Sub
In the "strReturn" there is the whole retrieved string; i noticed i got in the part called ROOT some data i need: (address, total_received, total_sent and final_balance) and the number of transaction for the address, 3 transaction in total for this address ("n_tx": 3,) numbered 0,1 and 2. Each of this got a "hash" that i want retrieve, but it seems very hard to do. The amount of each transaction is in the array but i don't know how extract.
In the retrieved string i can't find my "NOTE" as i wrote in the page "My Wallet --> Transactions (recent)" near the yellow icon with a green plus (+) into. Where are them?
Tnx in advance at all.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!