Git Product home page Git Product logo

blockapi's Introduction

The Blockchain@Unica Lab at the University of Cagliari conducts foundational and applied research on decentralized ledger technologies, with a special focus on programming languages and security. Since 2015 we are a local node of the Cyber Security National Laboratory, and in 2018 we co-founded the Italian Distributed Ledger Technology Working Group.

News

Projects

Current projects:

Past projects:

Publications

2024

2023

2022

2021

2020

2019

2018

2017

Talks

blockapi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockapi's Issues

Exception in thread "main" java.lang.ClassCastException: tcs.blockchain.bitcoin.BitcoinInput cannot be cast to scala.Tuple2

Hi guys,

first of all, THANKS for building this to facilitate Analytics on the blockchain!
I am trying to build this for a few weeks now following your instructions and am encountering an issue that I am unable to resolve:
Exception in thread "main" java.lang.ClassCastException: tcs.blockchain.bitcoin.BitcoinInput cannot be cast to scala.Tuple2

The detailed Runtime Warnings and Exceptions are below.

Could it be that based on the system specifications below my build results in missing generics for Java Collection classes like HashMap, ArrayList, Vector or Hashtable or type-safety being insufficient? I am a bit lost here and would appreciate some help.

  • When building with jdk 9.0.1 instead of 1.8.0_152, I get the following error:
    error while loading package, Missing dependency 'object java.lang.Object in compiler mirror', required by /Users/me/.sbt/boot/scala-2.10.6/lib/scala-library.jar(scala/runtime/package.class)
    scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.

This can be resolved by building with Java 8 instead (which seems to be the common fix from what I read online) - For the sake of completeness, I attached the complete log file for this initial Java 9 error if that helps since it is the reason that forced me to build with Java 8 in the first place. I am unsure whether it is related to my current problem or not?

  • I am also unsure about some of the WARNING messages below and whether they are part of the issue, but it really seems to be the casting that prevents the run from completing successfully.

Thanks so much.
Fred

System Specifications:
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G29
Uname: Darwin Kernel Version 16.7.0
Arch: i386
Machine: x86_64
Apache Maven: Version 3.5.2
java: jdk1.8.0_152
sbt: sbt version 1.0.3 built against Scala 2.12.4
mongoDB version: v3.4.10
OpenSSL version: OpenSSL 1.0.2m

IDE used:
IntelliJ IDEA 2017.2.5
Build #IU-172.4343.14
JRE: 1.8.0_152-release-915-b12 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

Runtime Warnings and Exceptions:

Dec 08, 2017 9:07:58 PM org.bitcoinj.core.Context getOrCreate
WARNING: Implicitly creating context. This is a migration step and this message will eventually go away.
Dec 08, 2017 9:07:58 PM org.bitcoinj.core.Context
INFO: Creating bitcoinj 0.15-SNAPSHOT context.
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup startAsync
WARNING: Starting up with no attached block chain. Did you forget to pass one to the constructor?
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup$8 run
INFO: Starting ...
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup$6 go
INFO: Localhost peer detected, trying to use it instead of P2P discovery
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup connectTo
INFO: Attempting connection to [127.0.0.1]:8333 (0 connected, 1 pending, 0 max)
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup connectTo
INFO: Attempting connection to [192.168.0.6]:8333 (0 connected, 2 pending, 2 max)
Dec 08, 2017 9:08:03 PM org.bitcoinj.net.NioClientManager handleKey
INFO: Connected to /127.0.0.1:8333
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.Peer connectionOpened
INFO: Announcing to /127.0.0.1:8333 as: /bitcoinj:0.15-SNAPSHOT/
Dec 08, 2017 9:08:03 PM org.bitcoinj.net.NioClientManager handleKey
INFO: Connected to My-MacBook-Pro.local/192.168.0.6:8333
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.Peer connectionOpened
INFO: Announcing to My-MacBook-Pro.local/192.168.0.6:8333 as: /bitcoinj:0.15-SNAPSHOT/
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.Peer processVersionMessage
INFO: [127.0.0.1]:8333: Got version=70015, subVer='/Satoshi:0.15.1/', services=0x13, time=2017-12-08 21:08:01, blocks=498277
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup handleNewPeer
INFO: [127.0.0.1]:8333: New peer (1 connected, 1 pending, 2 max)
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup setDownloadPeer
INFO: Setting download peer: [127.0.0.1]:8333
Dec 08, 2017 9:08:03 PM org.bitcoin.Secp256k1Context
INFO: java.lang.UnsatisfiedLinkError: no secp256k1 in java.library.path
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.Peer processVersionMessage
INFO: [192.168.0.6]:8333: Got version=70015, subVer='/Satoshi:0.15.1/', services=0x13, time=2017-12-08 21:08:01, blocks=498277
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.PeerGroup handleNewPeer
INFO: [192.168.0.6]:8333: New peer (2 connected, 0 pending, 2 max)
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.Peer processMessage
WARNING: [127.0.0.1]:8333: Received unhandled message: org.bitcoinj.core.SendHeadersMessage@bf3748a
Dec 08, 2017 9:08:03 PM org.bitcoinj.core.Peer processMessage
WARNING: [192.168.0.6]:8333: Received unhandled message: org.bitcoinj.core.SendHeadersMessage@1c9c201f
Dec 08, 2017 9:08:09 PM com.mongodb.diagnostics.logging.SLF4JLogger info
INFO: Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
Dec 08, 2017 9:08:09 PM com.mongodb.diagnostics.logging.SLF4JLogger info
INFO: Opened connection [connectionId{localValue:1, serverValue:12}] to 127.0.0.1:27017
Dec 08, 2017 9:08:09 PM com.mongodb.diagnostics.logging.SLF4JLogger info
INFO: Monitor thread successfully connected to server with description ServerDescription{address=127.0.0.1:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 4, 10]}, minWireVersion=0, maxWireVersion=5, maxDocumentSize=16777216, roundTripTimeNanos=948792}
Dec 08, 2017 9:08:09 PM org.bitcoinj.core.Peer getBlock
INFO: Request to fetch block 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048
Exception in thread "main" java.lang.ClassCastException: tcs.blockchain.bitcoin.BitcoinInput cannot be cast to scala.Tuple2
at scala.collection.immutable.List.map(List.scala:272)
at tcs.utils.Convert$.convertPair(Convert.scala:16)
at tcs.mongo.Collection.$anonfun$append$2(Collection.scala:31)
at scala.collection.immutable.List.map(List.scala:276)
at tcs.mongo.Collection.append(Collection.scala:31)
at tcs.examples.bitcoin.mongo.MyBlockchain$.$anonfun$main$2(MyBlockchain.scala:26)
at tcs.examples.bitcoin.mongo.MyBlockchain$.$anonfun$main$2$adapted(MyBlockchain.scala:20)
at scala.collection.immutable.List.foreach(List.scala:378)
at tcs.examples.bitcoin.mongo.MyBlockchain$.$anonfun$main$1(MyBlockchain.scala:20)
at tcs.examples.bitcoin.mongo.MyBlockchain$.$anonfun$main$1$adapted(MyBlockchain.scala:19)
at tcs.blockchain.bitcoin.BitcoinBlockchain.foreach(BitcoinBlockchain.scala:75)
at tcs.examples.bitcoin.mongo.MyBlockchain$.main(MyBlockchain.scala:19)
at tcs.examples.bitcoin.mongo.MyBlockchain.main(MyBlockchain.scala)

Process finished with exit code 1

Error Log when building with Java 9.txt

Missing ETH blocks from 2637146 to approx. 4696000

I'm testing import of the whole ETH chain into MongoDB. Blocks get imported except from height 2637146 onwards. Seems that the call web3j.ethGetBlockByNumber(new DefaultBlockParameterNumber(height), true).sendAsync().get().getBlock returns null for them. Successful reading resumes a little before height 4696000. Consequently, there are now almost 30 million documents (transactions) in my MongoDB but many may be missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.