Questions tagged [truffle-contract]

The tag has no usage guidance.

84 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
554 views

How can I retrieve transaction hashes using web3 batch requests?

When I send a transaction using Truffle's contract wrappers - or using plain web3 sendTransaction() - I get a tx hash back that I can use to confirm the tx has completed. While using batch requests (...
3
votes
0answers
199 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. ...
3
votes
1answer
447 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 ...
3
votes
3answers
673 views

writing tests in solidity for functions returning multiple values

I have a function that returns multiple values function getInfo(string id) returns(string x,string y){ bytes32 _id= strToBytes(id); return (infostruct[_id].x,infostruct[_id].y) ; } Now i want ...
3
votes
0answers
754 views

Sign transaction using truffle-contract

Is it possible to call contract methods protected with modifier like onlyOwner without access to the node with the keyfile using only private key? I know that I can create raw transaction and sign it ...
2
votes
1answer
75 views

How to process Smart Contracts payable functions in batch?

I am aware that metamask will enable effective security for processing via the web browser a payable function action to a smart contract. What happens in batch? I have an API service which then ...
2
votes
2answers
149 views

Truffle interaction with my smart contract getting Vm exception

pragma solidity ^0.4.23; contract Hotelbooking { event Transfer( address indexed _from, address indexed _to, uint256 _value ); mapping(address => uint256) public ...
2
votes
0answers
134 views

Frontend call --> Transaction does not go through, no error message displayed

I'm trying to build a frontend for my Dapp and first, I wanted to test if I can initiate a transaction at all. I have a Button which calls the storeInput() function. Then, it should invoke the ...
2
votes
0answers
246 views

Usage regarding for loop in solidity contract

I am trying to integrate for loop in my smartcontract for adding details to a struct. I have implemented for loop using frontend by calling the function in smartcontract one by one. struct details {...
2
votes
0answers
296 views

Truffle Contract transaction doesn't wait to be mined

I have a thing that has been annoying me when using truffle-contract, ever since updating from Truffle 2 to Truffle 3. I am no longer able to run transactions synchronously - even though it is stated ...
1
vote
0answers
103 views

Contract has no network id set, cannot lookup artifact data

I am using web3 v1.0.0-beta.37 and truffle contract for server.js configuration. I have defined two contracts FlightSuretyData.sol and FlightSuretyApp.sol FlightSuretyApp contract access functions ...
1
vote
1answer
213 views

Truffle contract.deployed does not get the latest instance deployed

I am developing a back-end DApp using truffle and nodejs on a private network. My application call Contract.deployed() and print the address of the obtained Contract. When I call truffle migrate --...
1
vote
1answer
427 views

UnimplementedFeatureError: Encoding type “struct BiddingContract.Bidder memory” not yet implemented

The code is broken with the new upgrade v0.5, using Truffle v5.0.1 (core: 5.0.1) struct Bidder { address bidders_address; uint productId; uint bidValue; } struct Product { uint ...
1
vote
0answers
294 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 ...
1
vote
1answer
91 views

Deploying fails with different compile version

I'm trying to implement a simple card game. Actually, everything is working fine. Until I tried to move from 0.4.0 to 0.4.22. Any idea what is going wrong? Thanks a lot. And here the code: pragma ...
1
vote
1answer
288 views

truffle-contract cannot deploy in node js

This is the error I get. internal/modules/cjs/loader.js:631 throw new ERR_INVALID_ARG_TYPE('id', 'string', id); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of ...
1
vote
0answers
338 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' ...
1
vote
0answers
38 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!!
1
vote
3answers
576 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 ...
1
vote
0answers
44 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?
1
vote
0answers
414 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 ...
1
vote
0answers
348 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 ...
1
vote
0answers
117 views

Can't call another contract constant function in Remix in Web3 provider mode, but it works in Javascript VM

Remix behaves differently when running Javascript VM and web3 provider mode. I have two contracts: contract ERC20Basic { function totalSupply() public view returns (uint256){} function ...
1
vote
0answers
368 views

Error: authentication needed: password or unlock when deploying a contract with truffle

i am using angular with truffle. I am trying to deploy a contract through truffle migrate. here is my 2_deploy_contracts.js var contractFacotry = artifacts.require('./contractFactory.sol'); module....
1
vote
0answers
390 views

Drizzle React Component ContractData returns empty

My contract call to a simple view function that returns an array of data returns empty using: From testing it appears that ContractData can't deal with more than one return value. If I return one unit ...
1
vote
0answers
87 views

Unexpected revert during selfdestruct

I experience unexpected revert in the line where I invoke bidEnd. it("should create second contract and remove it", function(done) { BiddingsFactory.deployed().then(async function (...
1
vote
1answer
113 views

Unable to deploy contract on ropsten

Firstly I installed geth and it's running I created an account and verified keystore file in the location: ~/Library/ethereum/testnet/keystore Then I used: Web3.personal.newAccount('password') ...
1
vote
0answers
298 views

Using MetaMask with React and Truffle

I currently have my app set up with testrpc + truffle-contract and I'm trying to set the current provider to Rinkeby (or whatever testnet I'm on in MetaMask). However, when I run the following code it ...
1
vote
0answers
357 views

Truffle (4.0) test multiple contracts

I'm trying to test a contract that wrote and compiled, and I need to use another deployed contract to test it. I am writing a test for a specific contract and trying to invoke another deployed ...
1
vote
0answers
521 views

“Truffle unbox react” Not Working Properly

I am facing problems running the basic official setup of react and truffle. Here's what I did: truffle init truffle unbox react truffle develop truffle(develop)> compile truffle(develop)> ...
1
vote
0answers
97 views

Smart contract and Coin integration

I understand how to create contracts in Solidity, and how to create a Coin using Openzepplin. I do not understand how to integrate both. Let say that every transaction on contract (MyContract), will ...
1
vote
0answers
735 views

How can I sign raw transaction generated by truffle?

I can create tokens by the following way. However, I want to sign raw transaction generated by truffle so that I don't need to store my private key online. How can I get raw unsigned transaction? $ ...
1
vote
2answers
619 views

Out of gas when calling smart contract function from web3/Meteor Dapp

The following smart contract function works when called in the Remix-Solidity IDE and connected to testrpc. function submitAsset(string ownerName, string assetName, string assetDesc, string barcode, ...
1
vote
1answer
2k views

*contract* has not been deployed to detected network (network/artifact mismatch)

I'm trying to launch my first DApp using truffle and testrpc. I keep running into the above error once the web page loads. I looked at the Truffle Contract json object and the networks value is empty (...
1
vote
1answer
129 views

passing defaultBlock “pending” param to a truffle-contract call

I need the pending balance of my contract. As far as I understand I could do it with web3: web3.eth.call(callObject [, defaultBlock] [, callback]) Can I pass defaultBlock to truffle-contract ...
1
vote
0answers
150 views

What is the ether-pudding / truffle-artifactor front end?

I am trying to figure out how to interact with a smart contract deployed through truffle. I am looking at the truffle documentation here. They are describing how to call a function in a deployed ...
1
vote
0answers
302 views

How does Truffle Deployer translate arguments from JavaScript to Solidity?

I have a Truffle migration that looks something like this; var MyContract = artifacts.require("./MyContract.sol"); module.exports = function(deployer) { deployer.deploy(MyContract,[ { "...
1
vote
0answers
31 views

Accessing other contract variables(address)

I'm creating a marketplace, which will have two token contracts representing currencyToken and assetToken. I've set separate owner's for both of the token contracts, in their constructor. But when I'm ...
0
votes
1answer
28 views

How to save the contract instance on a mapping in solidity?

I have created an EnergyExchange contract in my React app.js that it is deployed in the network. Inside the EnergyExchange contract there is a function to create Agent contracts. What I am trying to ...
0
votes
0answers
16 views

Is there a way to get revert message by my client?

I have a smart contract with this simple function: function addUser( string memory _username, string memory _nome, string memory _cognome, string memory _email) public isOwner() { require(bytes(...
0
votes
1answer
47 views

Solidity Smart Contract withdrawal ETH with amount from contract address does not work

I have below smart contract and a test program to test transfer ETH out of contract address, but contract’s ETH balance not changed. I tested withdrawAmount(uint256 amount) but the assertion error ...
0
votes
1answer
23 views

Truffle Contract sendTransaction not immediately returning transaction hash

I am using Truffle Contract to call a Smart Contract method that writes to the ethereum blockchain. My web3 client is connected to my own Open Ethereum node. Below is the code (nodejs) that I am using ...
0
votes
0answers
5 views

MainNet Truffle Contract sendTransaction request not returning transaction receipt

I just deployed my smart contract to MainNet and starting to test my DAPP. I am running my own public Open Ethereum node where I send my transactions to. I am NOT mining in this node. From what I can ...
0
votes
1answer
30 views

My contract is deployed but instance is undefined

I have deployed a contract on the ganache blockchain successfully using truffle. In the truffle console, I can call the contract fine truffle(development)> MyCoin [Function: TruffleContract] { ...
0
votes
0answers
40 views

How to create an instance of the deployed contract in Truffle Console?

I am trying to learn Truffle tool using the tutorial at: Truffle tutorial I am writing the following command at Truffle console to create an instance of the deployed contract but I am getting the ...
0
votes
0answers
31 views

Truffle stuck when deploy smart contract when using Ledger wallet

I have a little problem deploying smart contract with ledger nano s as provider on ropsten. The script just remain stuck at first migration Starting migrations... ====================== > Network ...
0
votes
0answers
43 views

Why is the compiler unable to generate Contract ByteCode and ABI when I try to Verify & Publish my contract?

Another dev no longer connected to our project deployed this contract, and I'm trying to Verify & Publish it on Etherscan now. What am I doing wrong? I do know that the dev who built this used ...
0
votes
1answer
49 views

How to act as another wallet when using Truffle exec scripts?

I am writing a seed to add data on the smart contract after I deploy it. I'm using ropsten network, setted up like this in truffle-config: ropsten: { provider: function () { return new ...
0
votes
0answers
46 views

Install py-solc-x using python, there is an error

I am using python to install py-solc-x, but there is an error during installation: [root@localhost ~]# python3 -m solcx.install v0.4.25 ERROR: Unknown option --version /usr/local/python3/lib/python3....
0
votes
1answer
30 views

Im getting the following error: ParserError: Expected primary expression. struct ManagingOrder.Parking memory new_Parking = Parking({

Im using blockchain technology for the first time, for a college project. Im trying to run a smart contract from Github. After debugging the errors shown while compiling the smart contract (in ...