Skip to main content
ClaimChain

claimchain-core

Build Status Documentation Status Zenodo Citation

Installing

You can install claimchain via pip:

pip install claimchain

To run tests, checkout the git repository and run tox:

git clone https://github.com/claimchain/claimchain-core
cd claimchain-core
tox

Usage warning

This code is made for research purposes. It is not to be used in real-world systems. Not all security features are implemented, and some of the cryptographic instantiations need to be changed to more secure alternatives.

Usage

High-level interface for ClaimChain consists of two classes, State for building claimchains, and View for parsing and interpreting claimchains.

Building chains

The core abstraction for the a ClaimChain user is a state. The state contains information about the user, and claims they make about other users or objects. Currently, this package only supports private claims, which means the owner of a chain needs to explicitly make every claim readable by intended readers. Once the state is constructed it can be committed to the chain.

Here is how user Alice would prepare her state:

from claimchain import State

state = State()

# Alice adds information about herself
state.identity_info = "Hi, I'm Alice"

# Alice adds private claims
state['bob'] = 'Bob is a good lad'

Making claims accessible requires knowing the DH public key of each authorized reader. The way to obtain the DH keys of other users is described later. Assuming Alice has Carol’s DH public key, carol_dh_pk, she can allow Carol to access her claim about Bob:

state.grant_access(carol_dh_pk, ['bob'])

Note that the second argument must be an iterable of claim labels, not a single label.

To commit the state, first, a chain needs to be built, and second, the cryptographic keys have to be generated:

from hippiehug import Chain
from claimchain import LocalParams, State

state = State()

# Generate cryptographic keys
params = LocalParams.generate()

store = {}
chain = Chain(store)

with params.as_default():
    head = state.commit(chain)

The chain can then be published or transmitted to other users by publishing the store and communicating the chain’s head. Other users will be able to interpret the chain using the View interface, described below.

Interpreting chains

Having access to the store (dictionary) containing other user’s chain, and a head of this user’s chain, one can use the View interface.

Here is how Carol can interpret Alice’s claimchain, assuming Alice’s store is alice_store, the head of her chain is alice_head, and params is Carol’s LocalParams object:

from hippiehug import Chain
from claimchain import View

alice_chain = Chain(alice_store, root_hash=alice_head)

with params.as_default():
    alice_view = View(alice_chain)

    # Try to get claim with label 'bob'
    claim = alice_view['bob']

    assert claim == b'Bob is a good lad'

Finally, this is how Carol can retrieve Alice’s DH public key:

alice_dh_pk = alice_view.params.dh.pk

This DH public key can be later used to grant Alice rights to read claims on Carol’s chain.

This package

claimchain/state.py

High-level ClaimChain interface

claimchain/core.py

Core operations of encoding claims and capabilities

claimchain/crypto

Cryptographic utilities, and algorithm implementations

Simulations

A core and experimental implementation of ClaimChain, a cryptographic data structure. See the web page to learn about ClaimChain.

Check out the documentation.

Acknowledgements

This work is funded by the NEXTLEAP project within the European Union’s Horizon 2020 Framework Programme for Research and Innovation (H2020-ICT-2015, ICT-10-2015) under grant agreement 688722.

Release files for claimchain 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claimchain 0.3.1
File Size Uploaded
claimchain-0.3.1.tar.gz 23.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claimchain 0.3.1
File Interpreter ABI Platform
claimchain-0.3.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 40.8 kB

Release files / claimchain-0.3.1.tar.gz

Download URL claimchain-0.3.1.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
344c606bd3675234f79d0d12c5a639b927eb4b3d53edb16d6d7c3dc241f984ed
BLAKE2b-256 checksum
How to use checksums
fa0e743f74b7b87b8b4509f063c5f4d73d4db04c8390d7c53a31eb1a9e6c6f28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / claimchain-0.3.1-py2.py3-none-any.whl

Download URL claimchain-0.3.1-py2.py3-none-any.whl
Size 17.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b9f90ba076d66fe67d620508365652e8b88c4cb08ca33c3d0518b532c92bec23
BLAKE2b-256 checksum
How to use checksums
624f2315638eeeba564c3d5f11a5c372af21efb9b2f5a519bfda9aebd8b292ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page