How to use the cryptoconditions.PreimageSha256 function in cryptoconditions

To help you get started, we’ve selected a few cryptoconditions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bigchaindb / bigchaindb / tests / common / test_transaction.py View on Github external
def test_output_hashlock_deserialization():
    from bigchaindb.common.transaction import Output
    from cryptoconditions import PreimageSha256

    secret = b'wow much secret'
    hashlock = PreimageSha256(preimage=secret).condition_uri
    expected = Output(hashlock, amount=1)

    cond = {
        'condition': {
            'uri': hashlock
        },
        'public_keys': None,
        'amount': '1',
    }
    cond = Output.from_dict(cond)

    assert cond == expected
github bigchaindb / bigchaindb / tests / common / test_transaction.py View on Github external
def test_output_hashlock_serialization():
    from bigchaindb.common.transaction import Output
    from cryptoconditions import PreimageSha256

    secret = b'wow much secret'
    hashlock = PreimageSha256(preimage=secret).condition_uri

    expected = {
        'condition': {
            'uri': hashlock,
        },
        'public_keys': None,
        'amount': '1',
    }
    cond = Output(hashlock, amount=1)

    assert cond.to_dict() == expected