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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

0
votes
0answers
19 views

TypeError: “this is undefined” in truffle while invoking a contract

ProofOfOwnership.sol contract ProofOfOwnership { address public owner; mapping( string => Document) documents; struct Document { string docHash; string docTimestamp; ...
0
votes
3answers
24 views

How I add Security to the smart contract?

I deployed this contract and also interacted with it using ganache. pragma solidity ^0.4.0; contract Counter { int private count = 0; function incrementCounter() public { ...
0
votes
1answer
18 views

when to use MyContract.deployed()?

I was going through truffle-contract docs and came across this function MyContract.deployed() As mentioned in docs this function create an instance of contract abstraction(abi) representing the ...
0
votes
0answers
35 views

Migrated successfully,but not able to deploy

Smart contract migrated successfully. But while deploying the contract function, it is showing an error. I gave the command in terminal as : Swap.deployed().then(function(contract) {contract....
1
vote
1answer
54 views

Pending transactions are not mined

Preconditions I'm running a private network with Geth, having custom smart contracts deployed by Truffle and a simple frontend which using Metamask as a provider to connect the network. Versions ...
1
vote
1answer
29 views

The contract code couldn't be stored, please check your gas amount. Truffle, privatenet

I'm developing a smart contract over private blockchain using Truffle framework. Developed smart contract was running well, today we have been introduced one pure method as per requirement. Afterwords,...
0
votes
0answers
26 views

Unable to deploy contract using truffle-contract?

I'm trying to deploy a new contract via truffle-contract but for some reason it keeps giving me a Error: Invalid JSON RPC response: "" import Web3 from 'web3' import contract from 'truffle-contract' ...
0
votes
1answer
18 views

Truffle Javascript tests won't change Contract State (Contract State won't Change)

I reviewed a similar answer but it didn't work. Right now I'm starting with an Example trying truffle, I did a small Echo project based on the Pet Store Box from Truffle. And i'm having some problems: ...
0
votes
0answers
7 views

Ganache strange behaviour when using --blockTime parameter

I encounter a strange problem when using ganache-cli with -b --blockTime parameter to simulate fixed interval mining behaviour of mainnet. When I use Truffle contract .new() method to deploy 10 new ...
0
votes
0answers
30 views

(intermediate value).toBigNumber is not a function

My Dapp was working fine, but after I upgraded web3.min.js to the most recent version, I am getting these errors. Uncaught TypeError: (intermediate value).toBigNumber is not a function ...
0
votes
0answers
27 views

Simply throw ETH to the crowdsale contract address,Error: VM Exception while processing transaction: revert

I deployed my simple ERC20 token and simple Crowdsale contract into development network with locally installed Truffle, and I Simply throw ETH to the crowdsale contract address, but received this ...
0
votes
2answers
23 views

How to pass msg.sender and constructor params in truffle tests?

I have the following constructor: constructor(address _payee) public { payer = msg.sender; payee = _payee; } And this function in my JavaScript tests: beforeEach(async () => { ...
1
vote
1answer
13 views

Specify address for transaction in truffle test

I want to specify the address I perform a transaction with in my truffle test. My test looks approximately like this: contract('Test contract', async (accounts) => { let contract; ...
0
votes
2answers
28 views

The contract code couldn't be stored, please check your gas amount - truffle migrate

I'm working with smart contract development, and using Truffle framework. It was working before, but after adding one more function in my smart contract and it stopped working on migrate. Error ...
1
vote
0answers
19 views

truffle can not build success

when I fllow this document step by step enter link description here,I have something wrong with my truffle build,and I delete truffle.js ,this is photo, please help thx!!
0
votes
1answer
12 views

See the contract code in Meta Mask or/and Ganache

I have set up Ganache and Meta Mask on my browser and I have deployed a sample contract in it. Just follow the steps mentioned in https://truffleframework.com/tutorials/pet-shop. As far as I found ...
0
votes
1answer
21 views

What happens when truffle-contract promise is never executed

I'am using truffle 4. Suppose I have the following js code: let instance = await Values.deployed() let result = await ...
1
vote
2answers
20 views

Is drizzle a contracts lib?

I'm researching about smart contracts, and been seeing a lot of truffleframework, ganache and drizzle. In the other hand, only found broad descriptions of those tools: "Drizzle is a collection of ...
0
votes
0answers
12 views

How to claim commissions using ERC223 Contract script?

I have a PHP background but when it comes to contract addresses and blockchain, I am lost(until I spend time taking a long course on it). I need to claim weekly commissions from a Token by using a ...
0
votes
0answers
20 views

truffle contract doesn't throw error when view function is rejected

My function in the contract: function balanceOf(address _owner) public view returns (uint256) { require(_owner != address(0), "no owner addr"); return ownershipTokenCount[_owner]; } My js ...
0
votes
1answer
107 views

How to get contract instance address for Web3 1.0 contract API?

With truffle-contract, all you needed to do to get the contract instance was something like this: const getContract = require('truffle-contract') const contractJSON = require('./MyContract.json') ...
1
vote
1answer
119 views

Convert hash function hex to bytes32

The output of hash function SHA256 is a hex string of size 64. For example: 3ed54831f488a22b28398de0c567a3b064b937f54f81739ae9bd545967f3abab I want to call the function of a smart contract with the ...
0
votes
0answers
37 views

Truffle react with Proxy Contract of OpenZeppelin

Is it possible to create a react app with truffle framework using the Proxy Contract of OpenZeppelin for upgradable contract? What I understood is that one should send a transaction at Proxy ...
0
votes
0answers
37 views

What is the correct truffle configuration to deploy DApp to the POA test network?

I am currently struggling to deploy my DApp to the POA testnet (https://sokol.poa.network). I have a working DApp that I deployed to my local Ethereum testnet using truffle compile and truffle ...
0
votes
2answers
73 views

How to transfer token to an address?

Im using truffle and openzeppelin for issuing my ERC20 token. I already can add and buying the token, but still cannot transfer the token to another. when i console.log the contract, it show me: and ...
2
votes
1answer
37 views

Calling contracts inside for() loop [closed]

I have .js file, where the contract has to call five times by passing rand as parameter. But rand has been overwritten and only the fifth random value is passed to the contract five times: for(var i=...
0
votes
1answer
51 views

how to create array of multiple data types

Since struct cannot be output from solidity to web3js, I'm using arrays, I could get single datatype array in the below code(userAddress), but I'm not able to take multiple value in array(userName,...
0
votes
0answers
38 views

Error: VM Exception while processing transaction

I've got an errors while purchasing token with my test network, and the message is rpc error with payload, and an VM Exception while processing transaction. Is my contract wrong or my function wrong? ...
0
votes
0answers
18 views

How to .endSale from a contract?

I am writing a smart contract for a token sale. How can I endSale destroy contract and transfer remaining tokens and accumulated ethers from the sale to admin wallet ( using truffle commands)? I ...
0
votes
0answers
27 views

Does not match the input creation bytecode found at this address

I can not find my abi-encode byte in the compiled contract. this is the contract code I can not find the ABI encode ,before it is after 0029 but now I can not find anything after 0029. So I can ...
1
vote
0answers
13 views

Test cases required for Multisig wallet

Can you please suggest me some test use cases that are applicable for a smart contract that has a multi-signature wallet in Ethereum?
0
votes
1answer
134 views

How to convert BigNumber returned by Truffle Console [duplicate]

I have a simple contract Foo which is deployed to a Ganache network. pragma solidity ^0.4.18; contract Foo { uint storageData; function set(uint x) public { storageData = x; } ...
1
vote
1answer
45 views

Transfer data using solidity transfer function

Can we use transfer function in solidity to transfer the data? My code _dest.transfer(txn.value)(txn.data); and it is showing the error that this type is not callable.
0
votes
0answers
15 views

Is this code creating new filter of getting existing one?

I am migrating from single contract solution to dynamically create multiple contracts one. My contract(s) exposes number of events so I decided it would be more much easier to unsubscribe from ...
0
votes
0answers
57 views

How to catch reverted transaction while using metamask

i'm working with metamask and was testing a transaction that should trigger a revert statement inside my contract. When the error is thrown metamask gives the following output: this was while using ...
0
votes
1answer
101 views

How to unit test struct values

I'm new to Solidity development and I'm trying to figure out the best way to test a function which sets the values of a struct in my Truffle environment. Firstly, is it expected that the result of ...
0
votes
1answer
32 views

Understanding Bytes16 Representation in Solidity

I have a simple function printing byte a byte the value of a bytes16 0x20010db8000000000000000000000001 and I get the following result. ['0x20', '0x01', '0x0d', '0xb7', '0xff', '0xff', '0xff', '0x65' ...
0
votes
1answer
54 views

How to find the gas and gas price for truffle.js with large files?

this might be a basic question, but I was trying to deploy a large smart contract with multiple solidity files within it using Truffle and I cannot seem to be able to find a correct gas or gasPrice ...
0
votes
2answers
160 views

TypeError: Web3 is not a constructor when trying to use node.js with truffle-contract

I'm trying to use node.js with my smart contract for my app. As I've tried to convert from using the default app.js set-up to index.js set-up I've ran into this weird issue I can't fix. It throws ...
0
votes
0answers
102 views

Ropsten Infura + Truffle + truffle-hdwallet-provider. Invalid JSON RPC response: “”

When I am trying to call a Write function of the smart contract deployed on the ropsten network using truffle, I get error Invalid JSON RPC response: "" . The Read functions are working fine. I have ...
0
votes
0answers
16 views

transferPreSigned()

function transferPreSigned( bytes _signature, address _to, uint256 _value, uint256 _fee, uint256 _nonce ) whenNotPaused public ...
0
votes
0answers
22 views

Cannot call method on smart contract when deploying to Rinkeby network

I am writing a smart contract in Truffle. Then I deploy to Rinkeby network using Mist. I follow this tutorial. But when I call methods on this contract. I meet some following things: Read method: I ...
3
votes
1answer
112 views

Truffle Test: How to test SafeMath Library for overflow

How can I test if a function is resistant against overflow with truffle test? contract SafeMath{ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b;...
0
votes
0answers
91 views

Cannot send transactions to locally deployed smart contract

I setup a ethereum private network following this. Then I tried to deploy smart contract and send transaction to smart contract following this blog post. here is the python file I am using to deploy ...
0
votes
0answers
90 views

Implementation of an Allowance Crowdsale. Token Interface / _prevalidatePurchase-/_delivertokens-function

I am new to solidity coding and after I created some basic contracts as well as a ERC20 token contract I wanted to create a crowdsale contract. Now I am stuck and I have a question regarding the ...
0
votes
1answer
43 views

truffle-contract: cannot test method before real consume ether method

I am using truffle-contract for connecting between frontend and smart contract. Currently, I can call method on smart contract and can consume ether successfully. const result = await instance....
0
votes
0answers
17 views

Ganache CLI events subscribing

I am testing contract locally. Contract raises number of events on some actions execution that I am trying to catch in backend code (nodejs + truffle-contract). I found strange issue - if 2 or more ...
0
votes
1answer
110 views

Truffle-contract: how to subscribe to certain event

I am using truffle-contract for connecting between frontend and smart contract. Currently, I can call method on smart contract. But now I want to subscribe to certain events on smart contract. How can ...
1
vote
1answer
52 views

Testing ethereum smart-contracts that work with oraclize

I'm new in Ethereum and I have a smart-contract that receive exchange rate from API through oraclize. But I have problems with testing my smart-contract. For testing I use truffle + ganache. Could ...
0
votes
1answer
105 views

Truffle Test Library - TypeError: Member not found or not visible after argument-dependent lookup in library

Can somebody confirm this behavior and provide a solution? Using truffle test I get the error message Member "functionName" not found or not visible after argument-dependent lookup in library A. Is it ...