GithubHelp home page GithubHelp logo

erigon-kv's Introduction

erigon-kv

get direct access to erigon database over grpc api.

low-level api

this interface wraps the kv api and allows you to read and iterate over any table.

from erigon.kv import ErigonKV

kv = ErigonKV()
await kv.connect()

async with kv.open('Code') as cursor:
    await cursor.seek(b'\xff\xff')

    async for row in cursor:
        print(row)

ErigonKV.connect connects to the private api (default: 127.0.0.1:9090) and opens a read transaction. a transaction offers a consistent view over the database, but be wary of long-running transactions, as they can impact the database performance.

ErigonKV.open returns an ErigonCursor object which supports async iteration and seeking. it will also automatically close the cursor when you are finished.

you can also open a table in a dup sort mode, in which a key can have more than one value associated. this mode is utilized in the PlainState table for contract storage.

ErigonCursor supports seek, seek_exact, first, last, prev methods, as well as iteration. there is also a read method which you can use with rarer ops.

the cursor starts at the first row by default, so you can just iterate over it.

not all tables use an intuitive layout, read the annotated source for a description of the key and value structure of each bucket.

high-level api

this interface provides common shortcuts to read block headers, accounts, and to enumerate account storage.

erigon-kv's People

Contributors

banteg avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar

erigon-kv's Issues

Don't open long-lasting transactions on the database while node is actively syncing

First - great project. Super informative and useful.

Second...

I noticed in the discord a discussion about opening a long-lasting read transaction and the growth of the database size on disc if the Erigon node is actively syncing.

I think there's a way to start Erigon so it just runs but does not accept new blocks or sync. (Maybe the --nodiscover option, but I'm not sure.) Once the merge happens, you might be able to get this behaviour by not running the CL.

You might want to add this information in your README instead of telling people to open a read transaction and keep it open.

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.