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?

 
BlockchainProgrammer

 
asked Jan 22 at 8:37
BlockchainProgrammerBlockchainProgrammer

16111 gold badge22 silver badges1717 bronze badges
 
 

2 Answers 2

1
 

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.

answered Jan 24 at 5:00
exploringsincebirthexploringsincebirth

1155 bronze badges
  

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的更多相关文章

  1. smart contract 知识点

    知识点 memory vs storage vs stack storage , where all the contract state variables reside. Every contra ...

  2. 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 ...

  3. nginx重启报错:nginx: [error] invalid PID number "" in "/run/nginx.pid"

    问题描述:执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错 nginx: [error] invalid PID number “” in “/run/ngin ...

  4. nginx: [error] invalid PID number “” in “/usr/local/var/run/nginx/nginx.pid”

    在Mac上用brew安装Nginx,然后修改Nginx配置文件,再重启时报出如下错误: nginx: [error] invalid PID number "" in " ...

  5. nginx: [error] invalid PID number "" in "/run/nginx.pid"

    在重启云主机(系统)之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错 nginx: [error] invalid PID number “” in “/ ...

  6. Centos7.5中Nginx报错:nginx: [error] invalid PID number "" in "/run/nginx.pid" 解决方法

    服务器重启之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错 nginx: [error] invalid PID number "" ...

  7. [nginx报错问题]reload时报错:nginx: [error] invalid PID number "" in ...

    错误 第一次探索nginx,执行以下命令时: nginx -s reload 报出错误: nginx: [error] invalid PID number "" in ... * ...

  8. 解决 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 ...

  9. Using APIs in Your Ethereum Smart Contract with Oraclize

    Homepage Coinmonks HOMEFILTER ▼BLOCKCHAIN TUTORIALSCRYPTO ECONOMYTOP READSCONTRIBUTEFORUM & JOBS ...

随机推荐

  1. python日志实时分析

    python随着人工智能的发展,越来越火热.但其实python在运维测试方面,也是一把利器. 最近就碰到了个需求,就顺手写了个python程序.用惯了go,不过发现python好像更简单点 :-) 涉 ...

  2. SpringBoot中使用POI,快速实现Excel导入导出

    导出Excel 整体来说,Excel有.xls和.xlsx,那么在POI中这两个也对应两个不同的类,但是类名不同,方法基本都是一致的,因此我这里将只介绍.xls一种. 整体来说,可以分为如下七个步骤: ...

  3. 解决ios8下coreData没有NSPersistentContainer的问题

    用Xcode8.1默认创建ios app的时候,使用coreData的话,要10.0以上的版本才行.因为NSPersistentContainer只有10.0以上的版本才有,10.0以下的版本是没有的 ...

  4. js 加解密方法

    一:最简单的加密解密 (ansi转usc2) 大家对于JAVASCRIPT函数escape()和unescape()想必是比较了解啦(很多网页加密在用它们),分别是编码和解码字符串,比如例子代码用es ...

  5. CentOS7使用Qemu模拟ARM64

    准备 RPM包安装 yum安装交叉编译工具 yum install -y binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu bison flex gli ...

  6. python3 Pandas

    一.Pandas 1.Python Data Analysis Library 或 pandas 是基于NumPy 的一种工具,主要用于数据处理(数据整理,操作,存储,读取等) 2.http://pa ...

  7. 正则的lastIndex 属性

    简介:正则的lastIndex 属性用于规定下次匹配的起始位置. 注意: 该属性只有设置标志 g 才能使用. 上次匹配的结果是由方法 RegExp.exec() 和 RegExp.test() 找到的 ...

  8. vue1 get,post交互及百度下拉列表demo

  9. vue,react,angular三大web前端流行框架简单对比

    常用的到的网站 vue学习库: https://github.com/vuejs/awesome-vue#carousel (json数据的格式化,提高本地测试的效率) json在线编辑: http: ...

  10. [Google Guava] 4-函数式编程

    原文链接 译文链接 译者:沈义扬,校对:丁一 注意事项 截至JDK7,Java中也只能通过笨拙冗长的匿名类来达到近似函数式编程的效果.预计JDK8中会有所改变,但Guava现在就想给JDK5以上用户提 ...