简体   繁体   中英

Is frontend better or backend for integration with smart contract (erc721)?

I have developed my ethereum smart contract and I want to integrate it with my web application. But I don't know that is integration with ReactJS a better option or integration with nodejs a better one. Please give suggestions . Also I don't know how to do integration with backend through web3 library so please guide me about that.

When you are creating web3 app , most of the time you are not going to need a backend for that (Although you need a server to host your website) . Working with and managing smart contracts are very easy at the front-end and there is no need for backend, but if your working on a large scale project , you are definitely going to need a backend for handling complex logics .

Next js is best option for both of that , containing node and react , also no need for manually configuring web server.

Better is next.js. I explained it here: https://ethereum.stackexchange.com/questions/129547/next-js-versus-react-which-to-use-when-for-your-dapp/130040#130040

Not every browser has metamask extension. By using next.js, when our code is taken and rendered on the server, on the next server we can reach out to the Ethereum network and do some initial calls like data fetching, or alist of items in your smart contract. we execute all of those requests on the server. That means when next.js produces Html documents to send down to the user browser, it does not matter whether or not users are using metamask. It does not matter whether or not they have access to an Ethereum network. Because we already take care of the data fetching for them. So all the users out there who are not using metamask are going to see some information on the screen.

You've mentioned that you don't want to switch technologies, and while I agree with NextJS being a good platform to develop dApps on, I suggest you just use your current NodeJS server for anything that isn't web3 related and you use the web3js library from the frontend (your React) which would be very similar to a NextJS app anyway.

This way you don't have to switch technologies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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