Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [truffle]

Questions regarding the implementation and use of the Truffle development and testing environment.

1
vote
1answer
36 views

Truffle - a proper way to execute a chunk of code

Let's say I have a complex operation to execute, for example deploying 6 contracts and calling functions to each one, passing addreses to few of them and executing some extra more functions. I can, of ...
1
vote
1answer
13 views

Show truffle migration history

What is the best way to show truffles migration history or at least the last successful step. Something similar what I see when I do truffle migrate: Running migration: 1_initial_migration.js ...
1
vote
1answer
37 views

Truffle - call migration file multiple times

I would like to execute migration file "6_deploy_and_register_group.js" every time when I need to create a new group. Is this a proper way to use migrations? If yes, how can I make it working? ...
0
votes
0answers
32 views

Member “transfer” not found or not visible after argument-dependent [duplicate]

I am writing ERC721 contract with truffle. I have recently upgrade solc to 0.5.0 due to openzepplin compiler version. Read about the changes to the 0.5.0 version unfortunately I am unable to resolve ...
0
votes
2answers
29 views

find the bytecode of a contract during compilation

Is there a solution to recover the complete bytecode (init + runtime) of a contract imported in solidity. For example "bytes code = getBytecode (Escrow.sol)" and this would be replaced by bytecode ...
1
vote
1answer
292 views

Member “transfer” not found, solidity 0.5 [duplicate]

Get the following error message, which I suspect has something to do with the solidity version 0.5, that I'm using? Error message $ truffle test Using network 'development'. /contracts/...
0
votes
2answers
161 views

web3.utils.fromWei(web3.eth.getBalance(web3.eth.coinbase), 'ether').toNumber() gives error

web3.utils.fromWei(web3.eth.getBalance(web3.eth.coinbase), 'ether').toNumber() gives this error: > /usr/local/lib/node_modules/truffle/build/cli.bundled.js:369506 > throw new Error('...
1
vote
1answer
104 views

Can't connect to local blockchain

Using Truffle, I'm trying to implement my first smart contract by running the MetaCoin webpack. After running Truffle Develop, I can see my list of accounts: Truffle Develop started at http://127.0....
1
vote
1answer
32 views

Scope in events in web3 1.0 [closed]

Inside the callback of an event, how do I get the scope outside the function? Specifically, in the following scenario, I want the web3 object: (using truffle-contracts and web3 1.0 here) ... const ...
0
votes
1answer
136 views

Error: Please pass numbers as strings or BigNumber objects to avoid precision errors

let result = await instance.joinQuiz({ from: accounts[1], value: web3.utils.toWei(10, "wei") });
1
vote
1answer
112 views

ParserError: Expected identifier but got 'payable'

function getWinners() public onlyOwner { require (now > endQuiztime, 'Quiz did not end '); require (isReveal, "You didnt reveal Questions"); // calculate winner for each ques based on ...
1
vote
1answer
39 views

truffle - deploy two contracts and use them in test [duplicate]

How can I pass 2 groups to test? Migrations: var Group = artifacts.require('./Group'); module.exports = async function(deployer, network, accounts) { await deployer.deploy(Group, "test 1"); ...
2
votes
1answer
150 views

abstract contract getting deployed instead of the main contract on truffle migrate

I'm building a project which consists of two .sol files -> A.sol and B.sol. Now, A.sol contains an abstract contract definition of B, among other things, like this: Contract B { function fnB() ...
2
votes
1answer
41 views

Can't access test network's accounts

So I've updated my framework and with it the web3,js lib. When I run the console and attempt to get an account from my test network by web3.eth.accounts, it won't display a list of the accounts like ...
1
vote
1answer
55 views

VM Exception while processing transaction: revert message

When a solidity smart contract reverts with a message due to a failure on a require statement, the browser calling the smart contract returns "Error: VM Exception while processing transaction: revert"....
0
votes
0answers
271 views

FATAL ERROR: Rebalance Allocation failed - process out of memory

So while running truffle compile for my contracts on AWS Ubuntu server I got the following error: <--- Last few GCs ---> [17055:0x3985730] 11958 ms: Scavenge 511.7 (553.4) -> 506.9 (553.4) ...
1
vote
2answers
775 views

Unable to run truffle compile

I want to run truffle compile on my AWS Ubuntu 18.4 server. I'm able to compile the same contracts on my local with no compilation errors but when I tried to run truffle compile on AWS ubuntu server ...
0
votes
2answers
45 views

Get creator from contract address

How can I get the creator's address of a contract? I'm using truffle, so usually I do let instance = await VM.instance() and then get the contract's address via instance.address Then, how can I ...
0
votes
1answer
178 views

Build failed SyntaxError: Unexpected token: name (length)

I setup truffle unbox react-auth and add few libraries as shown in my package.json below. I have no problem running npm run start but failed to compile npm run build with the following error: ...
0
votes
2answers
92 views

truffle migration fails, but initial migration was mined

I am trying to deploy this contract on a private permissioned Quorum network. The migration fails on the 1_initial_migration process. If I try to repeat the process with: sudo truffle migrate --...
0
votes
2answers
649 views

ı got 'TypeError: Data location must be “storage” or “memory” for parameter in function, but none was given.'

I am trying to do truffle migrate but i got this error $ truffle migrate Compiling .\contracts\Election.sol... Compiling .\contracts\Migrations.sol... Compilation warnings encountered: /C/Users/...
0
votes
1answer
293 views

truffle version installation issue

I am running into permission issues when I try to install truffle avi@avi-Inspiron-3542:~$ sudo npm install -g truffle /usr/bin/truffle -> /usr/lib/node_modules/truffle/build/cli.bundled.js ...
0
votes
1answer
45 views

How to test contract interaction with mainnet contract via Truffle

I'm writing a contract via Truffle and my understanding is that running truffle test will run my tests in a clean-room environment. E.g. a fresh deployment blockchain run on my local machine How can ...
0
votes
0answers
83 views

How to `truffle migrate` to private permissioned network?

I am running a private permissioned network and would like to use Truffle v5.0.1 for deployment. I use it according to the documentation: Compile my project with truffle compile so that the ./build ...
0
votes
0answers
66 views

Invalid opcode on estimateGas 'code': -32000

this is my contract : pragma solidity >=0.4.21 <0.6.0; contract CloudProject { uint public nbCandidates = 0; uint public nbBureau = 0; uint public nPartiPouvoir = 0; ...
1
vote
1answer
453 views

Truffle migrate no error but does not create build directory

I'm trying to develop a simple dapp using ReactJS.I used Charterhouse/truffle-create-react-app box suggested by truffle website. The problem is truffle compile and truffle migrate do not seem to work. ...
1
vote
0answers
51 views

Transaction submitted through Infura, but not from local node

So, I have a Rinkeby fast sync on my server. When I try to interact with my contract and transfer something, geth says "Submitted transaction", but then I can't find it using its hash on etherscan. ...
0
votes
0answers
76 views

Uncaught ReferenceError: TruffleContract is not defined (Truffle Pet Shop)

I'm writing my own application that follows a similar form to the Truffle Pet Shop. I have the following code in my app.js: initContracts: function(){ $.getJSON('Greeter.json', function(data) { ...
2
votes
1answer
57 views

Oraclize a restfullAPI using a specific number represented by the variable z

Hello I made a restfull API on my own (python file jsonify + localtunnel) on a localhost using a specific number (in this case 141) represented by the variable z. This variable should go into DevCoin ...
0
votes
2answers
150 views

Retrieve specific account in truffle 5 console

I am following a truffle tutorial where the individual users web3.eth.accounts to retrieve all the accounts from Ganash. However that seemed depreciated and to duplicate his results I used web3.eth....
0
votes
1answer
26 views

Unable to transfer from a contract to another contract

I was trying to learn how smart contract interaction by implementing a bank contract and a client contract. The end user create a Client contract. Then, he use the Client contract to deposit or ...
-1
votes
1answer
69 views

Problem with the compilation in the truffle framework

I made a smart contract in Remix-Solidity IDE, when I compiled it I had no errors and I was able to remove the contract but when I tried to use the truffle for my Dapp and compiled it it showed me ...
2
votes
2answers
139 views

Truffle - How to get event?

I can't figure out how can I get event. I was trying with "contract.NewVoting().watch{}" but it says that watch is not a function. I found out that watch has been removed and there is EventEmitter ...
0
votes
1answer
105 views

Migrates contract with specific account without hard-code address using truffle and Genache

Block Builders! I am trying to migrate my two smart contracts using truffle and Genache. I would like to specify the deploying accounts existing locally. However, when I try to migrate the contracts I ...
0
votes
1answer
89 views

Unable to test the value from contract using truffle test

block builders! I have trouble testing the return value from my contract, because the return uint value is always a "transaction" object (I actually don't really know what that mean) Here is the ...
1
vote
0answers
113 views

How to use the latest version of Truffle Contract in a web page?

I'm trying to use version 4.0.0 of truffle-contract in a browser app, so no NodeJS, no require or anything. So I followed the instructions in the doc, downloaded truffle-contract in non-minified ...
-2
votes
1answer
75 views

ParserError compiling Smart Contract, what's wrong?

I'm getting this error when trying to compile a contract using cmd on windows: Error parsing C:/Users/alexa/Desktop/contracts/contracts/ApprovalContract.sol: ParsedContract.sol:6:37: ParserError: ...
1
vote
1answer
706 views

TypeError: Data location must be “memory” for return parameter public view returns (address[16]){

I know that is question has been answered in one form. However, I could not find an answer for my specific case. Here is my code: pragma solidity ^0.5.0; contract Adoption { address[16] adopters; ...
0
votes
1answer
45 views

Access modifiers for properties of a struct

I am relatively new to Solidity. I am following a tutorial and came up with the following contract: contract Election { struct Candidate { uint id; string name; uint voteCount; } ...
0
votes
1answer
102 views

How are truffle artifacts different from ABI?

How are truffle artifacts different from ABI? Do Truffle artifacts include fields that are different from ABI that is generated using remix?
0
votes
1answer
265 views

web3 Uncaught TypeError: Cannot read property 'createBox' of undefined

i'm trying to create simple application by using solidity 5.0.0 , Truffle v5.0.0 and web3 web3@1.0.0-beta.34. but i've gotten Uncaught TypeError: Cannot read property 'createBox' of undefined. ...
1
vote
1answer
56 views

How to access nested struct values?

I'm new in solidity programming so for learning purpose I'm developing e-voting system using ethereum blockchain. Code mentioned below, pragma solidity 0.4.25; contract RegisterCandidate { // ...
1
vote
2answers
73 views

Inheritence in Solidity

I want to implement my contract in much better way and want to use the inheritence. I wrote the code and i face one problem that i want to access the mapping variable of Contract A in the Contract B. ...
1
vote
0answers
79 views

Error while installing truffle framework

I've received the following error message while installing truffle framework on my windows 10 device. "Keccak bindings compilation fail. Pure JS implementation will be used." Can somebody please ...
1
vote
0answers
51 views

Interacting with contracts on Solidity 0.4.* and Solidity 0.5.* in Truffle v5

I have a big contract (A) that is built using Solidity 0.4.25. I also want to build several contracts (B) that will talk to (A), but they will be built using Solidity 0.5.*. As I understand, I will ...
1
vote
1answer
42 views

Compiling error when using .value() for sending money between contracts using solidity and truffle framework

Dear fellow block builders! I am new to this field and I would like to implement my first project mimicking the famous DAO attack using re-entrance. I've programmed two smart contracts - the DAO and ...
-1
votes
1answer
61 views

I want to oraclize this smartcontract to get some output on a localhost. I am desperate what should i do?

pragma solidity ^0.4.17; import "installed_contracts/oraclize-api/contracts/usingOraclize.sol"; contract DevCoin is usingOraclize { mapping (address => uint256) public balances; event ...
1
vote
1answer
393 views

Truffle compile gives Parser Error: Error parsing openzeppelin-solidity/contracts/ownership/Ownable.sol

I installed the latest version of truffle, solc, node and also installed new version of openzeppelin-solidity library in my project. Changed the truffle-config.js to use new solc version. My contract ...
0
votes
2answers
41 views

Create two contracts that each with different accounts.

I'm a newbie in blockchain. I am trying to repeat DAO attack using two different contracts, in my case DAO and Hacker. I want the 2 contracts belongs to 2 separated account, so I can see that the ...
1
vote
2answers
198 views

Error when compiling

I'm using the latest version of Truffle. When I try to compile my contract I get this error. I don't know what is happening /home/josue/Desktop/blockchain/ebay/contracts/Migrations.sol:20:5: ...