bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 6쪽 중 1쪽
# Overview
An on-chain, non-custodial ZK privacy system for Ethereum and other EVM chains.
## What is RAILGUN?
RAILGUN is code that exists on every Ethereum node. It's a privacy system built directly on-chain for Ethereum, BSC, Polygon, and Arbitrum. It uses Zero-Knowledge (ZK) cryptography to enable private use of smart contracts and DeFi, all without leaving the security of the user’s preferred chain. The RAILGUN code has no owner. Interactions on your chain of choice are made private. 
The RAIL token is used only for protocol security (staking). Security stakers evaluate the content of protocol requests and decide whether they should be executed. It is not a privacy coin. Holding RAIL is not necessary to use the protocol and it does not confer any rights to holders.
RAILGUN users have access to a special 0zk address that are confidential on Etherscan, Arbiscan, or any similar resource. Independent wallet providers can use the RAILGUN protocol, head [here](https://railgun.org/wallets) to select from a list of wallet providers. RAILGUN is 100% non-custodial.
The user experience is similar to using a public wallet to interact with Ethereum/EVM chains, just with the added ability to interact privately.
As RAILGUN is simply on-chain smart contract code, privacy is achieved without the need to move to a separate chain. This provides 2 main advantages:
1. **Security & Decentralization** - No centralized control, no extra validators, and no trusted bridges.
2. Full Ecosystem - Rather than an isolated ecosystem on a standalone privacy chain, RAILGUN users have full access to all the economic activity and functions that the chain provides, and benefit from the rich history of existing dApps and builders. 
RAILGUN has 2 main components:
1. **RAILGUN-Integrated Wallets** - EVM wallets built by separate independent community developers through which users can use the RAILGUN protocol. A list can be found [here](https://railgun.org/wallets).
2. **Developer Tools** – includes TypeScript SDKs for building RAILGUN privacy into existing/new wallets or a privacy enabled dApp. Head to the [developer guide](https://docs.railgun.org/developer-guide) to start building with RAILGUN.
RAILGUN’s code is verified and publicly viewable, and its repository can be found [here.](https://github.com/Railgun-Community) 
## Benefits and use cases of RAILGUN
<figure><img src="https://4189133001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgpI5FGDnzf3cR6tzx7%2Fuploads%2Ft7FMVUqCN90NdQTskJuf%2Frailgun_flowchart_-02.png?alt=media&token=521dfa7b-0746-4d5c-a9ef-b32ef1d690b0" alt=""><figcaption></figcaption></figure>
As the diagram shows, looking from the outside in, when tokens are moved into RAILGUN’s smart contract, tokens and wallets become indistinguishable from one another without mixing one user's funds with another. Because of this, all transferring, swapping, lending, borrowing, and dApp calls create more noise and improve privacy for every other user. These DeFi interactions allow RAILGUN to function more privately than other protocols with a similar amount of tokens and users. 
Read [this article](https://medium.com/@Railgun_Project/what-is-crypto-privacy-how-railgun-can-help-7-privacy-tips-for-dank-degens-cce294c6fc70) for more on how privacy works in the RAILGUN protocol.
Due to the availability of DeFi transactions, more rigorous privacy is achieved with RAILGUN with less liquidity and in a shorter timeframe than with other privacy systems. Arbitrary dApp interactions within RAILGUN’s privacy system also incentivizes users to hold their tokens for longer in RAILGUN as there is less reason to move tokens out of RAILGUN.
Potential use cases:
1. **Alpha Protection:** Traders who want to keep their alpha confidential can trade freely and maintain their informational advantages. RAILGUN’s privacy system enables users to trade with reduced risk of hard-fought trading strategies and patterns being discovered and ripped off by freeloading actors, who can obtain such data on-chain by tracing interactions, then running them through analysis software to reverse engineer said strategies, without doing any of the actual work.
2. **Compliance with Law:** Businesses and professionals must use privacy tools, such as RAILGUN, to make sure that financial data is not leaked when interacting with clients. Lawyers, doctors, and psychologists, for example, are not allowed to reveal that their clients have paid for advice. They must protect the identity of the person engaging their services, as set out in common law, professional rules of conduct, European and British GDPR, the USA’s HIPAA, and other data protection legislation. Other businesses and professionals also have strict laws that apply to them to protect the financial information of their customers & staff. RAILGUN is used to comply with these laws.
3. **Private Payroll:** The privacy features of RAILGUN are needed for payroll services, when companies pay in cryptocurrency.
4. **Donation Privacy:** RAILGUN users can donate to charitable causes using cryptocurrency without needing to publicly reveal their link to these causes.
5. **Personal Protection:** RAILGUN users are not exposed on services like Nansen or Etherscan, where notable wallets are labelled or known. Any cryptocurrency user who wishes to protect their personal privacy can do so using RAILGUN.
RAILGUN is a revolutionary toolkit and is objectively the most uncompromising privacy solution for DeFi. Private DeFi will enable new business possibilities for the cryptocurrency industry that are not possible on public blockchains. All other privacy solutions have some trade-offs, such as requiring users to trust custodial bridges or trade with fragmented/non-existent liquidity.
### Developer Guide
If you're a developer looking for the SDK documentation. [You can find it here](https://docs.railgun.org/developer-guide).
# Getting Started
### What do I need to start using RAILGUN?
Using RAILGUN is simple, even for those new to DeFi and blockchains. You will need:
* Network base tokens for the chain you wish to use (ETH for Ethereum & Arbitrum, MATIC for Polygon, and BNB for BNB Chain).
* Assets held in a self-custodial EVM wallet (popular options include [Frame](https://frame.sh), [Rabby](https://rabby.io), and [MetaMask](https://metamask.io))
After this, you will need to select a frontend from the list of independent providers at <https://railgun.org/wallets>, there is no single or official frontend for RAILGUN and all providers are built by independent community members and partners.
Once you've selected a frontend, you can generate a 0zk private address to which you can [shield ](/wiki/learn/shielding-tokens)tokens. 
# RAILGUN Privacy System
The RAILGUN privacy system is a series of smart contracts that privatizes blockchain interactions. RAILGUN privatizes:
1. Sender 
2. Recipient
3. Token type
4. Amount 
RAILGUN protects this information by utilizing Private Balances, a confidential set of tokens and users where interactions appear to originate from. These Private Balances are known as an privacy set as, to an outside observer; transactions can be sent by anyone who has previously made a transaction.
#### How private are Private Balances?
The overall level of privacy from Private Balances is a function of:
1. Total number of unique shield interactions and users.
2. Total Value Locked in the RAILGUN smart contracts.
3. RAILGUN DeFi interaction and Private Send volume. 
Generally, the higher the total number of unique shield interactions and users, the higher the level of confidentiality as links are less likely to be drawn between depositor and token, as there are a higher number of potential depositors to try and attach interactions to. Some consideration must also be given to token type. For example, using common stables like USDC or DAI will offer greater privacy vs using some unknown meme token with very few interactions.
However, RAILGUN has additional privacy boosting capabilities due to its support of complex smart contract interactions and Private Sends. Every interaction that takes place (such as a swap on [Railway DEX](https://github.com/Railgun-Community/community-faqs/blob/main/common/broken-reference/README.md)), decreases the likelihood an interaction can be linked to a specific asset, increasing privacy for all users. As RAILGUN enables trading, you can use a small amount of crypto and theoretically trade up to a larger position privately, therefore the total size of the privacy set is less of a factor in maintaining privacy in RAILGUN.
This means that privacy in RAILGUN's Private Balances is always greater than other privacy solutions with the same amount of TVL due to increased noise from interactions like Private Sends and swaps.
For more detail on privacy in RAILGUN and some tips to further bolster privacy, check out [this article](https://medium.com/@Railgun_Project/what-is-crypto-privacy-how-railgun-can-help-7-privacy-tips-for-dank-degens-cce294c6fc70).
#### Broadcasters and UTXOs
RAILGUN users can send transactions through [Broadcasters](file:///C:/wiki/learn/privacy-system/community-relayers), which are wallets that pass information to the blockchain and submit gas on a user’s behalf. Interactions sent by users appear to originate from Broadcasters and cannot be linked to a shielding address.
RAILGUN’s transaction system uses [Unspent Transaction Outputs](https://academy.binance.com/en/glossary/unspent-transaction-output-utxo) (UTXOs), similar to Bitcoin and Zcash’s spending system. A UTXO represents the ability to spend tokens and is implemented in RAILGUN as a [Merkle Tree](https://en.m.wikipedia.org/wiki/Accumulator_\(cryptography\)) ([accumulator](https://medium.com/@aurelcode/cryptographic-accumulators-da3aa4561d77)), an organized and encrypted data tree which allows the RAILGUN smart contract to trace ownership and balances through cryptographic proofs. The difference here is that RAILGUN’s Merkle Tree is completely private and held in the smart contract.
#### RAILGUN SDK
At its core, RAILGUN is low-level infrastructure with an SDK (Software Development Kit) for protocol integrations of private smart contract interactions and a private wallet. Users have a public on-chain address, that is a 0x address and a private RAILGUN address which begins with a 0zk. Interactions sent from 0zk addresses are private and appear on blockchain scanners (like Etherscan) as originating from a Broadcaster address. Identifying details are confidential at all stages of the process by encryption using zk-SNARK proofs.
# Zero-Knowledge Cryptography
Details on RAILGUN zk-SNARKs
RAILGUN leverages Zero-Knowledge Proofs (ZKPs), a foundational tool for privacy preservation. ZKPs allow for advanced logic and contract interactions without information leakage.
### What are zk-SNARKs?
[Zero-Knowledge proofs ](https://medium.com/web3studio/a-simple-explanation-of-zero-knowledge-proofs-ca574092e73b)are methods for one party, the prover, to mathematically satisfy another party, the verifier, the truth of information without revealing the originating details of the information. This is achieved by the prover-passing components of mathematical problems that deliver the truth and verifiability of the information, being proved to the verifier multiple times. These interactions occur until the verifier is satisfied that it is statistically impossible for the information to not be true or is being faked by the prover, all without revealing the contents of the verified information.
[zk-SNARK ](https://consensys.net/blog/developers/introduction-to-zk-snarks/)stands for “Zero-Knowledge Succinct Non-Interactive Argument of Knowledge”. Put simply, a zk-SNARK is a form of ZKP that does not require direct interaction between the prover and verifier. Rather, they achieve their non-interactivity through the prover simulating the interactions between prover and verifier, and the verifier simply checks that the simulation was performed correctly. These proofs rely on computational assumptions that cannot be cracked. As it stands, it would take millions of years to crack with currently available computational power.
For zk-SNARKs to be “succinct”, the proof size and verification cost must be small, logarithmic, or lower. [Elliptic curves allow for smaller key generation ](https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/)and therefore more succinct ZK proof outputs. Elliptic Curve Cryptography use points on an elliptic curve graph to generate public and private keys from mathematical equations between the points on the curve. They form the basis of the RAILGUN privacy system, as zk-SNARKs allow a smart contract to act as a verifier. The verifiers in RAILGUN are the smart contracts themselves. RAILGUN uses [EIP](https://eips.ethereum.org/EIPS/eip-197) [197 ](https://eips.ethereum.org/EIPS/eip-197)and [EIP 198, ](https://eips.ethereum.org/EIPS/eip-198)together enables RAILGUN to generate zk-SNARK circuits on-chain. These zk-SNARK circuits are created on the client side and can then be submitted for confirmation on-chain.
zk-SNARKs can prove any form of information, such as valid unspent token balances or, in other terms, who has the right to spend which token on a blockchain without revealing details about the person originating the interaction.
### What is a circuit?
<figure><img src="https://4189133001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MgpI5FGDnzf3cR6tzx7%2Fuploads%2FXj738bisL5jHpEjo5p95%2FzkSnarks%20(2).png?alt=media&token=688056a0-a645-4742-a973-8822dfadfc62" alt=""><figcaption><p>Example arithmetic circuit to prove the output using the mathematic gates and inputs a, b, and c</p></figcaption></figure>
### RAILGUN's zk-SNARK Circuit Design
The advanced cryptography contained in RAILGUN’s privacy system has 54 circuits to enable complex interaction types. Each circuit is differentiated by the number of inputs and outputs, and together they form the cryptographic basis for RAILGUN.
Multiple circuits are needed to account for different transaction types as circuits require the number of signals (inputs and outputs) to be instantiated at the setup phase. For example, a transaction that sends DAI to 2 different 0zk addresses might require a circuit with 1 input to 2 outputs. Extending this idea, a transaction that sends DAI comprised of 7 UTXO balances to 2 0zk addresses would require a 7 to 2 circuit. Inputs in these scenarios are equivalent to UTXOs and outputs would be equivalent to recipients.
Currently, there are 54 circuits, each with different numbers inputs (UTXOs) and outputs (UTXO destinations). Circuits can be chained together to handle all possible combinations of UTXOs and outputs, and the system will automatically route a transaction through the most gas & cost efficient combination.
RAILGUN also supports multiple inputs to singular outputs, such as 5 to 1. These circuits are used for multi-sends, where users send more than 1 token type in the same transaction to a singular recipient. They are also useful for swaps where the price of the token has changed, leaving some leftover change in the original swap token or for paying a Broadcaster in a token other than the one being sent. E.g., if WETH is sent as a Broadcaster fee to send DAI.
RAILGUN’s circuit design is flexible in terms of supporting tokens other than just ERC-20, RAILGUN can Shield ERC-721 and ERC-1155 NFTs. For example, with RAILGUN’s circuits and smart contracts, users could potentially provide liquidity on Uniswap v3 privately and shield their LP NFT privately as well. This kind of composability is only possible with the flexibility of RAILGUN’s privacy system and is the result of it being designed from the ground up for real world DeFi use cases.
# Trusted Setup Ceremony
How RAILGUN's Groth16 trusted setup works, multi-party computation and Toxic Waste, not a multisig, with public verification keys.
RAILGUN’s zk-SNARK circuits are proved using the [Groth16 ](https://eprint.iacr.org/2016/260.pdf)proof system, a [pairing-based zk-SNARK](https://zkproof.org/2021/06/30/setup-ceremonies/) [design. ](https://zkproof.org/2021/06/30/setup-ceremonies/)Groth16 is the most widely used zk-SNARK (with [Zcash notably using it for the first ZK shielded](http://www.zeroknowledgeblog.com/index.php/groth16)[protocol](https://www.zeroknowledgeblog.com/index.php/groth16)) as it allows for efficient verifier performance and short proof strings, requiring less computation time and power. Groth16 requires the generation of randomization for each circuit in what is called a [‘ceremony’.](https://zkproof.org/2021/06/30/setup-ceremonies/)
zk-SNARKs need a common reference string (CRS), a public parameter that is used in proving and verifying and must be generated in advance by a trusted party. This is because zk-SNARK proving systems require the prover and verifier to have access to some public common knowledge (in this case the CRS), that has been pre-generated by a shared algorithm.
CRS is generated using these ceremonies by having multiple, independent, and decentralized participants contributing random text. This setup ceremony type involving multiple parties is known as multi-party computation [(MPC), ](https://zeroknowledge.fm/the-power-of-tau-or-how-i-learned-to-stop-worrying-and-love-the-setup/)which prevents any single party involved in the ceremony from gaining knowledge of the underlying mathematic structure of the CRS. The CRS (derived from individual submissions) is a set of encrypted values where at least one of the original un-encrypted values (Toxic Waste) is destroyed to ensure that no actor is able to generate fake proofs to maintain system security.
There is no multisig anywhere in this process. The ceremony is a multi-party computation. It is secure as long as at least one participant destroys their contribution, which is a different and more resilient trust model than an M-of-N multisig. Verification keys are meant to be public. Anyone needs them to check a proof, so there is nothing to "leak" there. What must be destroyed is the Toxic Waste described above. A participant who fails to destroy theirs, not an attacker "compromising a multisig," could allow fake proofs to be forged.
The setup ceremony type used in RAILGUN’s circuits was the [Perpetual Powers of Tau.](https://medium.com/coinmonks/announcing-the-perpetual-powers-of-tau-ceremony-to-benefit-all-zk-snark-projects-c3da86af8377) It is perpetual in the sense that there are no limits to the number of participants, and is what enables the security derived from the requirement of only 1 participant to destroy the CRS. The Perpetual Powers of Tau are points along the elliptic curve outputted from the ceremony and are used for private and public key derivation.
This trusted setup is a requirement of Groth16 and allows for secure encryption, provided that the ceremony is performed correctly. One trusted setup ceremony is sufficient to secure the proving mechanisms, however, new ceremonies are required each time circuits are upgraded for performance, or when new features are added.
As RAILGUN has optimized Groth16 zk-SNARK design for verification, the on-chain gas requirements are low considering the level of computation and encryption that is available in the RAILGUN privacy system. This is a more secure privacy system design than relying on an L2 for consensus. However, as above, new upgrades and circuit designs require new trusted setup ceremonies.
The transcript of the RAILGUN setup ceremony is [here](https://ipfs.stibits.com/QmWAySHYhaZqioKi1ufrPJC1n1ZVtHP2w4hLA9XqqJCFne).
# Community Broadcasters
RAILGUN Broadcasters are key actors in ensuring privacy
Community Broadcasters are public 0x wallets that submit gas to the프로젝트로 돌아가기