Git Product home page Git Product logo

bitcoin_slices's Introduction

Hi ๐Ÿ‘‹๐Ÿผ

bitcoin_slices's People

Contributors

kixunil avatar rcasatta avatar romanz avatar tcharding avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

bitcoin_slices's Issues

Implement conversion from rust-bitcoin types

Even though one could serialize / deserialize to roundtrip I think it's worthy implementing feature-gated conversion because the validity of the invariance could be used to optimize a bit

Make `bitcoin` mandatory and improve the API?

The bitcoin crate currently provides number of useful types that could be returned in Visitor methods instead. This would of course make the dependency mandatory. (But most, if not all, Bitcoin projects will depend on it anyway.) If it's considered too large, perhaps it'll make more sense after crate smashing.

Some noteworthy types:

  • &Script
  • Sequence
  • LockTime
  • Amount
  • block::Version
  • CompactTarget

I'd be happy to help making other types more easily usable with this crate.

Visitor finish early

Suppose a use case to find a Transaction in a Block, once found the parsing of the block should be interrupted early.

Like returning a bool from visit_transaction indicating to continue to parse or not?

Implement `Txid` and `BlockHash`

While you usually don't parse those from a byte slice, it is useful as return type of the relative functions and as database key

Put example in Readme

like the one we use in bench

            struct Sum(u64);
            impl Visitor for Sum {
                fn visit_tx_out(&mut self, _vout: usize, tx_out: &TxOut) {
                    self.0 += tx_out.value();
                }
            }
            let mut sum = Sum(0);
            let block = Block::visit(BENCH_BLOCK, &mut sum).unwrap();
            assert_eq!(sum.0, 2883682728990);

Rotating buffer

This library cannot consume Read by design because it needs a borrowed slice to create objects.
A rotating buffer filling data from a Read input and producing borrowed objects could overcome this limitation and read from streams. The buffer should rotate back every once in a while to be limited in size. It must be long enough to support the maximum size of the object to be read, luckily bitcoin objects are limited in size by consensus so there is an upper limit, at worse 4MB.

Use Readme.md in library home doc

They should contain almost identical information, so it's better to update the readme and obtain the same updated in the doc home page using: #![doc = include_str!("../README.md")]

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.