Sign 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 14쪽 중 5쪽

n-ecosystem/sign-protocol) * Identity integration: [New ID System](/national-systems/new-id-system) * Audit trail concepts: [Use Cases](/national-systems/new-money-system) # Quickstart A brief introduction to Sign Protocol for hackers. ### Introduction Sign Protocol is an omni-chain attestation protocol, enabling users to freely attest and retrieve structured and verifiable data on-chain. It also accommodates large-size data by offloading storage to IPFS\* and Arweave. With Sign Protocol, participating contracts collectively define data schemas and deposit relevant data in the form of attestations in Sign Protocol's smart contract. *\*Storage on IPFS is free but not permanent. We recommend Arweave over IPFS.* ### Getting Started #### Defining a Schema A schema is a representation or configuration that defines the type and structure of data that is presented in the making of an attestation. Schemas create standards that allow an attestation to be accurate, composable, and insightful for any observer (verifier). A helpful analogy to understand a schema is to envision it as the blueprint for an attestation. A schema facilitates how an attester provides the much-needed context and confirmation in the attestation they wish to create. To create a schema, you will need to understand the attestation you are trying to create. What kind(s) of information are you planning to store in an attestation and how large will the data be? Typically, all data is stored onchain. However, larger datasets will be cheaper to store offchain in a [Hybrid Attestation](/for-builders/advanced-topics/hybrid-attestations) or fully off-chain on Arweave/IPFS. <figure><img src="https://3152654701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw182g9YzR34mTxEBTKXX%2Fuploads%2Fgit-blob-534ba24d6e1f009933cd92277c4dbd8d9c45e2e2%2Fstorage-solutions-for-data.svg?alt=media" alt=""><figcaption><p>Storage Solutions for Sign Protocol</p></figcaption></figure> You can read more about schemas [here](/reference/index/schema) and can find examples [here](/for-builders/getting-started/tutorials/building-a-simple-notary-platform/schema-creation) and [here](/for-builders/index-1/npm-sdk/examples). #### Schema Hooks To use a schema hook with the schema you are creating, you will need to create a smart contract that implements the functions defined [here](/for-builders/index-1/index/index/index/isphook). Schema Hooks can help you whitelist attesters, charge fees, and perform other application logic when attestations are created or revoked. If you would like to see a sample whitelist schema hook, please navigate to the [Schema Hooks](/for-builders/advanced-topics/schema-hooks) page. #### Creating an Attestation Sign Protocol implements attestations as digitally signed structured data that adhere to a registered schema under a schema registry. These attestations are then stored in a secure domain, either on-chain or off-chain. You will need to create or find a schema before creating an attestation. Your attestation must adhere to its schema's defined format in order to be parseable. To learn more about the concept of attestations, you can find more information [here](/reference/index/attestations). To create an attestation, you can find examples [here](/for-builders/getting-started/tutorials/building-a-simple-notary-platform/attestation-creation) and [here](/for-builders/index-1/npm-sdk/examples). If you would like to create attestations on behalf of a user (to sponsor gas, for example), you will need to provide a delegate signature from the user when creating the attestation. You can find examples of delegate attestation creation with our NPM SDK [here](/for-builders/index-1/npm-sdk/examples). #### Querying for Attestations Sign Protocol offers an indexing service to quickly query and retrieve schema and attestation data. This service is available at a [REST](/for-builders/index/index-1) endpoint and a [GraphQL](/for-builders/index-1) endpoint and can also be accessed directly through our [NPM SDK](/for-builders/index/index/indexing-service). ### Final Details You can find more development-related details and examples using Sign Protocol in the [For Builders](/for-builders/getting-started) section of the docs. If you are interested in seeing the thought process behind Sign Protocol and the higher-level overview of relevant topics, see the [For Thinkers](/for-thinkers/a-future-of-verifiable-trust) section of the docs. We recommend using a testnet for building on Sign Protocol during the hackathon. You can find a list of supported networks [here](/for-builders/address-book). If we do not currently support a network you are looking to build on, reach out to us on Discord and we will see if we can support it. Lastly, if you encounter any bugs, think there is something missing/incorrect in the docs, or have any questions, please reach out to the Sign Protocol team on ETHGlobal's Discord channel. We cannot wait to see what you build and look forward to interacting with you over the course of the hackathon and beyond! As a developer on Sign Protocol, we would love to hear from you! Please join Sign's [Discord](https://discord.gg/NQ2v4cJNDs) channel and [Telegram](https://t.me/signecosystem) developer chat. # Getting Started *** ### description: An overview of S.I.G.N. and the underlying systems that power sovereign digital infrastructure. ## S.I.G.N. * [Overview](https://github.com/EthSign/sign-protocol-docs/blob/main/for-builders/getting-started/sign/README.md) * [Reference Architecture](https://github.com/EthSign/sign-protocol-docs/blob/main/for-builders/getting-started/sign/reference-architecture.md) * [Security & Privacy](https://github.com/EthSign/sign-protocol-docs/blob/main/for-builders/getting-started/sign/security-privacy.md) * [Governance & Operations](https://github.com/EthSign/sign-protocol-docs/blob/main/for-builders/getting-started/sign/governance-ops.md) ## Use Cases * [New Money System](https://github.com/EthSign/sign-protocol-docs/blob/main/for-builders/getting-started/use-cases/new-money-system.md) * [New ID System](https://github.com/EthSign/sign-protocol-docs/blob/main/for-builders/getting-started/use-cases/new-id-system.md) * [New Capital System](https://github.com/EthSign/sign-protocol-docs/blob/main/for-builders/getting-started/use-cases/new-capital-system.md) ## Getting Started with S.I.G.N. ### Introduction S.I.G.N. is sovereign-grade digital infrastructure designed to support national-scale systems for **money**, **identity**, and **capital**. Modern government and regulated financial systems increasingly rely on digital execution: CBDCs, regulated stablecoins, national ID systems, subsidy distribution, and tokenized real-world assets (RWA). While these systems appear different on the surface, they all depend on the same foundational requirements: * Verifiable identity and eligibility * Programmable execution rules * Durable, inspectable records * Interoperability across chains and systems * Auditability without sacrificing privacy S.I.G.N. provides a unified infrastructure layer that addresses these requirements through three interoperable systems. *** ### The Three Systems of S.I.G.N. #### New Money System The New Money System enables CBDCs and regulated stablecoins to operate on both public and private blockchains with policy controls, auditability, and interoperability. It supports: * Public-chain deployments (L1/L2) for transparency and composability * Private-chain deployments (e.g. Fabric-based CBDC rails) for confidentiality * Bridging between public and private money systems * Identity-bound and policy-constrained execution #### New ID System The New ID System provides national digital identity and verifiable credentials using open standards. It enables: * W3C Verifiable Credentials (VC) and DIDs * Selective disclosure and privacy-preserving proofs * Cross-agency and cross-platform verification * Trust registries and revocation mechanisms #### New Capital System The New Capital System supports tokenized real-world assets (RWA) and programmable capital distribution. It enables: * Large-scale allocation and distribution (grants, subsidies, incentives) * Compliance-aware transfers and vesting * Identity-gated participation * Real-time reporting and audit trails *** ### The Trust and Evidence Layer (Where Sign Protocol Fits) All three systems rely on a shared **trust and evidence layer** to record, verify, and query structured claims over time. This layer is implemented by **Sign Protocol**. Sign Protocol is an omni-chain attestation protocol that allows systems to define schemas and deposit verifiable data—called *attestations*—on-chain or via decentralized storage, while remaining easily discoverable and queryable. Without a shared trust layer like Sign Protocol, digital systems face the same fragmentation problems: 1. Data is scattered across contracts, chains, and storage systems. 2. Developers must reverse-engineer contract interfaces and data layouts. 3. Historical state changes are difficult to track consistently. 4. Indexing requires bespoke infrastructure for each application. 5. Auditing and inspection become manual and error-prone. Sign Protocol solves this by standardizing how structured data is defined, written, linked, and queried. *** ### How Sign Protocol Works Sign Protocol is composed of several interoperable components. <figure><img src="https://3152654701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw182g9YzR34mTxEBTKXX%2Fuploads%2Fgit-blob-16bbb84d5abe20ac7c3df3eff91e7db96a09c873%2Fsign-protocol-design.svg?alt=media" alt=""><figcaption><p>An architectural overview of Sign Protocol</p></figcaption></figure> #### Writing Data Sign Protocol organizes data into two core primitives: * **Schemas** — structured templates defining data formats * **Attestations** — signed instances of schema-conformant data Data can be written using three storage models: * Fully on-chain (EVM, Starknet, Solana, TON) * Fully Arweave * Hybrid (on-chain references + off-chain payloads) <figure><img src="https://3152654701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw182g9YzR34mTxEBTKXX%2Fuploads%2Fgit-blob-534ba24d6e1f009933cd92277c4dbd8d9c45e2e2%2Fstorage-solutions-for-data.svg?alt=media" alt=""><figcaption><p>Storage solutions supported by Sign Protocol</p></figcaption></figure> Fully on-chain and hybrid transactions can be initiated directly. Fully Arweave transactions are initiated through the Sign Protocol API. Once finalized, SignScan automatically indexes the data. #### Reading Data Data can be retrieved in two primary ways: * **Direct reads** from smart contracts and Arweave\ Suitable for low-level access, but limited in filtering and aggregation. * **SignScan APIs**\ SignScan is Sign’s indexing and aggregation service, providing REST and GraphQL APIs that unify data across all supported chains. It also powers the public explorer at <https://scan.sign.global>. This architecture allows developers, auditors, and operators to focus on system logic rather than data plumbing. *** ### How This Enables Sovereign Systems By combining: * standardized attestations (Sign Protocol), * identity-bound credentials (New ID), * programmable execution (New Money, New Capital), S.I.G.N. enables governments and regulated institutions to build systems that are: * **Privacy-preserving to the public** * **Inspectable by authorized parties** * **Composable across programs** * **Auditable by design** *** ### What’s Next? Depending on your role: * **Builders** can dive deeper into: * Sign Protocol smart contracts * SDKs and APIs * Indexing and querying * **System designers** can explore: * Use cases for Money, ID, and Capital * Reference architectures * Governance and deployment models Continue to: * Sign Protocol Documentation * Use Case Guides * Integration Tutorials # Fundamentals This article will help you understand the basic building blocks of Sign Protocol. <figure><img src="https://3152654701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw182g9YzR34mTxEBTKXX%2Fuploads%2Fgit-blob-6fb6f1302f120413acf3c351c3fff79517f38baa%2Fschema-attestation-erd.svg?alt=media" alt=""><figcaption><p>ERD demonstrating the relationship between schemas and attestations</p></figcaption></figure> ### Schema ```solidity struct Schema { address registrant; bool revocable; DataLocation dataLocation; uint64 maxValidFor; ISPHook hook; uint64 timestamp; string data; } ``` * `registrant`: The address that registered this schema. * `revocable`: Whether Attestations that adopt this Schema can be revoked. * `dataLocation`: Where `Schema.data` is stored. See [DataLocation](#datalocation). * `maxValidFor`: The maximum number of seconds that an Attestation can remain valid. 0 means Attestations can be valid forever. This is enforced through `Attestation.validUntil`. * `hook`: The `ISPHook` that is called at the end of every function. 0 means no hook is set. See [ISPHook](#isphook). * `timestamp`: When the schema was registered. This is automatically populated by `_register(...)`. * `data`: The raw schema that `Attestation.data` should follow. Since there is no way to enforce this, it is a `string` for easy readability. #### Notes * Utilize the [ISPHook](#isphook) to take payments. * Reverting from within the [ISPHook](#isphook) will revert the entire transaction, so the hook can provide additional checks and logic to validate attestation creation (for example, checking a whitelist). Use the `Attestation.extraData` field to pass in additional information that can be used from within the hook. ### Attestation ```solidity struct Attestation { uint64 schemaId; uint64 linkedAttestationId; uint64 attestTimestamp; uint64 revokeTimestamp; address attester; uint64 validUntil; DataLocation dataLocation; bool revoked; bytes[] recipients; bytes data; } ``` * `schemaId`: The `Schema` that this Attestation is based on. It must exist. * `linkedAttestationId`: Useful if the current Attestation references a previous Attestation. It can either be 0 or an existing attestation ID. * `attestTimestamp`: When the attestation was made. This is automatically populated by `_attest(...)`. * `revokeTimestamp`: When the attestation was revoked. This is automatically populated by `_revoke(...)`. * `attester`: The attester. * `validUntil`: The expiration timestamp of the Attestation. Must respect `Schema.maxValidFor`. 0 indicates no expiration date. * `dataLocation`: Where `Attestation.data` is stored. See [DataLocation](#datalocation). * `revoked`: If the Attestation has been revoked. It is possible to make a revoked Attestation. * `recipients`: The intended ABI-encoded recipients of this Attestation. This is of type `bytes` to support non-EVM recipients. * `data`: The raw data of the Attestation based on `Schema.schema`. There is no enforcement here, however. Recommended to use `abi.encode`. #### Notes * `attester` will be the caller of `attest()` by default. If a delegate signature is supplied with the call, `attester` will be the address found in the `Attestation` object supplied to the function instead of the caller of `attest()`. * `recipients` is an array of addresses. A single attestation can support many recipients. If no recipient is provided when an attestation is created, the `attester` is used. * `data` does not have any enforcement for what is supplied when an attestation is created by default. This validation can be performed in an [ISPHook](#isphook) on the schema. You can use `abi.encode` and `abi.decode` to perform the data handling, or use other functions like viem's `encodeAbiParameters` and `decodeAbiParameters` to work with the data in the frontend. ### ISPHook ```solidity interface ISPHook { function didReceiveAttestation( address attester, uint64 schemaId, uint64 attestationId, bytes calldata extraData ) external payable; function didReceiveAttestation( address attester, uint64 schemaId, uint64 attestationId, IERC20 resolverFeeERC20Token, uint256 resolverFeeERC20Amount, bytes calldata extraData ) external; function didReceiveRevocation( address attester, uint64 schemaId, uint64 attestationId, bytes calldata extraData ) external payable; function didReceiveRevocation( address attester, uint64 schemaId, uint64 attestationId, IERC20 resolverFeeERC20Token, uint256 resolverFeeERC20Amount, bytes calldata extraData ) external; } ``` A hook is registered for a specific schema. We will refer to this schema in the following definitions. * `didReceiveAttestation` - Called when an attestation is created for the schema. The second definition of this function is to take payments. * `didReceiveRevocation` - Called when an attestation is revoked for the schema. The second definition of this function is to take payments. ### Other Types #### OffchainAttestation ```solidity struct OffchainAttestation { address attester; uint64 timestamp; } ``` * `attester`: The attester. At this time, the attester must be the caller of `attestOffchain()`. * `timestamp`: The `block.timestamp` of the function call. #### Notes * `OffchainAttestation` is meant for true off-chain attestations where data is stored in other servers and a simple trace or record of the attestation is stored on-chain. This is distinct from the "Offchain Attestations" you can make from Sign Protocol's schema and attestation builders as these use schemas and attestations with data stored on Arweave, similar to how data is handled on-chain. #### DataLocation ```solidity enum DataLocation { ONCHAIN, ARWEAVE, IPFS, CUSTOM } ``` This enum indicates where `Schema.data` and `Attestation.data` are stored. #### Notes * A `DataLocation` that is not `ONCHAIN` means that an associated attestation will be a [Hybrid Attestation](/for-builders/advanced-topics/hybrid-attestations). The SDK handles this case for you, but if you are directly interacting with any of the Sign Protocol smart contracts, ensure that you are passing in the correct `data` values (encoded CIDs) when creating a hybrid attestation. # Tutorials # Building a Simple Notary Platform Through this tutorial, we will utilize direct interaction with the Sign Protocol [Smart Contract](/for-builders/index-1/index/index/index/isp), the [NPM SDK](/for-builders/index-1/npm-sdk), and the Indexing Service's APIs to query for attestations. ### Problem Statement: A Basic IRL Notary Platform For simplicity, let's assume that Bob needs to sign a contract physically and needs the signature notarized by a second person, Alice. With digital signatures, anybody can validate the signature using public keys, but for signatures in real life, this cannot be easily done. How can we be sure that Bob signed instead of another person forging his signature? Enter Alice, a trusted notary. Alice's whole job is centered around attesting that the person signing a contract is who they say they are. If people know they can trust Alice, they know that Bob did indeed sign the contract if Alice says so. We will implement a system where Alice can attest Bob's signature using attestations on Sign Protocol. ### Finished Code The finished code from this tutorial can be found [here](https://github.com/EthSign/sign-protocol-sdk-tutorial). # Schema Creation Creating a schema for a basic notary system. ## Understanding What We Need The first step to creating a successful schema is understanding exactly what data your application needs. Let's say, for our application, we want to store two things: * contractDetails: a string of text, corresponding to what Bob is signing * signer: an address, corresponding to Bob's account Note that the attester's address is automatically recorded in any attestation, so we do not need to store this in our schema. ## Creating the Schema Now that we
프로젝트로 돌아가기