简体   繁体   English

在后端使用 web3.js 的最佳方式是什么?

[英]What is the best way to use web3.js on the backend side?

I am trying to create a web wallet application using "@solana/web3.js" for study purposes.我正在尝试使用“@solana/web3.js”创建一个 web 钱包应用程序用于学习目的。 The backend side is using PHP (Laravel).后端使用 PHP (Laravel)。

Which of the following is the best option on how to call web3.js on the backend side?以下哪项是关于如何在后端调用 web3.js 的最佳选择?

  1. Call it from PHP using the exec function like "node xxxxx.js使用 exec function 从 PHP 调用它,例如“node xxxxx.js

  2. Call node.js from PHP via curl, etc.从 PHP 通过 curl 等呼叫 node.js。

  3. Using web3.js from PHP is not a good idea (backend should be implemented in node.js)使用来自 PHP 的 web3.js 不是一个好主意(后端应该在 node.js 中实现)

  4. None of the above (Please tell me how to do that.)以上都不是(请告诉我怎么做。)

Maybe #4, look into ethereum's JSON RPC that web3.js wraps and call the endpoints directly from back-end.也许 #4,查看 web3.js 包装的以太坊的 JSON RPC,并直接从后端调用端点。

Your best bet will be to use a PHP package that can interact with Solana.最好的选择是使用可以与 Solana 交互的 PHP package。 There's a currently-deprecated-but-maybe-coming-back package that you can use at https://github.com/tighten/solana-php-sdk有一个当前已弃用但可能会回来的 package,您可以在https://github.com/tighten/solana-php-sdk使用

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

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