Skip to content

BlockSci v0.6 not recognizing ZCash t-addr addresses #246

@jredondo

Description

@jredondo

Greetings.
I'm using BlockSci AMI with BlockSci v0.6 (commit 304e1ff7eb670e5fff161688e26e698c56f21e28).
It seems I have parsed successfully the ZCash blockchain since parser finished with the expected message and the data directory seems filled as expected.
Nonetheless, it seems BlockSci is not able to interpret ZCash t-addr addresses.
I have this small code for testing:

#include <blocksci/blocksci.hpp>
#include <blocksci/chain/algorithms.hpp>
#include <blocksci/chain/transaction.hpp>
#include <blocksci/chain/block.hpp>
#include <blocksci/chain/blockchain.hpp>
#include <blocksci/script.hpp>
#include <blocksci/address/address.hpp>
#include <blocksci/chain/transaction_range.hpp>

#include <range/v3/all.hpp>

#include <numeric>
#include <chrono>
#include <unordered_map>
#include <map>
#include <fstream>
#include <iostream>
#include <set>
#include <functional>
#include <string>

using namespace blocksci;

int main(int argc, const char * argv[]) {
    Blockchain chain(argv[1]);
    auto begin = std::chrono::steady_clock::now();

    auto address = getAddressFromString(argv[2], chain.getAccess());
    if(address == ranges::nullopt) {
        std::cout << "Null address: " << argv[2]  << std::endl ;
        return -1;
    }

    std::cout << "Address: " << (*address).toString() << std::endl ;

    //std::cout << "Address: " << address->toString() << std::endl ;
    std::cout << "Address balance: " << (*address).calculateBalance(std::atoi(argv[3])) << std::endl ;

    auto endTime = std::chrono::steady_clock::now();
    double timeMSecs = std::chrono::duration_cast<std::chrono::microseconds>(endTime - begin).count();
    std::cout << "time: " << timeMSecs << std::endl ;
}

After running it like this (ZCash):

user@server:...$ ./test_balance ../../blocksci-http-server/conf/conf_zch.txt t1aZvxRLCGVeMPFXvqfnBgHVEbi4c6g8MVa 1000000
Null address: t1aZvxRLCGVeMPFXvqfnBgHVEbi4c6g8MVa
user@server:...$ 

And after running like (Litecoin):

user@server:...$ ./test_balance ../../blocksci-http-server/conf/conf_ltc.txt ltc1qxhpwa9u8dwtpegj8gkay4ewju7py09uawhp28p 10000000
Address: WitnessPubkeyAddress(ltc1qxhpwa9u8dwtpegj8gkay4ewju7py09uawhp28p)
Address balance: 1017909332001
time: 17651
user@server:...$ 

Here are the config files used up there:
ZCash:

{
    "chainConfig": {
        "coinName": "zcash",
        "dataDirectory": "/home/ubuntu/zcash",
        "pubkeyPrefix": [
            28,
            184
        ],
        "scriptPrefix": [
            28,
            189
        ],
        "segwitActivationHeight": 2147483647,
        "segwitPrefix": "NONE"
    },
    "parser": {
        "maxBlockNum": -6,
        "rpc": {
            "address": "127.0.0.1",
            "password": "test",
            "port": 8232,
            "username": "test"
        }
    },
    "version": 5
}

Litecoin:

{
    "chainConfig": {
        "coinName": "litecoin",
        "dataDirectory": "/home/ubuntu/litecoin",
        "pubkeyPrefix": [
            48
        ],
        "scriptPrefix": [
            50
        ],
        "segwitActivationHeight": 1201536,
        "segwitPrefix": "ltc"
    },
    "parser": {
        "disk": {
            "blockMagic": 3686187259,
            "coinDirectory": "/home/ubuntu/.litecoin",
            "hashFuncName": "doubleSha256"
        },
        "maxBlockNum": -6
    },
    "version": 5
}

Please let me know if there is anything else I could provide.
Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions