简体   繁体   English

是否有最佳实践解决方案将草稿数据存储在 dapp 中的区块链之外?

[英]Is there best practice solution to store draft data out of blockchain in dapp?

I use ethereum platform for develop dapp.我使用以太坊平台开发 dapp。 And I need to store some draft data out of blockchain before push it to network.而且我需要先从区块链中存储一些草稿数据,然后再将其推送到网络。 In this case can I use smart contracts or store draft data in db or store it in localStorage.在这种情况下,我可以使用智能合约或将草稿数据存储在 db 中或将其存储在 localStorage 中。 Which solution is good?哪个解决方案好? Or there is something else solution for such case?或者这种情况还有其他解决方案吗?

If you are using a public Ethereum, then storing draft data on a smart contract will be expensive (since that means storing it on the blockchain).如果您使用的是公共以太坊,那么将草稿数据存储在智能合约上将会很昂贵(因为这意味着将其存储在区块链上)。 If this is a private Ethereum, then it depends on whether the draft data should be available only on the node where it was created or on all or some of the network nodes too.如果这是一个私有以太坊,那么这取决于草稿数据是否应该仅在创建它的节点上可用,或者也应该在所有或部分网络节点上可用。 Keep in mind that to reduce the size of data stored directly on the blockchain, you can use either a decentralized file system (IPFS, Ethereum swarm) for distributed data storage or cloud storage with only links to the data itself being transferred to the blockchain.请记住,要减少直接存储在区块链上的数据大小,您可以使用分散式文件系统(IPFS、以太坊群)进行分布式数据存储,也可以使用云存储,仅链接到传输到区块链的数据本身。

While the draft data can only be accessed by the site where it is created, the choice between a database and file storage is essentially a matter of taste and personal preference.虽然草稿数据只能由创建它的站点访问,但数据库和文件存储之间的选择本质上是品味和个人喜好的问题。 The size of the data — tens of bytes or megabytes — and the capabilities of the available database management systems can also be affected.数据的大小(数十字节或兆字节)以及可用数据库管理系统的功能也会受到影响。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM