This is an implementation defining standard for client-side-validation

Overview

Client-side-validation Foundation Libraries

Build Tests Lints codecov

crates.io Docs unsafe forbidden Apache-2 licensed

This is an implementation defining standard of client-side-validation representing a set of its Foundation libraries. The standards covered by the libraries include LNPBP-4, LNPBP-7, LNPBP-8, LNPBP-9, LNPBP-42, and LNPBP-81 (see Components section below for more details).

Client-side-validation is a paradigm for distributed computing, based on top of proof-of-publication/commitment medium layer, which may be a bitcoin blockchain or other type of distributed consensus system.

The development of the library is supported by LNP/BP Standards Association. The original idea of client-side-validation was proposed by Peter Todd with its possible applications designed by Giacomo Zucco. It was shaped into a protocol- level design by Dr Maxim Orlovsky with a big input from the community and implemented by him as this set of libraries.

Documentation

Detailed developer & API documentation for all libraries can be accessed at https://docs.rs/client_side_validation/

To learn about the technologies enabled by the library please check slides from our tech presentations and LNP/BP tech talks videos

Components

This library consists of the following main three components, which define independent parts constituting together client-side-validation API and its core functionality. These are:

  • Strict encoding (LNPBP-7 and LNPBP-42 standards): binary standard of encoding client-side-validated data and network addresses.
  • Commit-verify client-side-validation-specific APIs:
    • consensus commitments (part of LNPBP-8 standard)
    • multi-commitments (LNPBP-4 standard)
    • merklization for client-side-validation (LNPBP-81 standard)
  • Single-use-seals API (LNPBP-8 standard)
  • Client-side-validation API from the library root, linking those components together according to LNPBP-9 standard.

Usage

The repository contains rust libraries for client-side validation.

Use library in other projects

To use libraries, you just need latest version of libraries, published to crates.io into [dependencies] section of your project Cargo.toml. Here is the full list of available libraries from this repository:

client_side_validation = "1" # "Umbrella" library including all of the tree libraries below
strict_encoding = "1" # Strict encoding API and derivation macros
commit_verify = "1" # Consensus and multi-message commitments
single_use_seals = "1" # Generic (non-bitcoin-specific) API

"Umbrella" client_side_validation library is configured with default set of features enabling all of its functionality (and including all of other libraries from this repository, listed above). If you need to restrict this set, either use specific libraries - or configure main library with a set of features in the following way:

[dependencies.client_side_validation]
version = "1"
default-features = false
features = [] # Your set of features goes here

The library has four feature flags, all of which are not used by default:

  • rand, providing support for generating random 32-byte sequences of Slice32 type, used in many LNP/BP applications (for instance as hash-lock preimages or during LNPBP-4 multi-commitments);
  • serde, providing support for data structure serialization with serde across all library;
  • bitcoin, providing implementation of strint encoding for bitcoin data types;
  • crypto, adding strict encoding support for Ed25519/X25519, Grin Secp256k1zkp Pedersen commitments and bulletproofs data types.

For specific features which may be enabled for the libraries, please check library-specific guidelines, located in README.md files in each of library subdirectories.

Libraries based on client-side-validation

Most of the developers will be probably interested in a more high-level libraries based on client-side-validation, applying it to a specific commitment mediums (bitcoin transaction graph from blockchain or state channels, or more exotic systems like confidential bitcoin transactions used by elements & liquid, or mimblewimble-based systems). Here is (potentially incomplete) list of such libraries:

  • Bitcoin: BP Core Lib, which contains bitcoin UTXO single-use-seal implementations for pay-to-contract and sign-to-contract types of seals, as well as a library for deterministic bitcoin commitments. This library is maintained by LNP/BP Association.
  • Mimblewimble: MW Core Lib from Pandora Core – a very early prototypes and proofs of concept applying client-side-validation to mimblewimble-types of blockchains.
  • Pandora timechain, an experimental blockchain of Pandora Network, playing with client-side-validation using modified bitcoin consensus rules, extended with eltoo- and covenants-related functionality and with removed native blockchain-level coin.

Contributing

Contribution guidelines can be found in CONTRIBUTING

Licensing

The libraries are distributed on the terms of Apache 2.0 opensource license. See LICENCE file for the license details.

Comments
  • StrictEncoding issue with enum tuple struct field initialization

    StrictEncoding issue with enum tuple struct field initialization

    When fixing some clippy lints on the descriptor wallet, I ran into an issue here:

    Screenshot from 2022-02-09 12-30-55

    Docs on the linter rule are here: https://rust-lang.github.io/rust-clippy/master/index.html#init_numbered_fields

    Normally I wouldn't file a feature request just to satisfy a linter, but this might be indicative of some sort of oversight. Feel free to close if we're comfortable with using #![allow(clippy::init_numbered_fields)] in all projects using strict encoding.

    bug help wanted 
    opened by cryptoquick 7
  • Fix Taptree Strict Encode/Decode

    Fix Taptree Strict Encode/Decode

    Description

    I tried to use strict_decode in the PSBT file with output taptree and the method returns Error::DataIntegrityError.

    This error occurs because the Taptree decode expected a different format. To simplify the process, I changed to use serialize and deserialize taptree provided by rust-bitcoin lib.

    bug 
    opened by crisdut 6
  • Fix for merging LNPBP4 merkle blocks

    Fix for merging LNPBP4 merkle blocks

    The problem was caused by a very simple oversight: 387af22ccec5fa2cd1142d8d31a84c8a5259ee30

    It took me drawing a lot of charts to finally see the obvious mistake.

    As far as I can see, this fix is not consensus-breaking, so after getting ACKs on this PR to master, I will backport it into v0.8 and v0.9 as well and will release v0.8.3 version.

    Additionally to the fix I made a test in 75fdf50c86a97c456e109de16845a73d98782305 which matches the merkle blocks which fails to merge from the original bug report https://github.com/RGB-WG/rgb-node/issues/208#issue-1389588781 This test fails before the fix is applied - and after the fix it passes successfully.

    Next, I improved code style of merkle block merge in 1e11bd0e183134f2c80728e4e21feb545ba91b85 to ensure that the code is correct and problems like this can't be easily introduced in a future.

    bug 
    opened by dr-orlovsky 3
  • Temp change of unreachable for known bug

    Temp change of unreachable for known bug

    This PR refers to what has been discussed here https://github.com/RGB-WG/rgb-node/issues/208#issuecomment-1348468408

    I know that UnrelatedProof is not the correct error in this case, but trying to change it to something else causes bp-dbc to stop compiling and I don't think we should change everything for a very temporary change. @dr-orlovsky please let me know if I'm missing a simple way to introduce a proper error

    opened by zoedberg 3
  • fix merkle proof conversion

    fix merkle proof conversion

    Description The rgb-node produces an incorrect merkle proof anchor when compiled in release mode.

    This problem occurs because the conversion of the merkle block into a merkle proof was inside the debug_assert method.

    Closes:

    • https://github.com/LNP-BP/nodes/issues/16
    • https://github.com/RGB-WG/rgb-core/issues/113

    Related:

    • https://github.com/RGB-WG/rgb-node/issues/197
    opened by crisdut 1
Releases(v0.9.0-rc.1)
  • v0.9.0-rc.1(Dec 25, 2022)

    What's Changed

    • feat: feature strict encoding on monero types by @h4sh3d in https://github.com/LNP-BP/client_side_validation/pull/90
    • Strict encoding v0.8.1 fixes by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/91
    • Upgrade for bitcoin 0.29 & miniscript 8.0 by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/94
    • Fix Taptree Strict Encode/Decode by @crisdut in https://github.com/LNP-BP/client_side_validation/pull/95
    • Fix merkle proof conversion by @crisdut in https://github.com/LNP-BP/client_side_validation/pull/104
    • Fix for merging LNPBP4 merkle blocks by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/115

    New Contributors

    • @h4sh3d made their first contribution in https://github.com/LNP-BP/client_side_validation/pull/90

    Full Changelog: https://github.com/LNP-BP/client_side_validation/compare/v0.8.0...v0.9.0-rc.1

    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Jun 30, 2022)

    What's Changed

    • Strict encoding vec types enhancements by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/87
    • Tagged hash API overhaul by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/85
    • Enable multiple seal batches in single-use-seals API by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/88
    • MSRV bump to 1.59 and rust edition 2021
    • Solve clippy init_numbered_fields warning for strict encoding (issue #54)

    Full Changelog: https://github.com/LNP-BP/client_side_validation/compare/v0.7.0...v0.8.0

    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Jun 13, 2022)

    What's new

    • Commit-convolve scheme
    • Refactored commit-embed schemes
    • Refactored LNPBP4 using merklization
    • Refactored single-use-seals API

    Detailed changelog

    • Async support in single-use-seals by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/36
    • Fixing missed bulletproof use for commit_encode by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/37
    • Fixing merklization bug for certain length of data by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/38
    • Strict encoding advancements: TLVs, derive helpers, test helpers by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/39
    • Strict encoding: failing on even unknown TLVs, better docs by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/40
    • Support for non-optional TLV field types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/41
    • TLV testing by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/42
    • Fixing encoding derive helpers bug with TLV non-copy encoding by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/43
    • Fixing strict encoding for TLV structs without aggregator by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/46
    • TLV main refactoring by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/49
    • SigHashType strict encoding by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/50
    • Strict encoding for rust range types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/51
    • Strict encoding for amplify_num u24 type by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/52
    • Taproot support by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/48
    • Version bump & updates by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/55
    • Refactor commit-embed API by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/56
    • Implement strict en-/decoding with const generics by @KaiWitt in https://github.com/LNP-BP/client_side_validation/pull/45
    • Fix issue with miniscript generic recursion in strict encoding by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/57
    • Improve commit_embed API by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/58
    • Fix const generic array strict encoding size limits by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/59
    • Strict encoding for miniscript descriptor inner types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/60
    • RC fixes for strict_encoding 1.8.0 by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/61
    • Update to bitcoin & miniscript RC2 by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/62
    • Refactor commitment schemes by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/63
    • Make EmbedCommitProof::restore_original_container failable by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/64
    • VerifyEq trait for commitment verification of non-Eq types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/65
    • Separate CommitError and VerifyError types in commit-embed-verify scheme by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/66
    • Completing strict encodings for bitcoin-related transaction types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/68
    • Update to bitcoin release 0.28.0 by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/69
    • Strict encoding 1.8 release by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/70
    • Strict encoding test release by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/71
    • Revert strict encoding for rust-bitcoin PSBT type by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/72
    • Refactor single-use-seal API by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/73
    • Complete ConvolveCommit API by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/74
    • API for v0.7 by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/75
    • LBPNP-4 refactoring into Merkle tree by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/76
    • LNPBP-4 API enchancements by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/77
    • LargeVec for strict encoding arrays larger u16::MAX by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/78
    • Make lnpbp4::MerkleBlock::with public by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/79
    • Strict encoding of big signed int and float types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/80
    • Support ieee::Oct strict encoding by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/81
    • Strict encoding MediumVec type supporting up to u24 elements by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/82
    • Support iter_mut for strict_encoding LargeVec and MediumVec types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/83

    New Contributors

    • @KaiWitt made their first contribution in https://github.com/LNP-BP/client_side_validation/pull/45

    Full Changelog: https://github.com/LNP-BP/client_side_validation/compare/v0.5.3...v0.7.0

    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(May 15, 2022)

    Release based on taproot-enabled rust-bitcoin and rust-miniscript libraries.

    What's Changed

    • Async support in single-use-seals by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/36
    • Fixing missed bulletproof use for commit_encode by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/37
    • Fixing merklization bug for certain length of data by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/38
    • Strict encoding advancements: TLVs, derive helpers, test helpers by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/39
    • Strict encoding: failing on even unknown TLVs, better docs by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/40
    • Support for non-optional TLV field types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/41
    • TLV testing by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/42
    • Fixing encoding derive helpers bug with TLV non-copy encoding by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/43
    • Fixing strict encoding for TLV structs without aggregator by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/46
    • TLV main refactoring by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/49
    • SigHashType strict encoding by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/50
    • Strict encoding for rust range types by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/51
    • Strict encoding for amplify_num u24 type by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/52
    • Taproot support by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/48
    • Version bump & updates by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/55
    • Refactor commit-embed API by @dr-orlovsky in https://github.com/LNP-BP/client_side_validation/pull/56
    • Implement strict en-/decoding with const generics by @KaiWitt in https://github.com/LNP-BP/client_side_validation/pull/45

    New Contributors

    • @KaiWitt made their first contribution in https://github.com/LNP-BP/client_side_validation/pull/45

    Full Changelog: https://github.com/LNP-BP/client_side_validation/compare/v0.5.3...v0.6.0

    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(May 14, 2021)

    This version for the first time represents reference implementation for R1 version of client-side-validation standards, organized in separate sublibraries/rust crates:

    The library represents generalized client-side-validation APIs, abstracted from its bitcoin-specific applications and RGB, with detailed documentation and test coverage.

    This release finalizes all pending work on client-side-validation and is a final release before the library will move to v1.0 version, which will be released upon the final audit of the current release. This will define a milestone when client-side-validation can be used in production environments.

    The library is located at https://crates.io/crates/client_side_validation. Library documentation 📖 is at https://docs.rs/client_side_validation/0.5.0/

    Supported & tested platforms: Linux (Ubuntu 20.04 and Ubuntu 21.04), Mac OS (Mac OS Big Sur and Mac OS Catalina), Windows 2020 Server.

    Source code(tar.gz)
    Source code(zip)
Owner
LNP/BP Association
Non-profit supervising layer 2 & 3 protocols on Bitcoin & Lightning Network
LNP/BP Association
A small tool to clone git repositories to a standard location, organised by domain name and path.

A small tool to clone git repositories to a standard location, organised by domain name and path. Runs on BSD, Linux, macOS, Windows, and more.

Wesley Moore 68 Dec 19, 2022
DIP20: A fungible token standard for the DFINITY Internet Computer.

DIP20 - Introduction Token standards are essential for the Internet Computer ecosystem, especially for the decentralized finance ecosystem (DeFi) syst

Psychedelic 48 Nov 5, 2022
Simple git/hg tui client focused on keyboard shortcuts

verco A simple Git/Hg tui client focused on keyboard shortcuts Screenshots Platforms This project uses Cargo and pure Rust stable and works on latest

Matheus Lessa Rodrigues 214 Dec 26, 2022
client-server notification center for dbus desktop notifications

tsuchita A client-server notification center for dbus desktop notifications. Specifically org.freedesktop.Notifications dbus messages. Motivation I ju

Jeff Zhao 7 Oct 9, 2022
Rust client for AWS Infinidash service.

AWS Infinidash - Fully featured Rust client Fully featured AWS Infinidash client for Rust applications. You can use the AWS Infinidash client to make

Rafael Carício 15 Feb 12, 2022
Rusty NuGet client

turron It's a NuGet client built in Rust. It's not really meant to replace existing nuget clients. It's more of a playground for experimenting with re

Kat Marchán 18 Feb 2, 2022
FerrisChat's Client

egui template This is a template repo for egui. The goal is for this to be the simplest way to get started writing a GUI app in Rust. You can compile

FerrisChat 5 Nov 23, 2022
Supernova client in Rust

What is this? A client library for the Supernova REST API. Usage use iron_planet::{Supernova, RequestConfig}; fn main() { // Instantiate an unpri

Nova Universidade Nova de Lisboa 1 Dec 29, 2021
RCON client for Rust

rcon-rs Simple implementation of a crate that allows you to work with the RCON protocol To work with TCP, the TcpStream structure built into the std::

Donkey Engine 4 Aug 10, 2022
A Diablo II library for core and simple client functionality, written in Rust for performance, safety and re-usability

A Diablo II library for core and simple client functionality, written in Rust for performance, safety and re-usability

null 4 Nov 30, 2022
A random.org client library for Rust

random.org A https://random.org client library. The randomness comes from atmospheric noise, which for many purposes is better than the pseudo-random

Victor Polevoy 7 Mar 10, 2022
A gitmoji interactive client for using gitmojis on commit messages.

gitmoji in Rust This is just an opinionated version of gitmoji-cli written in Rust . A gitmoji interactive client for using gitmojis on commit message

igor 2 Aug 16, 2022
Flexcord! A custom Discord client to allow you to do what you want!

Disclaimer Flexcord is NO WHERE near done. Flexcord What is it? Flexcord is a Discord client that flexes for your needs, it allows you to do exactly w

null 2 Dec 5, 2022
OpenAI chat client desktop app (Windows, MacOS, Linux)

ChatWizard OpenAI chat client Desktop Application (Windows, MacOS, Linux) Declaration This project is currently undergoing active development and has

LisiurDay 8 Apr 5, 2023
TaurApp is a WhatsApp desktop client powered by Tauri and Rust.

TaurApp TaurApp is a WhatsApp desktop client powered by Tauri and Rust. TaurApp is an experimental client and is initially created to test out Tauri i

Eray Erdin (&mut self) 22 Mar 19, 2023
An open-source Windows client for Twitch.tv

TwitchBox is a lightweight Windows client created to enhance the Twitch.tv experience. The app uses the Tauri framework, which includes a combination

Sandun Wiratunga 3 Apr 28, 2023
A swc plugin that automatically converts React component libraries into "React Client Component"

A swc plugin that automatically converts React component libraries into "React Client Component". For example, you can automatically convert components from @mui into "React Client Component" without having to wrap a component that uses "use client".

xiaotian 3 Jul 12, 2023
Unofficial cross-platform Microsoft To Do client

WIP Dev Setup dev env Compile for dev Compile for production Todos (how ironicall to keep them in README xd) Implement task search Implement ability t

Tomáš Diblík 3 Jul 20, 2023
Command palette-style Git client for blazing-fast commits.

?? About Commit Commit is the world's simplest Git client. Open it with a keyboard shortcut, write your commit, and you're done! Commit will automatic

Miguel Piedrafita 190 Aug 18, 2023