Created at 1pm, Feb 22
gmGWJECHCrypto
1
dapps
lZxVFwsY_rO6QP7zPAT_H2XegQqFvdqSCpvfzVthThk
File Type
PDF
Entry Count
84
Embed. Model
jina_embeddings_v2_base_en
Index Type
hnsw
Equivalent pattern. The equivalent pattern is the simplest pattern. Developers design smart contracts separately, make them handle contract executions, and combine their functions in clients and/or servers. By only transactions on the blockchain, we cannot nd dependence among them. Like smart contract A, B, C deployed by different deployers, they dont send internal transactions to each other. But they support the DApp together. Factory pattern. In this pattern, a deployer deploys a smart contract and then make it deploy similar contracts to receive A Contract ExecutionDeployment Equivalent A1 Deployer Deployer Deployer C A B A2 Factory User User User Deployer S C Deployer A3 A B Leader-Member
id: ed68954366bf46f84e05fe244ad49f29 - page: 7
Fig. 10: Usage patterns of smart contracts. contract executions from user accounts. The process is like a factory producing products, so we call the pattern factory pattern. The smart contract deployed rst is the factory contract, and smart contracts generated by the factory contract are called child contracts. Figure 10 shows a case: deployer deploy smart contract A rst, and make it deploy A1, A2, A3. Then the three child contracts are able to be executed. Developers using the factory pattern can keep child contracts similar. This pattern is usually used in DApps from the category Gambling, whose developers use the factory contract to generate games with the same rules.
id: 98eb5976a65f2331b865bec768809aca - page: 7
By checking internal transactions and deployers of smart contracts, we nd leader-member pattern in 194 DApps and 199 smart contracts, equivalent pattern in 214 DApps and 1,539 smart contracts, and factory pattern in 28 DApps and 2,671 smart contracts. The leader-member pattern is not widely used. Developers are more likely to design independent smart contracts in functionality.
id: e937d4956a08348200b88606dd3470c7 - page: 7
VI. COST OF SMART CONTRACTS IN DAPPS The cost of smart contracts in DApps includes two parts: deployment cost and execution cost. Deployments and executions are done as transactions, which cost gas. Gas are paid with Ethers, and the amount of gas used is a measurement of the complexity of a contract execution. An account sends some gas in a contract execution, and then gets the gas left when the contract execution is conrmed. If the transaction has used all the gas sent from the initiator, the account receives an error information out of gas and lose all gas it sends. To lower the costs of deployments and executions is important. In Ethereum blockchain, total gas of a block is limited. A complex smart contract may cost too much gas so that it cannot be deployed, i.e., the block will not contain the transaction. In addition, the higher the contract execution costs are, the lower the throughput of contract executions, and the longer users wait for conrmations of executions.
id: 8cfda65f761ac3a2d4ea99af3931a5c4 - page: 7
How to Retrieve?
# Search

curl -X POST "https://search.dria.co/hnsw/search" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"rerank": true, "top_n": 10, "contract_id": "lZxVFwsY_rO6QP7zPAT_H2XegQqFvdqSCpvfzVthThk", "query": "What is alexanDRIA library?"}'
        
# Query

curl -X POST "https://search.dria.co/hnsw/query" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"vector": [0.123, 0.5236], "top_n": 10, "contract_id": "lZxVFwsY_rO6QP7zPAT_H2XegQqFvdqSCpvfzVthThk", "level": 2}'