Questions tagged [react]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

Payable function not working properly

Hi everyone hope I will be clear enough with the explanation because I couldn't find a proper solution. I am just trying to checkout an item with my buy function but it seems like I am stuck.Here is ...
1
vote
1answer
23 views

Both web3.eth.accounts.create() and web3.eth.personal.newAccount() not working

I'm making a dApp on reactjs. I wanted to create a new account and have done it trying 2 methods this.web3.eth.personal.newAccount() this.web3.eth.accounts.create() I have attached the code below(...
0
votes
1answer
21 views

getAccounts in web3 js undefined

I am working on dapp with web3js 1.0.0.37-beta with reactjs. I got blank in web3.eth.getAccounts. Following is my code App.js import React, {Component} from 'react'; import '../node_modules/...
0
votes
1answer
20 views

Code:const web3 = new Web3(window.web3.currentProvider) Error: window.web3 is undefined

I am going to connect my contract with the website.However,there was something wrong with the web3? I'm not sure. import Web3 from "web3"; const web3 = new Web3(window.web3.currentProvider); const ...
0
votes
1answer
35 views

Event emits multiple times on a solidity function call

I need have a problem, when I execute a solidity function, event emits multiple times, but when I refresh page then it works normally and only past events get called. Here is my code: ...
0
votes
0answers
18 views

How to use the ipfs.add() function?

Here is a function that I have written to add a file on clicking a button, which calls the function 'onSubmit' onSubmit = async (event) => { event.preventDefault() await ipfs.add(this.state....
0
votes
1answer
35 views

Why Web3 event callback fires multiple times same as the number of the solidity smart contract emitted that event in past?

I am just learning, solidity with react and web3 and I am facing the issue on page load the callback event of web3 called multiple time the number is same as I called a solidity function and that emit ...
2
votes
1answer
19 views

Uncaught (in promise) Error while opening and doing transaction on private ethereum blockchain using web3 and go-ethereum

I am trying to integrate a react app with go-ethereum using web3js. an event Onsubmit will do the following: 1. Create an account. 2. Open the account. 3. Approve a smart contract with the created ...
0
votes
0answers
16 views

Error using drizzle and react

My contract Storage.sol - pragma solidity ^0.5.0; contract Storage { string public data; function getData() view external returns(string memory) { return data; } function setData(...
0
votes
0answers
11 views

Getting error when importing, no error when using code in single file: Failed to execute 'postMessage' on 'Window'

I am trying to access the web3 object injected into my browser by Metamask. I am using custom rpc (). I can see my accounts and correct balances in Metamask. I have the following code: //web3.js ...
0
votes
0answers
32 views

uncaught error:invalid address

Uncaught (in promise) Error: invalid address at inputAddressFormatter (formatters.js:271) at inputTransactionFormatter (formatters.js:97) at method.js:89 at Array.map (<anonymous>...
0
votes
1answer
38 views

How to deploy a smart contract to actual ethereum network instead of Truffle or Ganache?

I am building a react application using web3 to interface with Ethereum. At a bare minimum, it needs to create a contract, deploy said contract, store a value (i.e. a string: "test"), then later ...
0
votes
1answer
24 views

How to print “string” from Solidity in React?

My smart contract function is : function sNName(uint z)public view returns(string memory) { return abc[xyz[z].name]; } Where abc represents a mapping (bytes32 => string) In my .js file, I ...
0
votes
3answers
62 views

How to call a smart contract function in a DAPP?

I am trying to make a DAPP. I followed this link - https://medium.com/@takleakshar/how-to-build-a-decentralized-full-stack-app-in-ethereum-and-react-42e63d45a208 This is how my 'Setup.js' looks. ...
0
votes
0answers
28 views

How to Access Value of Drizzle ContractData Method

I would like to access the value of a Drizzle ContractData method: this outputs: 1000000000: <ContractData contract={name} method="getValue" /> Now, ...
1
vote
0answers
56 views

How to use web3-react with truffle Dapp? any sample code / tutorial?

I am new to react and finding issues with the front-end of the Dapp application. Especially in web3 version > web3 1.0.0 I just heard about the web3-react and I think it will be a lot easier. I ...
1
vote
0answers
23 views

How to do loop all the metamask Accounts loop and display data from that address in React frontend + Dapp App JS [duplicate]

I want to Display data stored on the Ropsten Network in more then 2 metamask accounts. I want to display the result on the Home page in the table form. For that I need to loop through each ...
0
votes
0answers
28 views

How to get the value from the frontend form and save value to the blockchain using +web3 1.0.0-beta.37 + reactjs

I am writing my first Dapp and want to save the value of the form to the blockchain. I am Using React and web3 js 1.0.0-beta.37 on the frontend. Also I am new to react. Following is my App.js ...
0
votes
0answers
56 views

Can't resolve 'react' after installing additional dependencies to truffle react box

I am using a truffle box react - after truffle unbox react everything works fine Later however, after yarn add @material-ui/core I get an error: Can't resolve 'react' The same happens after ...
0
votes
0answers
12 views

How to console.log the value in the React js for the Dapp + truffle project

I am beginner with the ReactJS and Dapp. In my js page I want to get the value after doing some operation on the input value and want to dispay that result. I got the Nan in the front-end screen. ...
1
vote
1answer
42 views

No web3 instance injected following the dApp University Tutorials

I've been following Dapp University's videos on how to make IPFS uploads with Euthereum Smart contracts, and after I manage to 'npm run start' in the command line it opens up the HTML, but it always ...
1
vote
1answer
69 views

truffle unbox react - front end is unable to read / set state of the contract

I am experiencing problems with the Truffle React boilerplate code that the front end is unable to read / set state of the contract. Here are the details: I unboxed the React boilerplate using ...
2
votes
2answers
64 views

Metamask injects one account in web3, but calls contracts using another account

Building a React app, MetaMask injects web3, I get accounts[0] from getAccounts(), then pass it to my contract functions together with other parameters. I want my modifiers to lock incoming function ...
0
votes
1answer
32 views

Async getAccounts doesn't see my account

first time using MetaMask web3 Async getAccounts does not return my Eth account which I see in MetaMask. My fiddle https://jsfiddle.net/ysz11/qcv78h9z/1/ <!DOCTYPE html> <html> <...
0
votes
0answers
16 views

Web3NotFound Page rendering every time the drizzle-react DApp is refreshed

I'm trying to build a drizzle-react DApp. I want to implement a page called Web3NotFound.js which gets rendered when drizzle fails to find any web3 injected from MetaMask or Trust wallet browser. ...
0
votes
1answer
26 views

How to show the time when the blockchain contract called? [duplicate]

I want to show the time when blockchain contract called. I am currently saving the time in the blockchain using a method like this function userCheckIn(uint placeid) public { userCount++; ...
0
votes
1answer
37 views

How long does a smart contract typically take to complete?

I have been developing an application using a smart contract, the application is similar to this one: https://www.ethereum.org/crowdsale I went ahead and initiated a request, below is the codebase ...
1
vote
2answers
572 views

This contract object doesn't have address set yet, please set an address first

I am in the final stages of developing an application that is similar to https://www.ethereum.org/crowdsale, however, when I click on the create button, my Metamask modal is not popping up to ask me ...
0
votes
0answers
39 views

Smart contract hanging in react

I'm trying to make a call to my smart contract and write data to my blockchain, which is successful. However, after that completes I want to make an entry in a firebase database. The code appears to ...
0
votes
0answers
26 views

web3 provider is set to null when try to access for second time

Hello i have issue with my app. I'm using truffle unbox react envoirment. I have simple component which render form and on submit i want to redirect. After i go back to form web3 is null. Here are ...
0
votes
0answers
6 views

Web3 lose state when url is chaging in react

I have a strange issue with my web3. Once when app is load my web3 is configured correct. I have a form on which I can submit some data to my contract and everything works great, but when I try to ...
0
votes
1answer
51 views

No “from” address specified in neither the specified in neither the given options nor the default options

So I already went through this query, but I still couldn't get my doubt solved. Be it any Blockchain Dapp, the same error is coming for me. I used the marriage certificate and kickstart examples. Can ...
0
votes
1answer
38 views

Request user to sign state changing transaction with metamask using Infura and web3js

Can't seem to find the right function to ask the user to sign a transaction via metamask, this is my code so far: const bet = '102500000000000010' const account = '...
0
votes
1answer
63 views

web3-core-method.umd.js:1191 Uncaught (in promise) Error: Transaction has been reverted by the EVM:

Keep getting this error and really not sure what's causing it. Smart contract: contract BasaltStore { // struct of how a document will be stored struct documentStore { // unique id of the ...
2
votes
1answer
51 views

Calling payable state changing function on client side with metamask in ethereum infura testnet

I can't seem to find an answer for my problem, or it's either impossible and I'm missing something, or it's trivial and I'm missing something. I have this function on client side: const bet = web3....
1
vote
1answer
21 views

Blockchain Dapp

I am trying to develop a website for verification of certificates using React and Solidity. I have reached a stage where a student can request for a certificate but I want a notification to go to the ...
0
votes
1answer
72 views

How to prompt and create Smart Contract using React

Weird question, so I have created a smart contract, verified that it works, even deployed it using Web3, Metamask and HTML/Javascript. I understand that worked. Now I am trying to integrate it into ...
0
votes
0answers
42 views

Store data on ethereum block chain using react js

I'm trying to store data on ethereum blockchain by doing this import storemetadata from "./storemetadata"; where i have the smart contract ABI in storemetadata I now add name like so storemetadata....
0
votes
0answers
16 views

Error when calling Ethereum Contract

I am using a JS library which calls Solidity functions and I been getting the following error: 0x0c444aa3066f98d5f7ee576401e7729cb1113fe288d38711a78e48836313e88c App.js:112 TypeError: createLog is ...
1
vote
0answers
17 views

Adding additional info for initial state of Drizzle

How do I add extra content to the initial state of drizzle? I want to keep some local information that is not dependant on the blockchain. Should I keep a seperate redux store for that or is there a ...
0
votes
0answers
73 views

address.replace is not a function

I'm not really sure why this web3 method is being called in my code and why it's not a function apparently. Can anyone help me understand what the issue is here? Unhandled Rejection (TypeError): ...
0
votes
0answers
38 views

Getting value for Event watch in solidity and react

I'm trying to listen for an event in my smart contract when I call another function. Smart contract event event documentAdded( uint id ); Smart contract method function sendDocument( ...
1
vote
1answer
92 views

Drizzle CacheCall always returns null

I have set up drizzle to be able to connect to my smart contract from my react-application. After some fiddling, I decided to make this function in my smart contract: /*** test ***/ uint numberFive = ...
0
votes
0answers
75 views

How to keep user's selected account and network from MetaMask updated.?

So the question is pretty straight-forward. I can setup the web3 provider no problem (currently using Metamask + local ganache), i can access the acount the user selected in the first place, and i can ...
0
votes
1answer
119 views

should I use server side rendering(Next.js) for a dapp?

Recently I have been studying a lot about dapps and now working on a little complex one. So what I wanted to ask is which is better for a dapp ? SSR or CSR ? I have read in a couple of places that we ...
1
vote
0answers
120 views

metamask and infura - Managing and signing with private keys

I am using Infura as a node for my DApp so I need to send raw transactions by signing them. These transactions can come from multiple users of an application so each user must sign and send a raw ...
2
votes
0answers
103 views

Solidity get return variable from a send method in React

I'm trying to call a method that pushes data to my Blockchain and then returns back the ID of the new struct I created. This is how I'm calling the method in my React code: const documentId = await ...
0
votes
0answers
51 views

Release / Debug build generated json-rpc calls are different

I'm trying to make simple web3 calls in React Native with web3.js, but generated json-rpc calls are different between release / debug builds - IOS/Xcode. Expected behavior const web3 = new Web3(`...
1
vote
2answers
53 views

Can I trigger the execution of a js file from a smart contract?

I'm a noob at this, so excuse me if this is a ludicrous question.. I have a ReactJS app that interacts with a smart contract via web3. At a certain point, some data gets stored to the contract, by ...
1
vote
1answer
142 views

How to detect web3 of mobile wallets?

I am working on a react application and just can't catch the web3 object of mobile wallets. Catching web3 in Metamask works like a charm. Here's my code so far: componentDidMount() { window....