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. 关于cubic-bezier 贝塞尔曲线的简单了解

    在animation和transition两个属性中,cubic-bezier是控制变化的速度曲线,主要是生成速度曲线的函数 规定用法是: cubic-bezier(<x1>,<y1 ...

  2. K2 BPM_北汽新能源业务流程管理信息系统建设思考_全球领先的工作流引擎

    本文由CIO发展中心根据北汽新能源流程与IT总监刘伟霞在“亦庄CIO数字化转型探索——CIO发展中心亦庄分舵2019夏季论坛”活动中演讲整理. 在“亦庄CIO数字化转型探索——CIO发展中心亦庄分舵2 ...

  3. iOS分类(category),类扩展(extension)—史上最全攻略

    背景: 在大型项目,企业级开发中多人同时维护同一个类,此时程序员A因为某项需求只想给当前类currentClass添加一个方法newMethod,那该怎么办呢? 最简单粗暴的方式是把newMethod ...

  4. OpenCV 图象腐蚀形态学操作 全家桶

    图象腐蚀与形态学操作 opencv 1. 通过调用库函数实现图像的腐蚀.膨胀: 2. 通过设置结构元素.元素大小.形态学操作类型实现对图象的形态学操作. 源码(VS2017+OpenCV 4.0) # ...

  5. Python之定义默认参数

    定义函数的时候,还可以有默认参数. 例如Python自带的 int() 函数,其实就有两个参数,我们既可以传一个参数,又可以传两个参数: >>> int('123') 123 > ...

  6. JAVA 泛型 通配符? extends super限定,实例区分extends super限定的作用用法

    java泛型中的关键字 ? 表示通配符类型 <? extends T> 既然是extends,就是表示泛型参数类型的上界,说明参数的类型应该是T或者T的子类. <? super T& ...

  7. We're sorry but mobile doesn't work properly without JavaScript enabled. Please enable it to continue.

    vue过程中遇见这个问题:We're sorry but mobile doesn't work properly without JavaScript enabled. Please enable ...

  8. Java基础 与时间日期相关的类:System -Date -SimpleDateFormat -Calendar类 -解决后缀.000Z 的时区问题

    笔记总结: /**与时间相关的类:System_Date_SimpleDateFormat_Calendar类 * 1.system 类下的currentTimeMillis() * 输出从1970年 ...

  9. Vue -- element-ui FileSaver.js 导出

    html <el-button type="danger" @click="exportRs">导出Excel报表</el-button> ...

  10. git 在eclipse中忽略上传文件

    在我们的工程项目中,有些文件是不需要上传到服务器上的,比如那些 */target/ */bin/*.settings/*.classpath*.gitignore*.project 我们将这些文件添加 ...