Package: claimchain
claimchain-coreInstallingYou can installclaimchainvia pip:pip install claimchainTo run tests, checkout the git repository and run tox:git clone https://github.com/claimchain/claimchain-core
cd claimchain-core
toxUsage warningThis 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.UsageHigh-level interface for ClaimChain consists of two classes,Statefor building claimchains, andViewfor parsing and interpreting claimchains.Building chainsThe core abstraction for the a ClaimChain user is astate. Thestatecontains 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 thestateis constructed it can be committed to the chain.Here is how userAlicewould prepare herstate: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 thestoreand communicating the chain’shead. Other users will be able to interpret the chain using theViewinterface, described below.Interpreting chainsHaving access to the store (dictionary) containing other user’s chain, and a head of this user’s chain, one can use theViewinterface.Here is how Carol can interpret Alice’s claimchain, assuming Alice’s store isalice_store, the head of her chain isalice_head, andparamsis Carol’sLocalParamsobject: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.pkThis DH public key can be later used to grant Alice rights to read claims on Carol’s chain.This packageclaimchain/state.pyHigh-level ClaimChain interfaceclaimchain/core.pyCore operations of encoding claims and capabilitiesclaimchain/cryptoCryptographic utilities, and algorithm implementationsSimulationsA core and experimental implementation of ClaimChain, a cryptographic data
structure. See theweb pageto learn about
ClaimChain.Check out thedocumentation.AcknowledgementsThis work is funded by theNEXTLEAP projectwithin the European
Union’s Horizon 2020 Framework Programme for Research and Innovation
(H2020-ICT-2015, ICT-10-2015) under grant agreement 688722.