truffle

Error: Returned error: VM Exception while processing transaction: invalid opcode

半城伤御伤魂 提交于 2019-12-11 17:12:17
问题 I am trying to test a smart contract that monitors trading. I have three contracts, EscrowComplianceCecker, Industry, and Consumer. However, when testing my sendescrow() function on a truffle it seems to be throwing the above error. I am trying to figure out the reason for the bug I debugged with the truffle debugger. The problem seems to be coming from the line escrowobtainee.escrowobtainees[ escrowparticipator][obtcounter].escrowparticipantsinitialamountputin = escrowobtainee

Integrating web3 in cloud functions module

一个人想着一个人 提交于 2019-12-11 04:35:58
问题 I'm trying to integrate web3 (using truffle) in a cloud functions module and I keep getting this error: Error: Invalid JSON RPC response: "" Here is part of the implementation: admin.initializeApp(functions.config().firebase); const db = admin.database(); const provider = new HDWalletProvider(mnemonic, infura link); const web3 = new Web3(provider); As Far as I understand, the error indicates that truffle library is unable to establish a connection to the ethereum network. I wonder if this has

Can't call contract function in truffle console

你离开我真会死。 提交于 2019-12-11 04:16:37
问题 I'm compiling and deploying the following contract to testrpc: pragma solidity ^0.4.4; contract Adoption { address[] public adopters; function adopt(uint petId) public returns (uint) { require(petId >= 0 && petId <= 15); adopters[petId] = msg.sender; return petId; } } Then I go to terminal and: truffle compile truffle migrate --reset Everything works as expected. Then, I try to call adopt() in truffle console: truffle(development)> const adoption = Adoption.deployed() // undefined truffle

Test ethereum Event Logs with truffle

落花浮王杯 提交于 2019-12-09 08:59:15
问题 I have a contract's function which emit events on each call. I would like to have an event emitted on each test which are passing, here are some tests : it("should emit Error event when sending 5 ether", function(done){ var insurance = CarInsurance.deployed(); insurance.send({from: accounts[0], value: web3.toWei(5, 'ether')}).then(done).catch(done); }); it("should emit Error event when sending 5 ether", function(done){ var insurance = CarInsurance.deployed(); insurance.send({from: accounts[0]

Different ways to invoke contract method

空扰寡人 提交于 2019-12-09 03:56:08
问题 I have one contract with method name as getValues().From Dapp I am invoking contract method as 'contractCAt.getValues.call(function(error,result){...})' this works fine and by using 'contractCAt.getValues(function(error,result){...})' this syntax also works fine.I didn't get any difference between those two ways to invoke contract method.So could anyone help me to give idea about those syntax. 回答1: See the web3j documentation: contractCAt.getValues.call() is run locally and will not alter the

Quorum Ethereum Truffle) Error: Number can only safely store up to 53 bits

放肆的年华 提交于 2019-12-06 15:21:05
I am actually learning smart contract programming on ethereum and I work with truffle. Right now I am making this tutorial here: https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains Where you learn how to create a dapp with quorum. But now I have a problem. I did everything exactly as described, but when I do: truffle migrate I get this error here: $ truffle migrate ⚠️ Important ⚠️ If you're using an HDWalletProvider, it must be Web3 1.0 enabled or your migration will hang. Starting migrations... ====================== > Network name: 'development' >

以太坊(Ethereum)开发框架 Truffle 入门(二):选择一个以太坊客户端

主宰稳场 提交于 2019-12-05 07:16:50
有许多以太坊客户端可供选择,我们建议在开发环境和部署环境使用不同的客户端。 在开发环境 EthereumJS TestRPC: https://github.com/ethereumjs/testrpc 当开发基于 Truffle-based 的应用程序,我们推荐使用 EthereumJS TestRPC 。它只在你的开发机器内存里运行一个完整的区块链。它立即处理事务而不是等待默认阻塞时间——所以你可以更快速测试你的代码——它会立即告诉你当你的智能合同中发生了错误。这也使得自动化测试大客户端的时候 Truffle 知道如何运用它的特殊功能以节省近90%的测试时间。 在部署环境 Geth (go-ethereum): https://github.com/ethereum/go-ethereum WebThree (cpp-ethereum): https://github.com/ethereum/webthree-umbrella 更多: https://www.ethereum.org/cli 有许多官方的和非官方的以太坊客户端供你选择。当你已经充分使用 EthereumJS TestRPC 测试你的 DApp 并且你准备把它部署到以太坊网络,你应该使用这些客户端。这些都是完整的客户端实现,包括采矿、网络、区块和事务处理,并且 Truffle

Truffle command not found after installation

╄→гoц情女王★ 提交于 2019-12-05 00:53:52
I installed truffle through npm with the following: sudo npm install -g truffle but when I run truffle list on the console it just gives me bash: truffle: command not found Please make sure you have the latest version of npm and node installed. I had the same issue, I updated npm and node to latest version and it worked. npm install -g truffle works. I had a similar problem. I ran npm i -g truffle and then when I tried to run truffle init I got an error: zsh: command not found: truffle . What solved it for me is to create a local node_modules with truffle installed in it, and then run that

Send signed transactions to Ropsten or Truffle develop network with Trezor (Hardware Wallet)

谁说胖子不能爱 提交于 2019-12-04 16:23:59
问题 Im trying to integrate web3js with Trezor in a truffle dev network or using ropsten test network . The idea is to sign the transactions using the hardware wallet and then send a raw transaction using web3js Im getting that we dont have balance to make the transaction, probably because web3js isnt taking one of the 10 truffle accounts and is using the trezor address that isnt in my local network .. On ropsten i have some ethers and i get "invalid address" Is there a way to send a signed

以太坊(Ethereum)开发框架 Truffle 入门(三):创建项目

别等时光非礼了梦想. 提交于 2019-12-04 07:11:23
创建项目文件夹 首先创建一个项目文件夹。你可以通过你喜欢的文件资源管理器或在命令行中执行以下命令: $ mkdir myproject 初始化你的项目 接下来,初始化你的 Truffle 项目通过在命令行执行以下命令: $ cd myproject $ truffle init 一旦执行完成,你将拥有一个如下项目结构的项目: app/ - 你的应用程序默认目录。这里包含推荐的 Javascript 和 stylesheets 文件夹,但是你完全可以自由支配这些文件的使用。 contracts/ - Truffle 项目的 solidity 合约目录。 environments/ - 放置应用程序构建文件的目录,在这里你可以重写每个环境变量配置。 test/ - 用于测试你的应用程序和智能合约的测试文件目录。 truffle.js - Truffle 项目主配置文件。 默认项目:MetaCoin 默认情况下,Truffle 给你初始化一个 MetaCoin 演示应用程序,它就像一个以太坊构建的 alt-coin 系统。你可以使用这个项目并通过浏览入门指南来快速学习 Truffle 的使用,或者删除这些文件,建立一个属于自己的项目。 英文原文: http://truffle.readthedocs.io/en/latest/getting_started/project/ 来源: