Truffle Smart Contract Error: Invalid number of parameter
I followed the tutorial of quorum with truffle: https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains
Now I want to migrate the SimpleStorage.sol Smart Contract to the blockchain, but I want to make it to add the "PrivateFor" parameter.
This is my Smart Contract:
pragma solidity ^0.4.17;
contract SimpleStorage {
uint public storedData;
constructor(uint initVal) public {
storedData = initVal;
}
function set(uint x) public {
storedData = x;
}
function get() view public returns (uint retVal) {
return storedData;
}
}
This is my: 2_deploy_simplestorage.js
var SimpleStorage = artifacts.require("SimpleStorage");
module.exports = function(deployer) {
deployer.deploy(SimpleStorage, 42, {privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]})
};
But when I do truffle migrate, I get this error:
$ 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'
> Network id: 10
> Block gas limit: 3758096384
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0x0a55cd010bb30247c3ae303e54be8dd13177b520af5967728cf77e07ca9efe76
- Blocks: 0 Seconds: 0
> Blocks: 0 Seconds: 0
> contract address: 0x1932c48b2bF8102Ba33B4A6B545C32236e342f34
> account: 0xed9d02e382b34818e88B88a309c7fe71E65f419d
> balance: 1000000000
> gas used: 245462
> gas price: 0 gwei
> value sent: 0 ETH
> total cost: 0 ETH
- Saving migration to chain.
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0 ETH
2_deploy_simplestorage.js
=========================
Deploying 'SimpleStorage'
-------------------------
Error: *** Deployment Failed ***
"SimpleStorage" -- Invalid number of parameters for "undefined". Got 2 expected 1!.
at C:\Users\dany.vandermeij\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-deployer\src\deployment.js:364:1
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Truffle v5.0.1 (core: 5.0.1)
Node v8.11.4
When I don't add the "privateFor" parameter, it works:
var SimpleStorage = artifacts.require("SimpleStorage");
module.exports = function(deployer) {
deployer.deploy(SimpleStorage, 42)
};
But I need this privateFor parameter..
Does someone know how to fix this?

Hey @BlockChainProgrammer. Thanks for guiding me on how to use the Quorum proxy. It worked.
For this error, Try to upgrade/downgrade your truffle version to v4.1.
$ npm install -g truffle@4.1.10
and change the version of solidity to 0.4.24 in your truffle-config.js and the SimpleStorage.sol and add back privateFor in your migration file.
- Thanks mate. I will check it out in a few hours – BlockchainProgrammer Jan 24 at 7:34
- Hello, so you mean in SimpleStorage.sol this:
pragma solidity ^4.1.24;and in the truffle-config.js file this:solc: { version: "4.1.24", }? Because I get an error – BlockchainProgrammer Jan 24 at 7:45 - That's right. In both of them you need the same version. It worked for me. – exploringsincebirth Jan 24 at 7:52
- Also try to join this slack group, from the quorum website. – exploringsincebirth Jan 24 at 8:07
- Hello, I get this error:
SyntaxError: Source file requires different compiler version (current compiler is 0.4.24+commit.e67f0147.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma solidity ^4.1.24;– BlockchainProgrammer Jan 24 at 8:12
Problem solved!
What I had to do is to downgrade truffle to "4.1.10" with:
truffle uninstall -g
and then
npm install -g truffle@4.1.10
Truffle Smart Contract Error: Invalid number of parameter的更多相关文章
- smart contract 知识点
知识点 memory vs storage vs stack storage , where all the contract state variables reside. Every contra ...
- nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
iwangzheng.com tty:[0] jobs:[0] cwd:[/opt/nginx/conf] 12:45 [root@a02.cmsapi]$ /usr/local/nginx/sbin ...
- nginx重启报错:nginx: [error] invalid PID number "" in "/run/nginx.pid"
问题描述:执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错 nginx: [error] invalid PID number “” in “/run/ngin ...
- nginx: [error] invalid PID number “” in “/usr/local/var/run/nginx/nginx.pid”
在Mac上用brew安装Nginx,然后修改Nginx配置文件,再重启时报出如下错误: nginx: [error] invalid PID number "" in " ...
- nginx: [error] invalid PID number "" in "/run/nginx.pid"
在重启云主机(系统)之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错 nginx: [error] invalid PID number “” in “/ ...
- Centos7.5中Nginx报错:nginx: [error] invalid PID number "" in "/run/nginx.pid" 解决方法
服务器重启之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错 nginx: [error] invalid PID number "" ...
- [nginx报错问题]reload时报错:nginx: [error] invalid PID number "" in ...
错误 第一次探索nginx,执行以下命令时: nginx -s reload 报出错误: nginx: [error] invalid PID number "" in ... * ...
- 解决 nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
使用/usr/local/nginx/sbin/nginx -s reload 重新读取配置文件出错 [root@localhost nginx]/usr/local/nginx/sbin/nginx ...
- Using APIs in Your Ethereum Smart Contract with Oraclize
Homepage Coinmonks HOMEFILTER ▼BLOCKCHAIN TUTORIALSCRYPTO ECONOMYTOP READSCONTRIBUTEFORUM & JOBS ...
随机推荐
- Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (16944839 > 16777216). You can change this value on the server by setting the max_allowed_packet' variable.
今天发现task微服务的error日志报如下错误: Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large ...
- 【大数据】Clickhouse基础知识
第1章 ClickHouse概述 1.1 什么是ClickHouse ClickHouse 是俄罗斯的Yandex于2016年开源的列式存储数据库(DBMS),主要用于在线分析处理查询(OLAP),能 ...
- 【Distributed】分布式任务调度平台
一.概述 什么是定时任务 二.Java实现定时任务方式 2.1 Thread 2.2 TimerTask 2.3 ScheduledExecutorService 2.4 Quartz 引入maven ...
- JS 详解 Cookie、 LocalStorage 与 SessionStorage-转载
记录一下这些知识,有时候用到会忘记,对原文作者表达感谢. 附上原文链接:JS 详解 Cookie. LocalStorage 与 SessionStorage 基本概念 Cookie Cookie 是 ...
- SpringCloud各个组件通俗解析
https://www.cnblogs.com/lonelyJay/p/9936241.html
- 用Python来使用科大讯飞语音识别,so easy
在人工智能高速发展的今天,语音识别技术被带入到人们的工作和生活中,开始被越来越多的人关注和使用,今天,当各种在线客服被机器人客服代替,当速记翻译馆被语音识别代替,甚至当收银员.驾驶员.工厂工人.普通文 ...
- 2.数码相框-编码(ASCII/GB2312/Unicode)介绍
转载:https://www.cnblogs.com/lifexy/p/8485634.html 在上章-学习了数码相框的框架分析(1)了 本章主要内容如下: 1)熟悉ASCII/GB2312/Uni ...
- css中 禁止spa有点击状态
<span class="an" onclick="selNum();"></span> var selNum = function() ...
- linux bash环境变量简单总结
来源链接:http://www.178linux.com/8005 原创文章,如有转载,请注明原文地址 一.环境变量简介 Linux是一个多用户的操作系统.每个用户登录系统后,都会有一个专用的运行环境 ...
- ZooKeeper介绍(转载)
关于ZooKeeper,下面引用了一片文章,原文地址是:http://www.cnblogs.com/wuxl360/p/5817471.html 一.分布式协调技术 在给大家介绍ZooKeeper之 ...
