BSDStudios / ethr

An Ethereum package for R
MIT License
47 stars 11 forks source link

bulkBlockDownload.R - ethr_blocks #2

Closed markrtgh closed 8 years ago

markrtgh commented 8 years ago

Requires an existing ethr_blocks directory in the data_dir otherwise throws this error.

> BulkDownload <- bulkBlockDownload(start_block=blocks[1], end_block=blocks[2], data_dir="~/Documents/r/ethr/1bulk/", chunk_size=50000, parallel=TRUE, cores=3)
Progress disabled when using parallel plyr
 Hide Traceback

 Rerun with Debug
 Error in gzfile(file, "wb") : cannot open the connection 
3 gzfile(file, "wb") 
2 save(block_chunk, file = paste0(data_dir, "ethr_blocks/", st, 
    "-", en, ".rda")) at bulkBlockDownload.R#33
1 bulkBlockDownload(start_block = blocks[1], end_block = blocks[2], 
    data_dir = "~/Documents/r/ethr/1bulk/", chunk_size = 50000, 
    parallel = TRUE, cores = 3) 
In addition: Warning messages:
1: <anonymous>: ... may be used in an incorrect context: ‘.fun(piece, ...)’

2: <anonymous>: ... may be used in an incorrect context: ‘.fun(piece, ...)’

3: In gzfile(file, "wb") :
  cannot open compressed file '/Users/markthomas/Documents/r/ethr/1bulk/ethr_blocks/1246788-1246807.rda', probable reason 'No such file or directory'
markrtgh commented 8 years ago

Also, can you tell me if bulkBlockDownload and getBlockTransactions extracts data from the local geth blockchain database in chaindata or does it download the data again from the network? Thanks

tinmice commented 8 years ago

All functions access the local chaindata folder rather than downloading again from the live blockchain - this is done through a running Geth instance which will allow access to all blocks that you have sync'd to the local machine.

Thanks for the heads up on the error message, I put something in the documentation about the folder being required but I'll hardcode some checks and auto folder creation in to prevent the error in the future.

ericxxp commented 8 years ago

Hi All,

Is there any way to set the rpc address as default instead of entering it in every command. Another question: I tried to execute the following command but its getting an error message while other command such eth coinbase works probably( Note hostLinux = "192.168.1.112:3000") blocks <- getTransactionInTimePeriod("2016-03-31 07:00:00 GMT", "2016-03-31 07:05:00 GMT",hostLinux) Error in curl::curl_fetch_memory(url, handle = handle) : Couldn't connect to server

Thanks for your help

tinmice commented 8 years ago

@ericxxp There is no option to set a standard address other than declaring a variable with your address as you have at the moment. I'll stick it on the requirements list though and try and implement something in the future.

Not sure about the error message, so something like the below works? But the getTransactionInTimePeriod above doesn't?

hostLinux <- "192.168.1.112:3000"
eth_coinbase(rpc_address = hostLinux)

I have't yet tested running the node on a remote machine, would be good to know if you have it working. If the getTransactionInTimePeriod does not work then try the getBlockTransactions and use block numbers as your bounds, it is a bit simpler internally so might solve the issue for now.