Categories
Cryptocurrency Ethereum Mastering Development

How to solve the problem: java.lang.RuntimeException: Error processing transaction request: VM Exception while processing transaction: stack underflow

I generated JAVA wrapper solidity code. I am trying to deploy my contract on our local Ethereum blockchain and and get the following error: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access […]

Categories
Cryptocurrency Ethereum Mastering Development

Why does my smart contract method fail when called via Web3.js with more than one argument?

Observation(s): When calling a compiled smart contract method via Web3.js, my contract method succeeds when the method only accepts (1) argument. Upon updating and re-compiling the smart contract method such that the method requires (2) arguments, calling the method with the required 2 arguments produces an error: `Error: Returned error: VM Exception while processing transaction: […]

Categories
Cryptocurrency Ethereum Mastering Development

how to transfer ERC20 token web3 1.26

After a lot of googling, I managed to send transaction. However, it did not send out any token. Check here : https://ropsten.etherscan.io/tx/0x4548b70a3ea76e36bc3a54e7bebdf3d9fa9eb472c1d7cdb4d0f6ab21ce0b4ca5 Can somebody point out my mistake? Below is my code const Web3 = require(‘web3’); const Tx = require(‘ethereumjs-tx’).Transaction; const provider = new Web3.providers.HttpProvider(“https://ropsten.infura.io/v3/cb65d0a6078042efb2ece5d50e587a07”); const web3 = new Web3(provider); let contractAddress = “0x20fe562d797a42dcb3399062ae9546cd06f63280”; let […]

Categories
Cryptocurrency Ethereum Mastering Development

sendRawTransaction error in web3.js

i am trying to send a request for my contract function to web3: my code snippets is here: const W3 = require(‘web3’); const express = require(‘express’); const ethTx = require(‘ethereumjs-tx’).Transaction; let web3, contractAddress, contractABI, contract, fromAdd, myData, estGasPrice; function connectContract(){ const provider = new W3.providers.HttpProvider(`${process.env.INFURA_ROPSTEN_ADDRESS}${process.env.INFURA_ROPSTEN_KEY}`); web3 = new W3(provider); contractAddress = process.env.LBT_CONTRACT_ADDRESS; contractABI =JSON.parse(process.env.LBT_CONTRACT_ABI); contract […]

Categories
Cryptocurrency Development Ethereum

How to send transaction using web3 contract instance from address which is not a node’s account

I succeeded creating transaction from node’s account(created by ganache) to a contract using web3.js . const contract = new web3.eth.Contract(abi, contractAddress, { from: from, gasPrice: 200000000 }); contract.methods.sendCoin(receiverAddress, ‘1’).send() // succeeded However, how to send transaction to a contract from address which is not node’s account. Does Contract Instance have any methods to sign transaction?? […]

Categories
Cryptocurrency Development Ethereum

Send transaction with locked contract -> Error: insufficient funds for gas * price + value

I’m trying to send a transaction for a token with a locked contract. I’m doing this to find out when this contract will be open. So I’m expecting to get some kind of error like “ERC-20 Token Transfer Error (Unable to locate corresponding Transfer Event Logs), Check with Sender” or something, but I get this […]

Categories
Cryptocurrency Development Ethereum

Error sending erc20 tokens

I try to send erc20 tokens in this way var Tx = require(‘ethereumjs-tx’); var Web3 = require(‘web3’) var web3 = new Web3(new Web3.providers.HttpProvider(‘https://mainnet.infura.io/v3/2a7d7b55629d44119f069a9239ea96fd’)) // set token source, destination and amount var myAddress = “” var toAddress = “” var amount = web3.utils.toHex(1e16) // get transaction count, later will used as nonce web3.eth.getTransactionCount(myAddress).then(function(v){console.log(v); count = v}) […]