dakk / bitcoinml Goto Github PK
View Code? Open in Web Editor NEWBitcoin data-structures library for OCaml
Home Page: https://dakk.github.io/bitcoinml/
License: MIT License
Bitcoin data-structures library for OCaml
Home Page: https://dakk.github.io/bitcoinml/
License: MIT License
Instead of integrating huge external deps, we create a signature engine abstraction; so:
Introduce an optional argument to parse and serialize function called "hex" for handling hex data.
The block after: https://www.blocktrail.com/tBTC/block/000000000207e63e68f2a7a4c067135883d726fd65e3620142fb9bdf50cce1f6 fails the check_target
Travis-ci could reduce the number of error I made publishing new releases on opam-repository.
Provide a module to compute a tx list merke root:
module Merkle : sig
type t
val of_txs : Tx.t list -> t
end
Integrate bitcoin network protocol message parse and serialize.
Many times it's not necessary to parse the full block but only the headers; so we could define a new type:
type Block.l = {
header: Header.t;
txs: Tx.t list Lazy.t;
}
In case of 2x fork, we need to add a new network for 2x, and update checkpoint list for both chains (just for redundancy, letchain doesn't need that)
Provide the ability to create a raw transaction, sign it with a keypair, and create the complete tx.
The upcoming activation of segwit, push the need of segwit transaction format support
https://bitcoincore.org/en/segwit_wallet_dev/#transaction-serialization
https://bitcoin.stackexchange.com/questions/49097/what-does-a-segregated-witness-transaction-look-like
The Tx could be a structure like now, but with optional witness fields:
type Witness.t = {
marker : uint32;
flag : uint32;
witness : field list;
size : int;
}
type t = {
hash : Hash.t;
version : int32;
txin : In.t list;
txout : Out.t list;
locktime : uint32;
witness : Witness.t option;
size : int;
} [@@deriving sexp]
The witnessScript reside in a different parte of the tx, but every witnessScript is associated to one txin; could be a smart trick to inflate the wintnessScript inside the txin.
Use this: http://n.bitcoin.ninja/checktx for examples and tests
Tasks:
for:
020000000001018123858b74cc156be287dbac5442508483bfe6d9a4165712e5bd0b65a9120a210100000000ffffffff0250c30000000000002200207110c7d8cf7bfa8c93d190d699571c128eac6e922ce0ca3bdf0bc3495109dffc14d606000000000016001499b9280ca4f5eeea13e51770e7a30eb512ed473702483045022100952394943abe1e75d20d4b20622416d0618585bb3266a8122894024a7cfcc6c8022051465780d56717548951fad188fe038f8820c1e054d3a9b90533084cb06625cf012102a3a3756f1e06a4b4764cc3fcf2e804257727e4431b548741f8be057f1628e39900000000
d80c367ee53355ff52bb818545e73f806965a056d2085771e5c3c994af9f640a
but library returns:
df986955f737c0d90fbedc85580bc21ec3951b12dc68b8c611e48c9d4386bb74
Create a module for address representation
Modify the script.to_string to propose an hex encoding for script data
Bitcoinml doesn't provide parameters for different blockchains but it could be useful for many use cases; could be useful to move them from https://github.com/dakk/letchain/blob/master/src/blockchain/params.ml to bitcoinml.
Even in the test suite we use part of them (for address decoding)
Thread 1 killed on uncaught exception Match_failure("src/varint.ml", 6, 2)
Raised at file "src/varint.ml", line 6, characters 2-125
Called from file "src/varint.ml", line 18, characters 17-36
Called from file "src/tx.ml", line 133, characters 22-39
Called from file "src/tx.ml", line 222, characters 22-41
Called from file "src/tx.ml", line 261, characters 41-74
Called from file "src/tx.ml", line 345, characters 61-68
Called from file "src/block.ml", line 91, characters 12-72
Called from file "camlinternalLazy.ml", line 27, characters 17-27
Re-raised at file "camlinternalLazy.ml", line 34, characters 4-11
Called from file "src/blockchain/chain.ml", line 367, characters 9-22
The interested block is the block next to:
54506 : 0000000001df68704402058e0947804685f6a647ff1eeee6ff038a1f722c4676
There are about 1MB of INVALID_OPCODEs.
This bug stops letchain from syncing testnet.
For better handling script templates, we create template modules for each standard script template:
The addresses are always converted with mainnet prefixes; we need to extends Tx.Out.spendable_by from bitcoinml with a prefix optional argument.
Integrate coin params for networks, and implement moneyrange checks like https://github.com/bitcoin/bitcoin/blob/master/src/amount.h
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.