All Questions
Tagged with javascript dapps
52 questions
1
vote
1
answer
23
views
How to securely interact with a smart contract using Web3.js?
I'm currently developing a decentralized application (dApp) on the Ethereum blockchain, and I'm using Web3.js to interact with my deployed smart contract. Here's the setup I have so far:
My smart ...
0
votes
0
answers
57
views
Is it normal that RPC provider will return error message but transaction is actually successful?
I am currently new here at blockchain. I am currently using a subscribed private rpc ankr and Moralis. So, it is normal that rpc will return us some errors but transaction still manages to be made ...
0
votes
2
answers
249
views
Callback After Dapp Approval
I have had a contract made for me, and a dapp set up by a developer.
My question is how can i produce an event on my website when the user has approved spend of a certain token?
Can i use a javascript ...
0
votes
1
answer
20
views
Help with “web3 not defined”
I am cloning a tutorial https://github.com/techaddict0x/liquidityminer
And when I run the debug console I get the error “web3 is not defined”
The code is the exact same, looked all over the internet ...
2
votes
2
answers
2k
views
How to detect the specific wallet provider used by the user in a web3 dapp when multiple wallet providers are installed?
I want to detect which wallet provider has been used to connect to a specific dApp.
right now what I'm doing is
const ethereum = window.ethereum;
const web3 = window.web3;
if (ethereum && ...
1
vote
0
answers
42
views
Unknown error when running the project [closed]
While deploying my application, I get the following error. I have tried some solutions but none has worked.
Link to the code repository: https://github.com/Demiladekusa/Evoting-dapp
This is the error ...
1
vote
0
answers
22
views
Trying to run a javascript test through Truffle. Truffle is not able to read the javascript file or I cannot understand the issue here
I am trying to run truffle test to test a javascript file on windows through powershell. The results keep showing a syntax error on the first character of the .js test file after compiling all ...
0
votes
1
answer
11
views
Can I use Aragon's UI components when building dapps on top of aragonOSx?
I want to build my own custom DAO dapp on top of the new Aragon protocol, but would love to not have to create an entire new UI for it.
I was wondering if I could use Aragon's UI components to build ...
1
vote
1
answer
1k
views
UniSwap v3 SDK ERROR creating new Pool class with Tick[]
I have a question regarding the SDK, I am using subgraph to pull data for each pool and using to create a pool class in JS, when I pass the Tick[] or create a TickListDataProvider I keep getting this ...
3
votes
2
answers
5k
views
Error: could not detect network
I am currently trying to deploy my DApp 'nftmarketplace' to the net using Vercel on the Goerli test network. However the app is failing to connect to the blockchain and I am getting the following ...
1
vote
0
answers
280
views
How to get solidity custom errors on dApp?
I would like to get the custom error code from my dApp, however, I can't get it when the smart contract is using revert. However, I can get the error reason when the solidity contract use required.
Ex....
1
vote
0
answers
227
views
How to integrated javascript /web 3 into wordpress?
hello everyone i use wordpress for website developement and right now i developping a web3 app and i would to know how can i integrated the script to wordpress element (button etc ).
Should i develop ...
0
votes
1
answer
1k
views
Uncaught TypeError: Cannot read properties of undefined (reading 'getInfo') at index2.js:20:20
i am going to call a smart contract method in web.js ( i am using legacy web.js)
my solidity code as follow :
pragma solidity 0.5.4;
contract Register {
string private info;
function setInfo(...
1
vote
1
answer
454
views
Calling a solidity function without a wallet using ethers.getDefaultProvider
I am trying to call a function from my solidity contract which shows how many nfts have been minted so far, I want the front end user to be able to see the number even if they don't have a wallet in ...
2
votes
1
answer
2k
views
wallet_addEthereumChain is not working in metamask android app
I am using wallet_addEthereumChain RPC function to add the custom network in metamask android app through our Dapp but it is showing an error wrong chainid. The chainid(80001) is correct and the code ...
1
vote
1
answer
760
views
How to Parse the Data Returned by a Solidity Function
I have the following solidity code, to get the data that has been mapped to an address,
function showOrg(address org) external view returns(uint identifier, string memory organization_name, bool ...
0
votes
3
answers
35
views
Is there a must use framework to design dapps that works well with Truffle?
I am trying to develop a dapp that works on a web browser that will also contain a website made in a popular UI framework (let's say angular) rather than building a html/css manually.
Right now I'm ...
1
vote
2
answers
1k
views
I am getting Returned error: VM Exception while processing transaction: invalid opcode error
I am getting an Invalid Opcode error while calling the refundAmount function which will refund the amount to the customer and cancel his/her ticket bookings. registrations is a structure mapping and ...
3
votes
1
answer
868
views
Where can i find a documentation of all `wallet_` RPC calls?
Looked everywhere, and all I can find are a bunch of EIPs. Is there a document/repo somewhere listing all available RPC calls that interact with the wallet (wallet_...)?
Specifically, I'd like to ...
1
vote
1
answer
61
views
Is there any advantage or disadvantage of using javascript over solidity when building dapps on etherum?
I am aware that there are libraries that let you build dapps on ethereum. What are the pros and cons of using javascript over solidity for dapps. I know this might sound like a partly subjective ...
1
vote
1
answer
3k
views
Create new account in ganache
I'm creating a Dapp which provide the user with individual account. while developing, when i create a account by
const accounts = await web3.eth.personal.newAccount('test');
the account is created ...
0
votes
1
answer
431
views
Uncaught (in promise) TypeError: work.methods.workCount is not a function
Describe the bug
I am trying to call the public variable "workCount" from a smart contract using web3
Steps to reproduce:
const work = new web3.eth.Contract(ABI,Address)
const workCount = ...
0
votes
1
answer
1k
views
error comparing numbers in smart contract (Big Number)
I am unable to understand when all do we need to convert numbers to bigNumbers for asserting to be equal. In some cases by mistake i missed to convert integer variables to bigNumber and they worked ...
0
votes
1
answer
47
views
Time-dependent test unexpected behavior at 1st attempt, expected behavior at 2nd attempt
I'm trying to test a contract in which functions should require certain timestamps. Parts of code are eliminated for readability:
Here's the problematic part of the contract :
PCE_Contract.sol
pragma ...
0
votes
1
answer
1k
views
Uniswap V2 smart contract keeps getting reverted in JS
I'm trying to swap tokens using Uniswap v2 interface.
The code of the contract is here.
I'm able to deposit Eth to the contract and but I'm not able to invoke the swapEthForTokenWithUniswap() ...
1
vote
0
answers
489
views
Ether transaction does not reflect in ganache
Hi am developing a etherium DAPP.
In that for every user registration some ether will get transfer from user to contract...
Everything work perfect but the transacted ether is not reflecting in ...
0
votes
0
answers
308
views
Just not able to install Web3 through powershell
After reading a lot of articles about how to install Web3j in windows.
I also tried following this article : https://kauri.io/generate-a-java-wrapper-from-your-smart-contract/...
0
votes
1
answer
296
views
How to call external payable contract function from app.js (DApp)?
The contract has a function:
function purchaseTokens() external payable {
require(msg.value>0);
...etceteras...
}
What I need is an app.js part, something that would look like this (lets ...
0
votes
2
answers
56
views
Is it possible to instantiate a deployed contract in js using contract address alone? without copying abi data?
Is it possible to instantiate a deployed contract in js(dapp) using contract address alone? without copying abi data?
2
votes
0
answers
174
views
How shoud I properly initialize DApp and get account address?
I am writing DApp in react, and basically I want to initialize web3, unlock account, and display it. Having web3 in my package.json In the onload I've tried to go following:
let Web3 = require('web3')...
0
votes
1
answer
2k
views
Web3: web3.utils is undefined
I am kinda new to Ethereum and Web3 so I am trying to implement the Ethereum: Building Blockchain Decentralized Apps (DApps) tutorial.
I have already installed web3 and web3-utils.
npm view web3 ...
0
votes
1
answer
651
views
Solidity Vs JavaScript?
I'm currently in the process of writing a game however a question has popped up in my head.
A while back I started writing my game in Solidity (i.e the characters, names, stats etc.) and I had ...
1
vote
1
answer
2k
views
Ethers js adding provider
I have an app I am working on implementing ethers.js. There are two methods I am using to create a wallet: new ethers.Wallet(privateKey, provider); and new ethers.Wallet.createRandom();
With creating ...
0
votes
1
answer
1k
views
Calling a "view" function using web3js
--- HEAVILY EDITED ---
Solidity contract:
pragma solidity ^0.4.24;
contract PatientRecords {
struct Patient {
string ID;
string weight;
string height;
string diseasehistory;
...
0
votes
1
answer
469
views
Adding quotation marks to string before calling a function [closed]
Alright, so I'm not sure if I should be asking this here or HTML/JavaScript forums, so please do let me know if I am in the wrong place. I believe it belongs here as you all understand dApps and ...
1
vote
2
answers
2k
views
MetaMask Web3 object does not support synchronous methods without a callback parameter [duplicate]
I'm new around here and would appreciate some intuitive help.
I wrote a contract and made a UI for it, and it's all working fine with ganache-cli. However, now that I've launched it on Ropsten and on ...
0
votes
2
answers
470
views
ERC721 Dapp not working, not showing token owner
So I am building a Dapp to interact with an ERC721 contract. So far I'm able to mint, transfer and check an address balance. I'm stuck with trying to show who owns which token( via their token id). ...
4
votes
1
answer
930
views
Is it possible to check a token transaction history for an account with web3js?
If I have an account that has sent and received specific tokens, say ExampleToken (EXT), can I use web3js to see a list of EXT transfers and receipts for my address (or any other address)?
I am ...
1
vote
1
answer
2k
views
WEB3.JS How do I configure a payable function front end with the input (DAPP)
I am trying add the front end part of a payable function using web3.js (And just vanilla JavaScript, no other libraries).
Here is the solidity function:
function deposit() public payable {
...
1
vote
0
answers
149
views
Toshi browser vs. Google Chrome browser to interact with Dapp?
Toshi is a browser to interact with Dapps such that after uploading our Dapp (including solidity smart contract, Javascript and HTML code) on a server, we can search our Dapp using its URL (ex: www....
0
votes
2
answers
226
views
JavaScript for Dapp
Can the following libraries and frameworks be used to build the Client-Side of DApps ?
Specially
Ember
Backbone
Aurelia
Polymer
jQeury
0
votes
0
answers
389
views
In truffle Console Works, but when called in Javascript, Metamask hangs, Solidity contract doesn't update
So I have a function where I am asking the user to send two strings and 1 ether at the same time. When I execute the function in the console, the solidity contract is updated. When I execute the same ...
3
votes
3
answers
18k
views
How to generate Private key, public key and address
I can't find any documentation online about doing this in Javascript other than this.
I want to know how does authentication work in a ethereum dApp's.. As per my understanding user seed somehow gets ...
2
votes
1
answer
587
views
Watch pending transactions with ethjs.js
I am trying to use ethjs.js to listen to pending transactions, but nothing really worked. Does anyone have a working example fetching pending transactions with ethjs.js?
I have tried the following:
...
0
votes
3
answers
473
views
Cannot get value from calling constant function with web3js and Metamask
I have an extremely basic contract deployed on Ropsten:
pragma solidity ^0.4.16;
contract hypergrowth {
uint256 public someNumber = 5;
function hypergrowth() public {}
function changeNumber(...
1
vote
1
answer
411
views
Update dapp after contract transaction is mined
I made a web app that interacts with a smart contract, using truffle unbox webpack. My contract has a variable called sum and 2 functions: one called answer that increments the sum variable after it ...
35
votes
7
answers
50k
views
web3.eth.contract is not a function when making contract
Whenever I try and make a contract, I get:
web3.eth.contract is not a function
I'm using this code:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
...
16
votes
6
answers
16k
views
How can dapps work on smartphones?
How can dapps on mobile web browsers interact with web3.js?
Is there any tool like Metamask or Mist on the roadmap for mobile?
1
vote
1
answer
675
views
Using Bootstrap with Truffle
I'm having trouble getting bootstrap working with my truffle dapp. The logs show the build going through OK, but when I truffle serve it and open it in the browser it complains that "Bootstrap's ...
1
vote
1
answer
3k
views
How to map a web3 to a react.js state
How would you map a changing variable from web3 to react.js component?
Example:
class App extends Component {
constructor(props){
super(props);
this.state = {
blockNumber: web3.eth....