douyasihefu6214 2019-06-18 12:44
浏览 134

Tendermint通过节点访问leveldb

I have a sample go application running with tendermint. I would like to access the data Tendermint's blockchain stores in leveldb while both the application and the node are running.

I have tried to run a basic go script that iterates over the tx_index.db which stores the tx.hash and the corresponding result of every transaction. But when I try to run the script the program panics with an error message.

Here's the go script to iterate over the tx_index.db

package main

import (
    "fmt"
    "github.com/syndtr/goleveldb/leveldb"
)

func main() {
    db, err := leveldb.OpenFile("tx_index.db", nil)
    if err != nil {
        panic(err)
    }

    iter := db.NewIterator(nil, nil)
    for iter.Next() {
        key := iter.Key()
        h_key := fmt.Sprintf("%X", key)
        value := iter.Value()
        h_value := fmt.Sprintf("%X", value)
        fmt.Printf("Key: %v 
Value: %v 
", h_key, h_value)
    }
    iter.Release()
    err = iter.Error()
    defer db.Close()

}

Upon running the above script while the application and the tendermint node are running. I get the following error message!

panic: resource temporarily unavailable

goroutine 1 [running]:
main.main()
    $HOME/tendermint/data/read_db.go:11 +0x375
exit status 2

I am interested in accessing the tx_index.db while the application and tendermint node are running to get the transaction hash of the transactions performed.

PS: If it's feasible I'd like to know if there's a way to get tx.hash by accessing the tx_index.db by interacting with the tendermint node.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 fluent的在模拟压强时使用希望得到一些建议
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样
    • ¥15 java的GUI的运用
    • ¥15 Web.config连不上数据库
    • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
    • ¥15 怎么配置广告联盟瀑布流
    • ¥15 Rstudio 保存代码闪退