|
purify
C++ Purify implementation with native circuit and BPP support
|
Namespaces | |
| namespace | detail |
| namespace | testing |
Typedefs | |
| using | NonceHostCommitment = std::array<unsigned char, 32> |
| using | AnchorEscrowContextDigest = std::array<unsigned char, 32> |
| using | BitcoinGenesisHash = std::array<unsigned char, 32> |
| using | BitcoinTransactionId = std::array<unsigned char, 32> |
| using | CoalitionDeploymentId = std::array<unsigned char, 32> |
| using | CoalitionManifestDigest = std::array<unsigned char, 32> |
| using | CoalitionCoreDigest = std::array<unsigned char, 32> |
| using | CoalitionPermitId = std::array<unsigned char, 32> |
| using | AnchorReference = std::array<unsigned char, 32> |
| using | ConstructionReceiptStatementDigest = std::array<unsigned char, 32> |
| using | ResolvedConstructionSetupDigestBytes |
| using purify::accountable::AnchorEscrowContextDigest = std::array<unsigned char, 32> |
Digest of the application statement protected by one anchor escrow.
Applications must commit the anchor/member identity, contract or bond, purpose, and any domain or epoch fields that distinguish this escrow. The digest must not include the escrow record itself.
Definition at line 30 of file anchor_escrow.hpp.
| using purify::accountable::AnchorReference = std::array<unsigned char, 32> |
Definition at line 17 of file construction_receipt.hpp.
| using purify::accountable::BitcoinGenesisHash = std::array<unsigned char, 32> |
Raw Bitcoin uint256 bytes in consensus serialization order.
Definition at line 20 of file coalition_formation.hpp.
| using purify::accountable::BitcoinTransactionId = std::array<unsigned char, 32> |
Definition at line 21 of file coalition_formation.hpp.
| using purify::accountable::CoalitionCoreDigest = std::array<unsigned char, 32> |
Immutable coalition core bound by every accountable proof and response.
Definition at line 37 of file coalition_formation.hpp.
| using purify::accountable::CoalitionDeploymentId = std::array<unsigned char, 32> |
Application-defined identifier for one Char protocol deployment.
Definition at line 24 of file coalition_formation.hpp.
| using purify::accountable::CoalitionManifestDigest = std::array<unsigned char, 32> |
Digest of the acyclic, immutable coalition manifest.
The manifest must exclude the formation transaction ID and every proof, ciphertext, content hash, or receipt derived using the resulting coalition core. It normally commits member identities, management keys, lifecycle policy, and protocol versions not bound separately by Purify.
Definition at line 34 of file coalition_formation.hpp.
| using purify::accountable::CoalitionPermitId = std::array<unsigned char, 32> |
Stable registry key for one deployment's claim on one Bitcoin output.
Definition at line 40 of file coalition_formation.hpp.
| using purify::accountable::ConstructionReceiptStatementDigest = std::array<unsigned char, 32> |
Definition at line 18 of file construction_receipt.hpp.
| using purify::accountable::NonceHostCommitment = std::array<unsigned char, 32> |
Digest of the immutable ordered Purify nonce-host registration.
Definition at line 24 of file accountable_roster.hpp.
Definition at line 19 of file construction_receipt.hpp.
|
nodiscard |
Sum exact signed shares after their proofs were checked in roster order.
Point addition cannot detect a duplicate, omission, or reordering. The accepting parent must verify every contribution at its exact roster index before using this nonauthorizing aggregate.
Definition at line 555 of file recovery_root.cpp.
Referenced by purify::accountable::detail::resolve_construction_parent_public_inputs(), and purify::accountable::VerifiedDistributedRecoverySetup::verify_distributed_recovery_setup.
|
nodiscard |
Definition at line 332 of file accountable_responses.cpp.
|
nodiscard |
Internal circuit-shape seam guarding the fixed 8,192-gate suite.
Definition at line 376 of file anchor_escrow.cpp.
References purify::BulletproofTranscript::bind_output_to_commitment(), purify::BulletproofTranscript::from_transcript(), purify::Transcript::muls(), purify::NativeBulletproofCircuit::n_gates, purify::BulletproofTranscript::native_circuit(), PURIFY_ASSIGN_OR_RETURN, and PURIFY_RETURN_IF_ERROR.
|
nodiscard |
Validate nonce hosts and bind them to a one-shot Bitcoin formation.
Char registration should use this entry point after validating that the enclosing transaction consumes formation.permit().
Definition at line 188 of file accountable_responses.cpp.
References bind_nonce_hosts(), and purify::accountable::CoalitionFormation::core_digest().
|
nodiscard |
Validate and bind nonce hosts to an already authenticated generic core.
This lower-level boundary supports non-Bitcoin protocols and verification of already resolved registry data. It does not establish formation replay resistance. New Char registration must use bind_formation_nonce_hosts.
Definition at line 197 of file accountable_responses.cpp.
Referenced by bind_formation_nonce_hosts().
|
nodiscard |
The digest binds the exact serialized payload, its registry-resolved setup record digest, then each unique anchor reference, exact anchor root, punishment key, and context digest in deterministic payload order. The registry must resolve a recovery root immutably and one-to-one to the exact setup record whose digest is supplied here. This operation does not verify an escrow proof or authenticate the registry lookup and referenced anchors.
Definition at line 336 of file construction_receipt.cpp.
References purify::accountable::ConstructionReceiptPayload::anchor_entries(), purify::accountable::ResolvedConstructionReceiptEntry::anchor_reference, purify::accountable::ResolvedConstructionReceiptEntry::anchor_root, purify::BindingMismatch, purify::accountable::ResolvedConstructionSetupDigest::bytes(), purify::accountable::ResolvedConstructionReceiptEntry::context_digest, purify::InvalidFixedSize, purify::accountable::ResolvedConstructionSetupDigest::kSerializedSize, purify::accountable::ResolvedConstructionReceiptEntry::punishment_key, PURIFY_RETURN_IF_ERROR, purify::accountable::ConstructionReceiptPayload::serialize(), purify::BigUInt< Words >::to_bytes_be(), purify::unexpected_error(), purify::validate_public_points(), and purify::accountable::AnchorPunishmentPublicKey::xonly().
Referenced by purify::accountable::detail::resolve_construction_parent_public_inputs().
|
nodiscard |
Encrypt an anchor's existing punishment scalar to a verified coalition root.
Operating-system auxiliary randomness is hedged with the punishment secret and exact roster, root, and context statement. Separately tagged derivations produce the ephemeral key and proof seed. The proof binds the exact advertised anchor root, canonical punishment key, ciphertext, recovery-bound roster, and application context. The advertised anchor root must differ from the coalition recovery root so exposure cannot directly reconstruct the advertised anchor key.
Definition at line 485 of file anchor_escrow.cpp.
|
nodiscard |
Reproduce one exact anchor escrow from application-derived auxiliary input.
This is the idempotent counterpart to create_anchor_escrow(). The same statement, secret, and auxiliary scalar produce byte-identical ciphertext and proof records. The scalar must be derived from a secret PRF over the complete application context, not accepted as an untrusted protocol field. Purify additionally hedges it with the anchor secret and exact public statement before deriving encryption and proof randomness.
Definition at line 545 of file anchor_escrow.cpp.
|
nodiscard |
Internal deterministic hedged constructor used by security-vector tests.
Definition at line 558 of file anchor_escrow.cpp.
Referenced by purify::accountable::AnchorEscrowRecord::create_anchor_escrow, and purify::accountable::AnchorEscrowAuxiliaryScalar::create_anchor_escrow_deterministic.
|
nodiscard |
Derive the canonical companion-curve recovery key from an extracted q.
Definition at line 1149 of file recovery_root.cpp.
References purify::derive_key(), purify::SecretKey::from_packed(), purify::half_n2(), purify::FieldElement::is_zero(), purify::order_n2(), purify::pack_secret(), PURIFY_ASSIGN_OR_RETURN, purify::RangeViolation, and purify::unexpected_error().
Referenced by purify::accountable::RecoveryRootSetupProof::prove_recovery_root_setup, and recover_registered_root().
|
nodiscard |
Derive one deterministic public recovery share before formation.
This operation needs only the ordered MuSig roster and the member's own secret. Members may publish these shares, aggregate the recovery root, and commit that root in a formation manifest. The later formation-bound proof recomputes this exact share; this operation neither proves authorization nor reveals or aggregates member secrets.
Definition at line 505 of file recovery_root.cpp.
Referenced by purify::accountable::RecoveryRootShare::prove_recovery_root_contribution.
|
nodiscard |
This input binds the signing key, host/roster commitment, immutable coalition core, and slot. It contains neither the decision body nor a nonce, proof, batch, or signing-attempt ID.
Definition at line 52 of file accountable.cpp.
References purify::accountable::ConflictContext::coalition_core_digest, purify::TaggedHash::digest_many(), purify::accountable::ConflictContext::host_commitment, PURIFY_RETURN_IF_ERROR, purify::accountable::ConflictContext::signing_key, and purify::accountable::ConflictContext::slot.
Referenced by purify::puresign_plusplus::certificate_nonce_recursive_member_digest(), purify::puresign_plusplus::certificate_nonce_recursive_member_digest(), purify::puresign_plusplus::CertificateNonceParentPublicInputs::create(), purify::puresign_plusplus::serialize_accepted_certificate_nonce_parent_witness(), purify::puresign_plusplus::serialize_accepted_linear_certificate_nonce_parent_witness(), and purify::accountable::VerifiedCoalitionNonceSet::verify_coalition_nonce_set.
|
nodiscard |
Definition at line 180 of file accountable_responses.cpp.
|
nodiscard |
Hash the exact ordered signing roster and registered PureSign++ hosts.
Definition at line 172 of file accountable_responses.cpp.
Referenced by purify::accountable::NonceHostBoundSigningRoster::bind_nonce_hosts, and purify::accountable::VerifiedCoalitionNonceSet::verify_coalition_nonce_set.
|
nodiscard |
Prove one member's exact effective share on secp and both Purify curves.
Definition at line 817 of file recovery_root.cpp.
|
nodiscard |
Construct the transparent setup proof for a known aggregate signing scalar.
This centralized API is also the reference relation for a future MPC prover. It proves that the exact even-Y aggregate point and registered recovery root are both derived from signing_scalar. Proof randomness is derived from the secret witness and is never caller supplied. A future MPC implementation must jointly derive and keep the equivalent prover seed secret.
Definition at line 1171 of file recovery_root.cpp.
|
nodiscard |
This is NOT signature verification. A reviewed nonce proof must accept this exact compressed point and authenticated context before an endorsement counts. The nonce proof transcript must bind the point even though the challenge omits it.
Definition at line 85 of file accountable.cpp.
References purify::InternalMismatch, PURIFY_ASSIGN_OR_RETURN, purify_bppp_offset_commitment(), purify_point_scale(), purify::RangeViolation, purify::accountable::ScalarSignature::serialize(), signature_challenge(), purify::accountable::ConflictContext::signing_key, and purify::unexpected_error().
Referenced by purify::puresign_plusplus::CertificateNonceParentPublicInputs::create(), and purify::accountable::VerifiedCoalitionNonceSet::verify_scalar_response.
|
nodiscard |
Recover the aggregate's exact companion secret from an exposed signing key.
This verifies that the exposed scalar is the roster's normalized aggregate key, then resolves the unique centered-share carry against both companion sums. It does not authorize the public aggregate as a registered root.
Definition at line 579 of file recovery_root.cpp.
References purify::EllipticCurve::add(), purify::BindingMismatch, purify::curve1(), purify::curve2(), purify::derive_key(), purify::EquationMismatch, purify::accountable::RecoveryRootShareAggregate::first_sum(), purify::SecretKey::from_packed(), purify::generator1(), purify::generator2(), purify::half_n1(), purify::half_n2(), purify::InternalMismatch, purify::FieldElement::is_zero(), purify::accountable::RecoveryRootShareAggregate::member_count(), purify::accountable::NonceHostBoundSigningRoster::members(), purify::EllipticCurve::mul(), purify::EllipticCurve::negate(), purify::order_n1(), purify::order_n2(), purify::pack_secret(), purify::prime_p(), PURIFY_ASSIGN_OR_RETURN, PURIFY_RETURN_IF_ERROR, purify::RangeViolation, purify::accountable::RecoveryRootShareAggregate::recovery_root(), purify::require_secp_context(), purify::accountable::RecoveryRootShareAggregate::second_sum(), purify::SizeMismatch, purify::FieldElement::to_uint256(), and purify::unexpected_error().
Referenced by purify::accountable::VerifiedConstructionReceipt::recover_anchor(), and recover_distributed_escrowed_anchor().
|
nodiscard |
Recover one ciphertext whose complete escrow relation was authenticated by a stronger proof capability.
This deliberately remains private to the library. Public callers must use either recover_escrowed_anchor(), which verifies the child proof, or a VerifiedConstructionReceipt, which authenticates the same relation through its construction parent.
Definition at line 912 of file anchor_escrow.cpp.
References PURIFY_RETURN_IF_ERROR.
Referenced by purify::accountable::VerifiedConstructionReceipt::recover_anchor(), recover_distributed_escrowed_anchor(), and recover_escrowed_anchor().
|
nodiscard |
Recover an escrow through an authenticated distributed setup aggregate.
Definition at line 878 of file anchor_escrow.cpp.
References purify::accountable::VerifiedDistributedRecoverySetup::aggregate(), purify::accountable::AnchorEscrowRecord::ciphertext(), purify::EquationMismatch, PURIFY_ASSIGN_OR_RETURN, PURIFY_RETURN_IF_ERROR, recover_aggregated_recovery_root(), recover_authenticated_anchor_ciphertext(), purify::accountable::VerifiedDistributedRecoverySetup::roster(), purify::unexpected_error(), and verify_anchor_escrow().
|
nodiscard |
After a coalition scalar is exposed, recover the anchor punishment key.
This centralized path first checks that the scalar recovers the roster's registered root, then verifies the escrow proof, decrypts the punishment scalar, and checks its normalized even-Y BIP340 key against the exact advertised punishment key. Distributed receipts use the separately typed aggregate-bound recovery operation below.
Definition at line 847 of file anchor_escrow.cpp.
References purify::accountable::AnchorEscrowRecord::ciphertext(), purify::EquationMismatch, PURIFY_ASSIGN_OR_RETURN, PURIFY_RETURN_IF_ERROR, recover_authenticated_anchor_ciphertext(), recover_registered_root(), purify::unexpected_error(), and verify_anchor_escrow().
|
nodiscard |
Validate an exposed scalar and recover the exact registered companion key.
Definition at line 1338 of file recovery_root.cpp.
References purify::BindingMismatch, derive_recovery_root(), PURIFY_ASSIGN_OR_RETURN, PURIFY_RETURN_IF_ERROR, purify::accountable::RecoveryBoundSigningRoster::recovery_root(), purify::require_secp_context(), purify::accountable::NonceHostBoundSigningRoster::signing_key(), and purify::unexpected_error().
Referenced by recover_escrowed_anchor().
|
nodiscard |
Both responses are interpreted under one supplied Q/U/core/T context. Rejects equal challenges, a recovered scalar whose full public point differs from the even-Y signing key, and a common nonce at infinity. The result is derived entirely from public input, so it is returned as ordinary scalar bytes.
This is NOT certificate or conflict verification. Before using the result for enforcement, the caller must validate both nonce proofs, authenticate each endorsement's context, and establish the application conflict/liability rules. Successful recovery alone does not authorize a penalty.
Definition at line 108 of file accountable.cpp.
References purify::BindingMismatch, purify::EquationMismatch, purify::FieldElement::from_bytes32(), purify::InternalMismatch, is_zero(), PURIFY_ASSIGN_OR_RETURN, purify_point_scale(), purify::RangeViolation, purify::accountable::ScalarSignature::serialize(), signature_challenge(), purify::accountable::ConflictContext::signing_key, and purify::unexpected_error().
Referenced by purify::accountable::VerifiedScalarResponse::recover_verified_same_slot_key.
|
nodiscard |
Definition at line 370 of file accountable_responses.cpp.
|
nodiscard |
Serialize the exact accepted public witness consumed by the parent prover.
Every leaf proof is reconstructed from the typed registry context, reduced, accumulated in payload order, and discharged by native decide() before bytes are returned. The caller cannot supply descriptors, precommitments, public witness points, or a final root independently.
Wit4 validates each complete typed record, then emits its type version and proof transcript. The share or ciphertext already bound by the descriptor and construction statement is not repeated in the prover witness.
The returned witness contains no coalition, member, nonce-host, anchor, or punishment secret. It is nevertheless bound to the verified distributed setup capability required to prepare the anchor leaves.
Definition at line 136 of file construction_parent_prover_input.cpp.
References purify::accountable::VerifiedDistributedRecoverySetup::aggregate(), purify::accountable::ConstructionReceiptPayload::anchor_entries(), purify::accountable::ConstructionLeafAccumulator::basis(), purify::BindingMismatch, purify::accountable::ResolvedConstructionSetupDigest::bytes(), purify::checked_add_size(), purify::checked_mul_size(), purify::bppp::accumulation::decide(), purify::accountable::ResolvedConstructionSetup::formation(), purify::InternalMismatch, purify::accountable::ConstructionReceiptAccumulator::kRootClaimSerializedSize, purify::accountable::AnchorEscrowRecord::kSerializedSize, purify::accountable::RecoveryRootContribution::kSerializedSize, purify::accountable::ConstructionReceiptAccumulator::leaves(), purify::Overflow, purify::bppp::accumulation::parse_root_claim(), purify::accountable::ConstructionLeafAccumulator::prepare(), PURIFY_ASSIGN_OR_RETURN, PURIFY_RETURN_IF_ERROR, purify::accountable::RecoveryBoundSigningRoster::recovery_root(), purify::accountable::RecoveryRootShareAggregate::recovery_root(), purify::accountable::ResolvedConstructionSetup::recovery_root(), purify::require_secp_context(), purify::accountable::detail::resolve_construction_parent_public_inputs(), purify::accountable::ResolvedConstructionSetup::resolved_digest(), purify::accountable::ResolvedConstructionSetup::roster(), purify::accountable::VerifiedDistributedRecoverySetup::roster(), purify::bppp::accumulation::serialize_algebraic_norm_reduction(), purify::bppp::accumulation::serialize_algebraic_step(), purify::bppp::accumulation::serialize_root_claim(), purify::accountable::ConstructionReceiptPayload::setup_entries(), purify::SizeMismatch, purify::BigUInt< Words >::to_bytes_be(), purify::unexpected_error(), purify::bppp::accumulation::verify_algebraic_norm_reduction(), and purify::bppp::accumulation::verify_algebraic_step().
|
nodiscard |
The SHA-256 digest is reduced modulo the secp256k1 group order. A zero result rejects this statement; callers must not retry by changing its slot.
Definition at line 62 of file accountable.cpp.
References purify::accountable::ConflictContext::coalition_core_digest, purify::TaggedHash::digest_many(), purify::detail::FieldElementAccess::from_raw(), purify::accountable::ConflictContext::host_commitment, PURIFY_RETURN_IF_ERROR, purify_scalar_set_b32(), purify::RangeViolation, purify::accountable::ConflictContext::signing_key, purify::size_fits_u64(), purify::accountable::ConflictContext::slot, and purify::unexpected_error().
Referenced by purify::puresign_plusplus::certificate_nonce_recursive_step_digest(), reconstruct_nonce(), and recover_same_slot_key().
|
nodiscard |
Verify the exact public statement carried by an anchor escrow.
Definition at line 658 of file anchor_escrow.cpp.
Referenced by recover_distributed_escrowed_anchor(), and recover_escrowed_anchor().
|
nodiscard |
Definition at line 210 of file accountable_responses.cpp.
|
nodiscard |
Verify one contribution at every roster index and authorize its aggregate.
Count and formation mismatches are rejected before proof verification. This is the distributed counterpart to verify_recovery_root_setup.
Definition at line 931 of file recovery_root.cpp.
|
nodiscard |
Definition at line 284 of file accountable_responses.cpp.
|
nodiscard |
Verify one ordered, formation-bound member contribution.
Definition at line 886 of file recovery_root.cpp.
Referenced by purify::accountable::VerifiedDistributedRecoverySetup::verify_distributed_recovery_setup.
|
nodiscard |
Verify aggregate-key knowledge and the recovery-root relation.
The circuit wrapper's external-commitment proof establishes knowledge of the exact final aggregate signing scalar. The root relation derives the exact registered companion root from that same witness. This is the centralized constructor for RecoveryBoundSigningRoster; distributed contribution verification supplies the other constructor. Member consent is separate application policy.
Definition at line 1298 of file recovery_root.cpp.
|
nodiscard |
Definition at line 306 of file accountable_responses.cpp.
Referenced by purify::accountable::VerifiedCoalitionNonceSet::aggregate_responses.