This project is dedicated to the world community as an Open-source Post-quantum blockchain layer 1 project, means anyone can join and contribute based on his/ her passion and skills. SPHINX is a blockchain protocol designed to provide secure and scalable solutions in the post-quantum era.
This repository contains code for the SPHINXVerify project, which is a Verification
module for the SPHINX blockchain framework.
The issue with general user transactions is that they typically require the exposure of private keys to sign the transaction data. This can pose a significant security risk as exposing private keys can lead to unauthorized access and control over the user's assets or sensitive information. Additionally, it can compromise the privacy of the user by linking their identity to the transactions they sign.
The solution provided by ZK-STARK is to utilize zero-knowledge proofs. Zero-knowledge proofs allow users to prove the validity of transactions or statements without revealing any sensitive information, such as private keys. In the context of transaction signing, ZK-STARK enables users to demonstrate knowledge of the private key and the ability to sign transactions correctly without actually disclosing the private key itself.
The provided code is using the ZK-STARK (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) protocol for verification purposes. ZK-STARK is a cryptographic protocol that enables the prover to convince the verifier about the correctness of a statement without revealing any information beyond the validity of the statement.
ZK-STARK offers significant benefits compared to ZK-SNARK schemes in terms of privacy and security.
-
Privacy: ZK-STARK allows users to prove the validity of transactions without revealing any sensitive information, such as private keys. In contrast, multi-signature schemes typically require the involvement of multiple parties and the exposure of their public keys, which can potentially be used to link transactions and compromise privacy.
-
Efficiency: ZK-STARK provides succinct non-interactive proofs, meaning that the proof size remains fixed regardless of the complexity of the statement being proven. This efficiency allows for faster and more scalable verification compared to multi-signature schemes, which often require multiple signatures and larger data structures to store the public keys of involved parties.
-
Trustlessness: ZK-STARK provides a high level of trustlessness as it eliminates the need for trust in the verification process. The validity of a transaction can be mathematically proven using the ZK-STARK proof, without relying on the trustworthiness of specific parties or intermediaries. In multi-signature schemes, trust is placed on the participating entities to sign transactions correctly and honestly.
-
Security: ZK-STARK offers strong cryptographic security guarantees. It relies on the assumption that the underlying cryptographic primitives, such as hash functions and digital signatures, are secure. In contrast, multi-signature schemes may be susceptible to attacks targeting the key management infrastructure or compromising the security of individual private keys.
In summary, the usage of ZK-STARK in the provided code enhances the privacy, efficiency, trustlessness, and security of transaction broadcasting compared to multi-signature schemes. It enables users to prove transaction validity without revealing sensitive information and provides a robust cryptographic foundation for secure and private blockchain transactions.
The SPHINXVerify
namespace contains functions for verifying SPHINX blocks and chains, performing data verification, and simulating the interaction between a prover and a verifier using the SPHINX protocol.
verifySPHINXBlock(block, signature, public_key)
block
: ASPHINXBlock
object representing the block to be verified.signature
: A string containing the signature of the block.public_key
: ASPHINX_PublicKey
object representing the public key used for verification.
Returns a boolean value indicating whether the signature is valid.
verifySPHINXChain(chain)
chain
: ASPHINX_Chain
object representing the chain to be verified.
Returns a boolean value indicating whether the chain is valid. The function performs the following verifications:
- Verifies the signature of each block in the chain using
verifySPHINXBlock
. - Checks if the blocks are properly linked together.
verify_data(data, signature, verifier_public_key)
data
: A vector ofuint8_t
representing the data to be verified.signature
: A string containing the signature of the data.verifier_public_key
: A vector ofuint8_t
representing the public key used for verification.
Returns a boolean value indicating whether the data is valid.
verify_sphinx_protocol()
Returns a boolean value indicating the final result of the simulation. The function performs the following steps:
- Creates instances of
SPHINXProver
andSPHINXVerifier
objects. - Initiates the interaction by obtaining the initial message using
sendMessage
from the verifier object. - Continues the interaction until the verifier is done by:
- The prover receives the message from the verifier using
receiveMessage
. - The prover sends the response message using
sendMessage
. - The response message is passed back to the verifier using
receiveMessage
.
- The prover receives the message from the verifier using
- Verifies the final result using
verify
from the verifier object.
The code provides functions to verify SPHINX blocks and chains, perform data verification, and simulate the interaction between a prover and a verifier using the SPHINX protocol. These functions utilize the capabilities of the libstark::Protocols::ProverInterface
and libstark::Protocols::verifierInterface
objects to generate and verify proofs, allowing for secure and private verification of transactions in a blockchain system.
Every code in the repository is a part of the SPHINX blockchain algorithm, which is currently in development and not fully integrated or extensively tested for functionality. The purpose of this repository is to provide a framework and algorithm for the digital signature scheme in the SPHINX blockchain project.
As the project progresses, further updates and enhancements will be made to ensure the code's stability and reliability. We encourage contributors to participate in improving and refining the SPHINXBlock algorithm by submitting pull requests and providing valuable insights.
We appreciate your understanding and look forward to collaborative efforts in shaping the future of the SPHINX blockchain project.
To get started with the SPHINX blockchain project, follow the instructions below:
- Clone the repository:
git clone https://github.com/ChyKusuma/SPHINXVerify.git
- Install the necessary dependencies (List the dependencies or provide a link to the installation guide).
- Explore the codebase to understand the project structure and components.
- Run the project or make modifications as needed.
We welcome contributions from the developer community to enhance the SPHINX blockchain project. If you are interested in contributing, please follow the guidelines below:
- Fork the repository on GitHub.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
orgit checkout -b bugfix/your-bug-fix
. - Make your modifications and ensure the code remains clean and readable.
- Write tests to cover the changes you've made, if applicable.
- Commit your changes:
git commit -m "Description of your changes"
. - Push the branch to your forked repository:
git push origin your-branch-name
. - Open a pull request against the main repository, describing your changes and the problem it solves.
- Insert your information (i.e name, email) in the authors space.
Specify the license under which the project is distributed (MIT License).
If you have any questions, suggestions, or feedback regarding the SPHINX blockchain project, feel free to reach out to us at [email protected].