Stack Exchange Network

Stack Exchange network consists of 174 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
0answers
29 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
35 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
55 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
1answer
59 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
21 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
35 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
61 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
32 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
36 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
54 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
35 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
343 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
28 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
48 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
129 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
29 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
65 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
54 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
41 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
38 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
56 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
176 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
37 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
123 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: ...
2
votes
0answers
14 views

IntelliJ + truffle tests

I would like to run truffle tests from IntelliJ. I found a tutorial here: https://charterhouse.github.io/2017/05/12/running-truffle-unit-tests-in-intellij-idea.html Unfortunately, it does not seem ...
1
vote
1answer
43 views

Why am I getting “Trying to create an instance of an abstract contract.” error when I use factory contract pattern?

I have 2 contracts : Registry, Factory. Registry contract is compatible with ERC721 contract like this: pragma solidity ^0.4.24; import "../openzeppelin-solidity/contracts/token/ERC721/...
0
votes
0answers
77 views

Call method with bytes argument from Truffle

When calling a Smart Contract method that requires a bytes parameter, truffle is not accepting the bytes parameter, no matter how I express it. All these tests fail on truffle: // ...
1
vote
1answer
74 views

Issue in comparing token contract address and address(0) in Solidity 0.5.0

I am trying to compare the token contract address with the address(0). This was working fine in older version of truffle and solidity compiler (0.4.24). When I upgraded truffle and started using the ...
1
vote
1answer
31 views

Initiate transaction from server to smart contract

In my case, i have an API written in PHP which periodically checks the database. If certain condition was met, i need to send an alert message from the API to an account/node in the Ethereum ...
4
votes
2answers
213 views

Truffle v5 runs out of gas but Truffle v4 deploys the contract

Truffle v4 used to deploy the contract successfully, but Truffle v5 truffle migrate command fails. My process to deploy: 1) delete buidl/ folder 2) truffle compile 3) truffle migrate Truffle v5 ...
0
votes
0answers
37 views

i can't get rid of this error

const HDWalletProvider = require("truffle-hdwallet-provider"); const Web3 = require('web3'); const {interface,bytecode} = require('./compile.js'); const provider = new HDWalletProvider( 'slim ...
2
votes
1answer
192 views

Has anyone found a fix for “ParsedContract.sol:3:1: ParserError: Source file requires different compiler version”?

Following the truffle pet shop tutorial and ran into this error when running truffle migrate: ParsedContract.sol:3:1: ParserError: Source file requires different compiler version (current compiler ...
2
votes
0answers
34 views

Installing Truffle without npm

I'm a student trying to install a truffle test RPC client (just for simple contract deployment in small scale). I am using a remote Ubuntu machine in my university, and i don't root privileges. ...
0
votes
1answer
17 views

SC Truffle Testing: Domain Object Returned?

Working through some tests in Truffle to become more acquainted with the environment but am running into an issue. What I am trying to do Test a smart contract with, among others, the following ...
1
vote
1answer
40 views

Truffle Deploy gas limit exhausted

I kept on getting this error. 9/10 of my deployment will fail. But out of the sudden it will be success without any reason. I have checked the transaction receipt and indeed it had reaches the gas ...
0
votes
1answer
60 views

Is there a way to set specific account when using truffle console rinkeby?

When I tested on ganache-cli at local, I could test on 'truffle console development' with some accounts which ganache-cli gave. But at rinkeby, I can't use function_name(argumets, {from: specific ...
0
votes
1answer
40 views

HDWallet Provider vs HttpProvider

What exactly is the difference between HDWalletProvider and HttpProvider, and what is the proper scenario for using each?
0
votes
1answer
48 views

Truffle and Ganache-cli test case fails

So I have this setup : truffle and ganache-cli I'm sending some ether to my contract, here is the related part of my contract: mapping(address => uint256) public balanceOf; function () ...
1
vote
0answers
48 views

Truffle test of two transactions during the same block

I'm trying to test a solidity function that only allows it to be called once per block. E.g. (my desired functionality): Tx1 calls Fn during block #100, and when successful sets a boolean flag for ...
1
vote
4answers
1k views

Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist

I'm trying to initialize a directory with truffle init, but I'm getting the following error: Error: Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. If you believe this ...
1
vote
0answers
29 views

TruffleContract At() function with Drizzle

I am learning the Drizzle framework after I did a project using TruffleContract abstractions in Javascript (DApp). I have multiple instances of a contract and I am not able to access at the instances ...
0
votes
1answer
71 views

Solidity test file reaches gas limit due to imports

I have a sol contract X.sol and a sol test file TestX.sol. X.sol is large: ~4m Gas after optimisation TextX.sol compiles, migrates and executes tests fine when just executing a single test - testY, ...
1
vote
1answer
27 views

truffle web3 synchronous request problem

Error: Web3ProviderEngine does not support synchronous requests. That's what I get when I use the following command from Truffle Console: truffle(ropsten)> web3.eth.getBlock('latest').then(...
3
votes
1answer
70 views

solidity-coverage adds extra events which make unit-test fail

It seems that when using the latest solidity-coverage (0.5.11), truffle (5.0.0-next.25) ganache-cli (6.2.4-beta.1) and solc (0.5.0) additional events / logs are emitted during tests which make the ...
1
vote
0answers
19 views

How to setup Dapp on Cpanel? [closed]

I have followed the truffle petshop tutorial and it runs in my local machine, I have a shared hosting account and i would like to upload and test this Dapp on my server to start to modify it. The ...
2
votes
1answer
44 views

How to configure truffle network with IPC provider?

How can I define in truffle the ipc connection to the node? Currently I am using in truffle.js host/port fields, which are used to create a HttpProvider. module.exports = { networks: { dev: { ...
2
votes
0answers
40 views

Unable to send large transactions on ethereum private chain

I have a small contract pragma solidity ^0.4.17; contract A10test{ mapping(uint=>string) public data; uint public revisionNo=0; function setdata(string _data) public { data[revisionNo] = ...
2
votes
1answer
36 views

What is the best way to test calling a contract's function from another contract?

I'm playing around w/ Gnosis' MultiSigWallet and noticed in their replaceOwner function it has a modifier that requires msg.sender to be the MultiSigWallet contract itself: modifier onlyWallet() { ...
0
votes
1answer
51 views

Set up backup from private Ethereum (Ganache) [duplicate]

I have created an ethereum application with Ganache and truffle js. i have installed ganache in a server, and th application work. but when i stop the server i lose the the smart contract that i have ...
0
votes
1answer
68 views

ERC20 token with expiration date

I would like to create a ERC20 token with an expiration date to represent for example a ticket or a gift card. I've created a contract which overrides the open-zeppelin ERC20 contract methods. ...