Questions tagged [truffle]
Questions regarding the implementation and use of the Truffle development and testing environment.
2,925
questions
0
votes
1
answer
20
views
Truffle test error "VM exception" ERC721
I have just created a .sol contract inheriting from openzeppelin ERC721. I have also written some tests, but I get the following errors:
Here is the code for .sol file:
// SPDX-License-Identifier: ...
0
votes
0
answers
16
views
Runtime error webpack-dev-server, solidity, openzeppelin
I'm working on a project using Truffle, solidity and openzeppelin. For web, I'm using the webpack-dev-server.
With Truffle, everything works, it compiles and migrates. Then I start the frontend with ...
1
vote
0
answers
26
views
Truffle Test Executed with 0 passing
I am new to blockchain and trying to learn blockchain using Etherium environment with ReactJS. For learning purpose, I am following below link:
https://www.dappuniversity.com/articles/blockchain-...
0
votes
0
answers
30
views
Smart contract is compiled but not deployed to ganache
I am developing a DAO Dapp, but when I run truffle migrate --reset, the contract compiles but does not get deployed to Ganache. There are no deployment details shown in the console, and the contract ...
0
votes
0
answers
25
views
Error: Expected private key to be an Uint8Array with length 32 contract
Error: Expected private key to be an Uint8Array with length 32
at assert (D:\sample-e-voting-system-ethereum\blockchain\node_modules\secp256k1\lib\index.js:18:20)
at isUint8Array (D:\sample-e-...
0
votes
0
answers
17
views
Error: *** Deployment Failed *** "IdentityVerification" -- unknown account. Migrating a smart contract on Truffle connecting to Geth nodes
I have created a test blockchain network and created a smart contract for validators to verify members, which I am trying to deploy with truffle.
A bootnode serves as the Host on the main network:
...
0
votes
0
answers
11
views
eth_getBlockByNumber loop in truffle genache
When writing contracts and testing them with truffle develop, I like to have two terminals:
truffle develop --log
truffle develop
One is for logs so I see what is happening and in another one I test. ...
0
votes
0
answers
20
views
Uncaught ReferenceError: handleRegistration is not defined at HTMLButtonElement.onclick
I have created and deployed a smart contract for IP management using truffle. I have created a frontend to interact with this deployed contract.
<head>
<meta charset="UTF-8">
...
1
vote
2
answers
101
views
Ganache alternative in docker
After the Sunset of Truffle and Ganache . Are they already some alternative to the Ganache docker image https://hub.docker.com/r/trufflesuite/ganache with enabled persistent data for local development ...
1
vote
1
answer
35
views
truffle console doesnt work: Unexpected error setting up the environment or provisioning contracts while instantiating the console
(base) ➜ METoken truffle console
bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
Unexpected error setting up the environment or provisioning contracts ...
1
vote
0
answers
49
views
Truffle deployment Failed " hit an invalid opcode while deploying."
This is a token maker code, so its failing to deploy with the following reason:
> *** Deployment Failed ***
"TokenMaker" hit an invalid opcode while deploying. Try:
* Verifying that ...
0
votes
0
answers
11
views
Truffle debugger can't connect to node
I'm trying to debug a contract. I have ganache open forking the Ethereum mainnet that uses in the settings the same host and port as my truffle-config.js (127.0.0.1:7545).
I can migrate/deploy and ...
0
votes
0
answers
10
views
DNS using blockchain (how can i hashed my domain name ) in the code below help me to complete this code
import Web3 from "web3";
import Registry from "./contracts/Registry.json";
import Resolver from "./contracts/Resolver.json";
import Cache from "./contracts/Cache....
0
votes
1
answer
17
views
Wrong type of smart contract being instantiated on using new keyword
I have 2 smart contracts A and B that I have defined in the same file.
B is used to instantiate A using the new keyword.
However, when I try to interact on Remix with the newly instantiated contract ...
0
votes
0
answers
32
views
Truffle ganache debug not working
I have installed truffle and ganache and the @ganache/console.log library.
Furthermore, I have the following contract from an online course which serves as an example to demostrate the debug mode of ...
0
votes
1
answer
663
views
HOW TO SET UP TRUFFLE CONFIGURATIONS FOR SEPOLIA ETH
** HOW TO SET UP TRUFFLE CONFIGURATIONS FOR SEPOLIA ETH **
I want to know how to set up my config on truffle to be able to deploy my contract on the eth testnet, I already have an infura api key
0
votes
0
answers
48
views
Truffle migration error Network up to date
module.exports = {
networks: {
sepolia: {
provider: () => new HDWalletProvider({
mnemonic: {
phrase: MNEMONIC
},
privateKeys: private_keys,
...
1
vote
0
answers
17
views
Why are my exceptions rendered differently after versions update?
I don't remember the previous versions I was using but I remember upgrading because I hoped to have a local test network (via Ganache) supporting EIP-1559. My versions are:
Truffle v5.11.5 (core: 5.11....
0
votes
1
answer
46
views
Solidity Smart Contract Behaving Weird on Goerli Testnet
I have a vite-project in typescript that I want to have eth deposit and withdrawal capability.
I'm new to the crypto space and trying to implement a simple wallet contract using Truffle on the ETH ...
0
votes
0
answers
15
views
Why does truffle test break my migrations?
I have created a deployment script for an upgradable token contract which takes a flag from the command line for the deployment type.
I type...
truffle migrate --reset --type initial
truffle migrate --...
0
votes
0
answers
29
views
How Remix IDE compiles smart contract code to ABI and bytecode?
I am building a DApp where user uploads his smart contract code file and his smart contract gets deployed using his private key ( After he connects his metamask account to the DApp ) . How RemixIDE is ...
1
vote
0
answers
32
views
Truffle migration of an ownable contract
Initially, I deploy everything using REMIX IDE, currently I would like to try to deploy a contract that is ownable into local ganache blockchain using truffle migration:
pragma solidity ^0.8.18;
...
0
votes
1
answer
30
views
Controlling Contract
Using truffle and makes me use truffle console but I dont want to and wouldnt either. Is there any other way interact with contracts and controlling their propreties and everything with an app or ...
0
votes
0
answers
17
views
Transaction gets reverted when using send web3 function in angular
I am using [email protected] to access my ganache blockchain through localhost. I am new to dapp development and I'm trying to call a function that updates the ganache blockchain through web3 in angular. I ...
1
vote
0
answers
110
views
RuntimeError: VM Exception while processing transaction: revert\n at EIP1559FeeMarketTransaction.fillFromResult
I've been working on a smart contract in Solidity, the code shown below:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
...
0
votes
1
answer
91
views
Perplexing issue: Ownable: caller is not the owner'
i am a new developer and i am struggling with an issue since two weeks now and can't get to the bottom of it.
Here is some context: I have two smart contracts, one minting an NFT and the other issuing ...
0
votes
1
answer
65
views
Identifier not found or not unique. using SafeMath for uint
I keep getting this error when I try to run my contract on truffle....(Identifier not found or not unique. Using SafeMath for uint). Truffle v5.1.39 (core: 5.1.39)
Node v14.19.0
Below is the contract ...
1
vote
0
answers
49
views
How to get transaction fees and minus it from balance
I created an auction exchange smart contract using solidity programming language and I am using ganache for testing this is a test file written in JavaScript. seller is the creator of auction and ...
0
votes
0
answers
103
views
When sending a transaction using web3 I recive EIP1559FeeMarketTransaction.fillFromResult error
I am using a ganache local blockchain and truffle to test my smart contracts, this problem started to occur all of a sudden, since before I wasn't running into this problem.
So when I call the ...
0
votes
1
answer
26
views
Metacoin - why does `send` show the contract address in `receipt.to`?
I've recently started learning web3 and am playing with truffle.
truffle(develop)> truffle migrate
...
Deploying 'MetaCoin'
--------------------
> transaction hash: ...
0
votes
0
answers
17
views
How to find issue with a bare bone token bridge
Basically, I want to setup a very simple token bridge try to bridge some custom tokens between BSC testnet & Goerli testnet.
For BSC testnet, I created 2 solidity code: TokenBSC.sol & ...
1
vote
0
answers
41
views
Truffle console: debug not showing me the code line that reverts a transaction
I'm trying to deploy my own swap router on the development network. I've got a transaction hash which reverts. I'm calling
truffle console
and then, when I press enter I get undefined. I can't reach ...
1
vote
1
answer
32
views
VM Exception while processing transaction: revert while buy token
I built a token based on ERC20, when I try to buy tokens I get this error
In the truffle console
Quinn.deployed().then(function(ins){token=ins}) QuinnSale.deployed().then(function(ins){tokenSale = ins}...
1
vote
0
answers
26
views
Mainnet fork deployment - Error: *** Deployment Failed *** "Migrations" hit an invalid opcode while deploying
I am trying to deploy contracts on a mainnet fork. I have my fork running with the command
ganache --fork https://mainnet.infura.io/v3/$INFURA_API_KEY --wallet.unlockedAccounts=$MY_ACCOUNT --chain....
1
vote
1
answer
2k
views
Got `invalid opcode` when deploying a contract to Ganache test network from Truffle
I have launched Ganache 2.7.1 in Mac and using truffle 5.11.3. I tried to deploy below contract to Ganache but filed:
helloworld.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;
...
1
vote
0
answers
18
views
Can't pass Truffle test with an uint256 array as event property
I have this simple test in truffle:
it("should emit the correct Transfer event", async function() {
await this.contractNFT.multiSafeMint(accounts[0], "CID/metadata.json", 3, {...
1
vote
1
answer
108
views
Problems installing truffle
I've installed truffle multiple times, uninstall and installed again, all I get is command not found
npm install -g truffle
npm WARN deprecated [email protected]: testrpc has been renamed to ganache-cli, ...
-1
votes
1
answer
92
views
how can i deploy my Dapp?
what if I have deployed my smart contract on truffle and used ganache to deploy the same and i havn't used any test network, so if I go to deploy it on netlify to demonstrate the same will it work??
2
votes
1
answer
23
views
Truffle console: How to print uint array
How to print uint array in Truffle's Java script environment?
Hi,
I am following the link:
Printing uint256 value to console while debugging with Truffle
I am working on truffle console environment ...
1
vote
1
answer
861
views
ERC20 transfer amount exceeds balance error in Solidity contract
I'm encountering an error while trying to transfer tokens from one address to another in my Solidity contract. When I attempt to print the balance of msg.sender, it shows a value of ...
1
vote
0
answers
9
views
In truffle, why are the accounts in testing different from the actual accounts of my mnemonics?
Say, the first account from my mnemonic yields 0x123, how come account[0] from accounts in the Truffle test suite differs from the original?
Example:
const BatchTransfer = artifacts.require("...
0
votes
1
answer
917
views
Cannot read properties of undefined (reading 'address') when trying to use 'truffle run verify'
I have successfully deployed my contracts to the goerli testnet but for some reason, I am not able to verify my contracts using "truffle-plugin-verify". I have added the following keys to ...
0
votes
0
answers
40
views
Are accounts on Ganache Blockchain considered Nodes?
I wanted to ask a question: the accounts on Ganache are nodes, for example
I mean, if I am in the project, I let the account send the transaction to another account
This process considers that you are ...
1
vote
1
answer
642
views
"Migrations" hit an invalid opcode while deploying [duplicate]
I do not understand why this is happening, I have tried many solutions, but still without effect.
Updating the truffle version did not help.
truffle migrate --reset
1_initial_migration.js
=============...
0
votes
1
answer
159
views
Truffle migrate Error: PollingBlockTracker
I'm trying to deploy a contract on Avalanche Fuji testnet using Truffle. Here is my truffle config:
require('dotenv').config();
const mnemonic = process.env["MNEMONIC"];
const infuraUrl = ...
1
vote
0
answers
18
views
IP host management in truffle_config.js (Private Ethereum Network)
I have 3 Amazon Ec2 instances (each with a Geth node running on them) and I'm running over them my Private Geth Ethereum (PoA) blokchain and I wanted to ask if it was necessary to specify the IPs of ...
0
votes
1
answer
95
views
Truffle test USDC transfer to contract + instantiate contracts
I'm writing my smart contract tests in JS and using Truffle.
I want to test a specific function in my contract that requires a token address and contract address as parameters:
address _asset, ...
1
vote
0
answers
243
views
How to implement a custom consensus mechanism in Ganache
As a beginner in the Ethereum world, I have developed a blockchain network in Ethereum using Truffle, Ganache and Web3.js. I can deploy smart contract to Ganache network and transactions are included ...
1
vote
0
answers
17
views
How safe is it to use Truffle and store a seed in a script? [closed]
I want to do a script to automate an action. The script would run locally on my computer, using Truffle/HD-wallet-provider.
Is it safe? Having my seed in the first line of the script, or do I have to ...
1
vote
0
answers
40
views
How to write in etherscan.io "Info" tab with hardhat/truffle?
I would like to achieve the same result as the below images.
How could I populate the "Info" tab on etherscan.io with hardhat/truffle ?
Example 1:
https://etherscan.io/address/...