在EOS区块链上存储数据的最佳方法是什么?

时间:2022-09-14 16:57:07

I come across a situation where i need to implement a relational database for an application. Now my question is how to implement it and where should i save the data? also i don't want to save data on RAM as it get very expensive when data size grows.

我遇到了一种需要为应用程序实现关系数据库的情况。现在我的问题是如何实现它以及我应该在哪里保存数据?我也不想在RAM上保存数据,因为当数据大小增加时它会非常昂贵。

2 个解决方案

#1


2  

A good way would be to use the demux-js library. It listens for specified actions and allows updating logic for whatever kind of database you like. This is a RAM free option which essentially allows you to achieve CRUD functionality by creating a mirror image of what the blockchain would show if you played through all of your actions.

一个好方法是使用demux-js库。它侦听指定的操作,并允许更新您喜欢的任何类型的数据库的逻辑。这是一个无RAM选项,它实际上允许您通过创建一个镜像来实现CRUD功能,如果您完成了所有操作,则会显示区块链显示的内容。

Mind the mess, but you can see me implement demux here.

记住这个烂摊子,但你可以看到我在这里实现demux。

#2


1  

Another option is to use eosio mongodb_plugin for archive blockchain log into mongodb by running a node then apply queries on it.

另一个选择是通过运行节点然后对其应用查询,将eosio mongodb_plugin用于存档区块链日志到mongodb。

https://developers.eos.io/eosio-nodeos/docs/mongo_db_plugin

https://developers.eos.io/eosio-nodeos/docs/mongo_db_plugin

@Nat i need your opinion about that option.

@Nat我需要您对该选项的看法。

#1


2  

A good way would be to use the demux-js library. It listens for specified actions and allows updating logic for whatever kind of database you like. This is a RAM free option which essentially allows you to achieve CRUD functionality by creating a mirror image of what the blockchain would show if you played through all of your actions.

一个好方法是使用demux-js库。它侦听指定的操作,并允许更新您喜欢的任何类型的数据库的逻辑。这是一个无RAM选项,它实际上允许您通过创建一个镜像来实现CRUD功能,如果您完成了所有操作,则会显示区块链显示的内容。

Mind the mess, but you can see me implement demux here.

记住这个烂摊子,但你可以看到我在这里实现demux。

#2


1  

Another option is to use eosio mongodb_plugin for archive blockchain log into mongodb by running a node then apply queries on it.

另一个选择是通过运行节点然后对其应用查询,将eosio mongodb_plugin用于存档区块链日志到mongodb。

https://developers.eos.io/eosio-nodeos/docs/mongo_db_plugin

https://developers.eos.io/eosio-nodeos/docs/mongo_db_plugin

@Nat i need your opinion about that option.

@Nat我需要您对该选项的看法。