Safe 백서

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

extensible smart contract account, designed to serve as the standard core utilized in all smart contract-based wallets and applications. Getting started Are you new to Safe and not sure where to get started? We recommend heading over to one of our tutorials . What is Safe? Tutorials Was this page helpful? Report issue ## /home/glossary Home Glossary Glossary This glossary contains terms and definitions used throughout the Safe documentation. Account Abstraction Account Abstraction is a new paradigm that focuses on improving the user experience when interacting with the blockchain by replacing the use of externally-owned accounts with smart accounts . Some Account Abstraction features are: Elimination of seed phrase reliance Ease of multichain interactions Account recovery Gasless transactions Transaction batching See also: Account Abstraction (opens in a new tab) on ethereum.org ERC-4337: Account Abstraction (opens in a new tab) on erc4337.io Bundler Bundlers are nodes that participate in the ERC-4337 standard who bundle user operations from an alternative mempool and submit them to the blockchain. Bundlers pay for the associated transaction fees in advance, which are later refunded by the user account who proposed the user operation or by a Paymaster . See also: Bundling (opens in a new tab) process on ethereum.org Bundlers (opens in a new tab) on erc4337.io EIP-1271 The EIP-1271 (opens in a new tab) is an Ethereum Improvement Proposal (opens in a new tab) that proposes a standard way for any contract to verify whether a signature on behalf of a given contract is valid. This is possible via the implementation of a isValidSignature(hash, signature) function on the signing contract, which can be called to validate a signature. EIP-712 The EIP-712 (opens in a new tab) is an Ethereum Improvement Proposal that proposes a standard for hashing and signing of typed structured data instead of just bytestrings. EntryPoint According to the ERC-4337 , the EntryPoint is the singleton smart contract that processes bundles of UserOperation objects sent by the Bundlers . It verifies and executes them by calling the target smart accounts according to predefined rules. See also: EntryPoint (opens in a new tab) on ethereum.org Bundlers (opens in a new tab) on erc4337.io ERC-4337 The ERC-4337 (opens in a new tab) is an Ethereum Request for Comments (opens in a new tab) that introduces a higher-layer pseudo-transaction object called UserOperation . Users send UserOperation objects into a separate mempool. A special class of actor called Bundlers package up a set of these objects into a transaction making a handleOps call to a special contract, and that transaction then gets included in a block. See also: ERC-4337 Documentation (opens in a new tab) on erc4337.io Externally-Owned Account An externally-owned account (also known as EOA) is one of the two types of Ethereum accounts. A private key controls it; it has no code, and users can send messages by creating and signing Ethereum transactions. See also: Ethereum Accounts (opens in a new tab) on ethereum.org Ethereum Whitepaper (opens in a new tab) on ethereum.org Gasless Transaction Gasless transactions (also known as meta-transactions) are Ethereum transactions that are executed by a third party called relayer on behalf of a smart account to abstract the use of gas. Users must sign a message (instead of the transaction itself) with information about the transaction they want to execute. A relayer will create the Ethereum transaction, sign and execute it, and pay for the gas costs. The main benefit is that users can interact with the blockchain without holding the native token in their account. See also: Relay Kit documentation on docs.safe.global Multi-signature A multi-signature account is a smart account that allows you to customize ownership and control structures according to your needs. Multiple externally-owned accounts can be designated as owners, and you can specify how many of those owners must approve a transaction before it is executed. Possible configurations: 0/0 Safe : An account with no owners, controlled entirely by Safe Modules . This configuration is typically used for automation or executing conditional functions within a protocol's architecture. 1/1 Safe : An account with a single owner who has full control and ownership. Ideal for setting up a smart account with a single EOA that can take advantage of all smart account functionalities. Warning: If the owner loses access to their private key, there is no way to recover the account. A recovery plan or an emergency mechanism to handle key loss should be set. N/N Safe : An account with multiple owners, all of whom must approve a transaction before it is executed. This setup is perfect for scenarios where equal ownership and responsibility among all participants are required. Warning: If any owner loses their private key, the Safe may become locked and unable to process transactions. A recovery plan or an emergency mechanism to handle key loss should be set. N/M Safe : An account with multiple owners, but only a subset of them is required to approve a transaction. This configuration is useful when you want to distribute responsibility while maintaining flexibility in decision-making. How does it work? Multi-signature is a function native to Safe smart contract. The contract stores the owners' addresses and the threshold needed to execute a transaction in the smart contract storage. When the user wants to perform a transaction, they send a payload containing the transaction details and the owners' signatures to the Safe account. The safe account iterates through the signatures to verify that the payload has been signed correctly and by the correct owners. Benefits: Enhanced Security : Reduces the risk associated with single points of failure, protecting your assets even if a key is lost or compromised. Customizable : Tailor each smart account to fit your specific needs, allowing you to set up configurations that work best for your particular use case. Interoperable : Flexibly assign a variety of signers as owners, including: Hardware wallets such as Leger (opens in a new tab) or Trezor (opens in a new tab) . Software wallets such as Trust (opens in a new tab) or Metamask (opens in a new tab) . MPC wallets such as Fireblocks (opens in a new tab) or Zengo (opens in a new tab) . Another smart contract account, such as Safe. Wallets generated via Social Logins or Passkeys. Upgradable : Easily adjust the number of owners and the signing threshold for your account whenever Key Rotation : Rotate ownership of any accounts at any time, maintaining security while adapting to changes. Shared Control : Grant shared access and control of your account to multiple individuals, ensuring collaborative management. Auditability : Maintain a transparent, auditable record of who signed each transaction and when providing clear accountability for all account activities. Network A blockchain network is a collection of interconnected computers that utilize a blockchain protocol for communication. Decentralized networks allow users to send transactions, that are processed on a distributed ledger with a consensus mechanism ensuring the batching, verification, and acceptance of data into blocks. This structure enables the development of applications without the need for a central authority or server. See also: Networks (opens in a new tab) on ethereum.org Owner A Safe owner is one of the accounts that control a given Safe. Only owners can manage the configuration of a Safe and approve transactions. They can be either externally-owned accounts or smart accounts . The threshold of a Safe defines how many owners need to approve a Safe transaction to make it executable. See also: OwnerManager.sol (opens in a new tab) on github.com Paymaster Paymasters are smart contracts that allow an account to pay for the gas fees of other users. This feature abstracts away the concept of gas fees by subsidizing them for users, allowing them to pay with ERC-20 tokens, and enables many other use cases. See also: Paymasters (opens in a new tab) on ethereum.org Paymasters (opens in a new tab) on erc4337.io Relayer A relayer is a third-party service acting as an intermediary between users' accounts and blockchain networks . It executes transactions on behalf of users and covers the associated execution costs, which may or may not be claimed. See also: Bundlers (opens in a new tab) on erc4337.io Relay Kit documentation on docs.safe.global Safe{DAO} The Safe{DAO} is the Decentralized Autonomous Organization (opens in a new tab) (DAO) that aims to foster a vibrant ecosystem of applications and wallets leveraging Safe accounts. This will be achieved through data-backed discussions, grants, and ecosystem investments, as well as providing developer tools and infrastructure. See also: Safe{DAO} Forum (opens in a new tab) Safe{DAO} Governance process (opens in a new tab) on forum.safe.global Safe{DAO} Proposals (opens in a new tab) on snapshot.org Safe{Wallet} Safe{Wallet} (opens in a new tab) is the official user interface to manage Safe accounts. See also: Getting Started with Safe{Wallet} (opens in a new tab) on help.safe.global Safe Apps Safe Apps are web applications that run in the Safe Apps marketplace. They support Safe, use the Safe Apps SDK to interact with it, and aren't owned, controlled, maintained, or audited by Safe. See also: Safe Apps SDK (opens in a new tab) on GitHub Safe Guard A Safe Guard is a smart contract that adds restrictions on top of the n-out-of-m scheme that Safe accounts offer. They make checks before and after the execution of a Safe transaction. See also: Safe Guards documentation on docs.safe.global Zodiac Guards (opens in a new tab) on github.com Get the enabled Safe Guard and enable a Safe Guard with the Safe{Core} SDK on docs.safe.global Safe Module A Safe Module is a smart contract that adds functionality to Safe while separating module logic from Safe core contracts. See also: Safe Modules documentation on docs.safe.global Safe Modules repository (opens in a new tab) on github.com Zodiac Modules (opens in a new tab) on github.com Get the enabled Safe Modules and enable a Safe Module with the Safe{Core} SDK on docs.safe.global Smart Account A smart account (also known as a smart contract account) leverages the programmability of smart contracts to extend its functionality and improve its security in comparison with externally-owned accounts . Smart accounts are controlled by one or multiple externally-owned accounts or other smart accounts, and all transactions have to be initiated by one of those. Some common features that smart accounts offer to their users are: Multi-signature scheme Transaction batching Account recovery Gasless transactions Safe is one of the most trusted implementations of a smart account. Transaction A transaction is an action initiated by an externally-owned account to update the state of the EVM network. Transaction objects must be signed using the sender's private key, require a fee, and be included in a validated block. A Safe transaction is a transaction sent to a Safe Proxy contract calling the execTransaction (opens in a new tab) method. See also: Transactions (opens in a new tab) on ethereum.org Threshold The threshold of a Safe account is a crucial configuration element that enables using Safe as a multi-signature smart account. It defines the number of required confirmations from the Safe owners a (Safe) transaction must have to be executable. See also: Get the threshold and change the threshold of a Safe with the Safe{Core} SDK on docs.safe.global UserOperation UserOperation objects are pseudo-transaction objects introduced by the ERC-4337 that users send to the UserOperation mempool. They wrap the users' transactions, and are sent to the EntryPoint contract by Bundlers . See also: UserOperations (opens in a new tab) on ethereum.org UserOperation mempool (opens in a new tab) on erc4337.io Wallet A wallet is an interface or application that gives users control over their blockchain account. Wallets allow users to sign in to applications, read their account balance, send transactions, and verify their identity. See also: Ethereum Wallets (opens in a new tab) on ethereum.org Tutorials Support Was this page helpful? Report issue ## /support Support If you have a question, chances are high that somebody else might have the same question, too. You help yourself and everyone who comes after you by asking your questions. Our Resource Hub also has links to resources that might answer your questions. Please help us respond faster by asking your question in the correct place. Safe Infrastructure For technical questions about Safe Smart Accounts (smart contracts), SDK, and the API, please ask your questions on our Stack Exchange. Safe Wallet For questions about the Safe Wallet - the web app and the mobile apps, please ask your questions at our Help Center. Report Bugs Please file an issue in the associated GitHub repository for things not working as expected and for reporting bugs. ## /home/ai-agent-quickstarts/introduction Home Quickstart Guides Introduction Quickstarts to set up your AI agent with Safe Smart Account In these pages you will find quickstart guides to set your AI agent up and running with Safe Smart Accounts. We describe these different setups: Basic Agent Setup : The simplest and fastest setup for your agent. Human Approval for agent actions : The AI agent proposes transactions, human signers approve and execute the transaction. Highest security, but not the fastest. Multi Agent Setup : Multiple Agents are signers of a Smart Account. They have to approve and execute each others transactions. Agent with a spending limit : An AI agent gets a spending limit on your treasury or DAO funds. This advanced setup allows fast transactions with a good amount of security. Support Setup your Agent with a Safe account Was this page helpful? Report issue ## /home/ai-agent-quickstarts/basic-agent-setup Home Quickstart Guides Setup your Agent with a Safe account Basic setup to equip your AI agent with a Smart Account Get started with Safe AI integration in just a few steps. This guide will help you set up a Safe Smart Account with the AI agent as the only signer. This 1-out-of-1 signer setup is discouraged by Safe, as it is not the most secure. However, many projects choose this setup for simplicity. Installation First, add the Safe Protocol Kit to your project: _ 10 import Safe from '@safe-global/protocol-kit' Creating a Safe Smart Account for your AI agent When your AI agent is ready to interact with the blockchain, you can create a Safe Smart Account for it. _ 16 import Safe from '@safe-global/protocol-kit' _ 16 _ 16 const SIGNER_ADDRESS = // ... _ 16 const SIGNER_PRIVATE_KEY = // ... _ 16 const RPC_URL = 'https://rpc.ankr.com/eth_sepolia' _ 16 _ 16 const safeClient = await Safe.init({ _ 16 provider: RPC_URL, _ 16 signer: SIGNER_PRIVATE_KEY, _ 16 predictedSafe: { _ 16 safeAccountConfig: { _ 16 owners: [SIGNER_ADDRESS], _ 16 threshold: 1 _ 16 } _ 16 } _ 16 }) This creates a Safe Smart Account, but the actual smart contract will be deployed when you send the first transaction. Introduction Human approval for agent action Was this page helpful? Report issue ## /home/ai-agent-quickstarts/human-approval Home Quickstart Guides Human approval for agent action Human approval for AI agent actions This page describes a setup, where an autonomous agent proposes transactions, and one or more human signers approve and execute the transaction. This setup benefits from increased security, as the Smart Account can not be compromised by convincing the agent to execute a malicious transaction. On the other hand, it can take minutes or hours to collect the necessary approvals, which reduces the agility of this setup. Setup the Smart Account For this setup, we recommend a 2-out-of-3, 3-out-of-5, or 5-out-of-7 threshold. The important considerations are: The AI agent should be one signer The threshold should be two more, so at least one human approval is required The amount of signers should be higher than the threshold to make sure the Safe Smart Account is functional when one key is lost Here is an example setup: Deploy Safe You can add the AI agent as a signer in the Safe Wallet (opens in a new tab) . You can also setup the Safe Smart Account programmatically like this using the Safe Protocol Kit : _ 16 import Safe from '@safe-global/protocol-kit' _ 16 _ 16 const AGENT_ADDRESS = // ... _ 16 const AGENT_PRIVATE_KEY = // ... _ 16 const HUMAN_SIGNER_1_ADDRESS = // ... _ 16 const HUMAN_SIGNER_2_ADDRESS = // ... _ 16 const RPC_URL = 'https://rpc.ankr.com/eth_sepolia' _ 16 _ 16 const newSafe = await Safe.init({ _ 16 provider: RPC_URL, _ 16 signer: AGENT_PRIVATE_KEY, _ 16 safeOptions: { _ 16 owners: [AGENT_ADDRESS, HUMAN_SIGNER_1_ADDRESS, HUMAN_SIGNER_2_ADDRESS], _ 16 threshold: 2 _ 16 } _ 16 }) Here, the AI agent creates the Safe Smart Account and adds two human signers for a 2-out-of-3 setup. The Smart Account will be deployed when the first transaction is executed. Assemble and propose a transaction The AI agent can now propose transactions. We recommend sending the transactions to the Safe Transaction Service . By this, you make sure that the transactions show up in the Safe Wallet interface and can easily be checked, approved and executed by the human signers. You can use the API Kit to propose transactions to the Safe Transaction Service. A simple example transaction to the zero address can be proposed like this: _ 31 import SafeApiKit from '@safe-global/api-kit' _ 31 _ 31 // How to get an Api key => http://docs.safe.global/core-api/how-to-use-api-keys _ 31 const apiKit = new SafeApiKit({ _ 31 chainId: 11155111n, _ 31 apiKey: 'YOUR_API_KEY' _ 31 }) _ 31 _ 31 const tx = await newSafe.createTransaction({ _ 31 transactions: [ _ 31 { _ 31 to: '0x0000000000000000000000000000000000000000', _ 31 data: '0x', _ 31 value: '0' _ 31 } _ 31 ] _ 31 }) _ 31 _ 31 // Every transaction has a Safe (Smart Account) Transaction Hash different than the final transaction hash _ 31 const safeTxHash = await newSafe.getTransactionHash(tx) _ 31 // The AI agent signs this Safe (Smart Account) Transaction Hash _ 31 const signature = await newSafe.signHash(safeTxHash) _ 31 _ 31 // Now the transaction with the signature is sent to the Transaction Service with the Api Kit: _ 31 await apiKit.proposeTransaction({ _ 31 safeAddress: safeAddress, _ 31 safeTransactionData: tx.data, _ 31 safeTxHash, _ 31 senderSignature: signature.data, _ 31 senderAddress: AGENT_ADDRESS _ 31 }) Approve and execute the transactions The transactions will now show up in the transaction interface of the Safe Wallet (opens in a new tab) . The human signers now have to connect their Metamask, and approve and/or execute the transactions with a click. They can also use the Mobile App (opens in a new tab) to sign the transactions. In the Safe Wallet, the human signers will see the transaction in the queued transaction view: And can either add a signature or execute the transaction when enough signatures were collected: Next steps Now your AI agent is equipped with a Safe Smart Account and you are in full control of the transactions. We are exited to see what you will build. If you have a technical question, feel free to reach out on Stack Exchange (opens in a new tab) with the safe-core tag. Setup your Agent with a Safe account Multiple Agent setup Was this page helpful? Report issue ## /home/ai-agent-quickstarts/multi-agent-setup
프로젝트로 돌아가기