Questions tagged [truffle]

Development environment, testing framework and asset pipeline for Ethereum

Truffle is a development environment, testing framework and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. With Truffle, you get:

  • Built-in smart contract compilation, linking, deployment and binary management.
  • Automated contract testing with Mocha and Chai.
  • Configurable build pipeline with support for custom build processes.
  • Scriptable deployment & migrations framework.
  • Network management for deploying to many public & private networks.
  • Interactive console for direct contract communication.
  • Instant rebuilding of assets during development.
  • External script runner that executes scripts within a Truffle environment.

Github Repository

Official Website

1088 questions
5
votes
1 answer

Truffle - Is There Any Way to Auto Generate Test Cases?

Is there any way to auto-generate test-cases in Truffle? As an example, the AutoFixture Library was helping me to auto-generate test-cases in xUnit. I'm looking for a similar functionality.
Ferit
  • 8,692
  • 8
  • 34
  • 59
5
votes
1 answer

How to manually create the instance of the contract in truffle

Say I have 2 contracts like this A.sol import './B.sol'; contract A { event BCreated(address addressOfB); function createB(){ B b = new B(); BCreated(b); } } B.sol contract B { uint8 value = 5; function…
utkarsh tyagi
  • 635
  • 1
  • 9
  • 27
5
votes
0 answers

How can I run a truffle test on an existing contract?

I'm working on a simple ethereum contract and it's truffle test counterpart, but the issue I'm running into is that I need the test to call an old deployment of the contract, instead of redeploying it every time. In the truffle documentation, it…
5
votes
5 answers

Setting gas for truffle

I'm running truffle migrate on main. Also using geth. I originally left gas price and gas empty in truffle.js, but now it looks like this: live: { network_id: 1, host: "127.0.0.1", port: 8545, from:…
5
votes
4 answers

Unable to run truffle@2.1.2 migrate --network live. "Exceeds block gas limit"

I am using truffle@2.1.2 to deploy smart contracts against a localhost:8545 geth@1.5.9-stable rpc, using an account that is funded with Ether has been unlocked using personal.unlockAccount on the geth console. I have also tried the same against a…
KnownColor
  • 449
  • 5
  • 12
4
votes
2 answers

Truffle init not creating Migration.sol file

Output for truffle version command: "Truffle v5.5.27 (core: 5.5.27) Ganache v7.4.0 Solidity - 0.8.16 (solc-js) Node v16.16.0 Web3.js v1.7.4" truffle init does give a success message as below "Init successful, sweet! Try our scaffold commands to get…
Prithvi Patil
  • 41
  • 1
  • 4
4
votes
3 answers

Error while installing truffle using "npm i truffle -g"

While installing Truffle on my desktop, an anonymous error occurs... First it's showing the error related to python which is strange but then I install python now this error npm ERR! code 1 npm ERR! path C:\Users\Tanuj…
Tanuj Sharma
  • 77
  • 1
  • 1
  • 10
4
votes
1 answer

Call a function in another contract - Solidity

I need to call a function in another contract using Truffle. This is my sample contract: Category.sol: contract Category { /// ... /// @notice Check if category exists function isCategoryExists(uint256 index) external view returns (bool) { …
Milad Jafari
  • 1,135
  • 1
  • 11
  • 28
4
votes
1 answer

Solidity Time-Travel Test Failing

I am following the CryptoZombies tutorial and having trouble getting one of the tests to pass. The test is as follows: it("zombies should be able to attack another zombie", async () => { let result; result = await…
DeepSports
  • 43
  • 4
4
votes
4 answers

Truffle Uncaught ReferenceError: global is not defined after using migrate

I'm following this tutorial. After using the command truffle migrate --reset the blocks appear on Ganache GUI. However, I'm not able to interact with the contract using the console. If I type token = await MemoryToken.deployed(), I receive the…
Caladay
  • 111
  • 6
4
votes
1 answer

How to invoke a payable solidity function using HardHat?

I have a solidity function called adopt a dog as below which is bascically a payable function in the contract. // THIS IS FAILING AS I DONT KNOW HOW TO PASS ETHERS IN HARDHAT/ETHER.JS Hardhart const Adopt = await…
HarshEc
  • 232
  • 8
  • 21
4
votes
2 answers

How can I deploy a smart contract to RSK without using Truffle?

After compiling a Solidity file using solc, how can I deploy the output bytecode as a smart contract to RSK? I know how to do this using Truffle already, but what alternatives are there available for this task?
serlokiyo
  • 353
  • 1
  • 9
4
votes
4 answers

blockchain tutorial Error: The send transactions "from" field must be defined

I am following a blockchain tutorial from dappuniversity. When I create the task in the line await App.todoList.createTask(content) from…
Katlock
  • 1,200
  • 1
  • 17
  • 41
4
votes
2 answers

npm error installing truffle for ethereum development

When I try to install truffle using npm, the following output appears: npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that. npm WARN deprecated…
Jerry Kaizer
  • 43
  • 1
  • 6
4
votes
3 answers

Error: SimpleSmartContract has not been deployed to detected network (network/artifact mismatch)

i have develop a simple smartContract. when i run truffle test it showed the following error:i am new in this so i cant figure it out. PS F:\pracdap> truffle test Compiling your contracts... =========================== √ Fetching solc version list…
FSO
  • 89
  • 1
  • 7