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. K2 BPM_“选BPM还是RPA?”,这不是一道单选题_全业务流程管理专家

    在我们和企业讨论流程自动化的时候,经常会被问到一个问题,“公司目前正在调研市面上的业务流程自动化产品,我们已经把选择范围缩小到了BPM和RPA之间.我们应该怎么选择?BPM能做的好像RPA都能做到.” ...

  2. mongodb聚合查询-aggregate

    Mongodb-aggregate 在工作中经常遇到一些mongodb的聚合操作,和mysql对比起来,mongo存储的可以是复杂的类型,比如数组,字典等mysql不善于处理的文档型结构,但是mong ...

  3. 用java代码实现

    用java代码实现(1)珠穆朗玛峰高度为8848米,有一张足够大的纸,厚度为0.001米. (2)请问,我折叠多少次,可以折成珠穆朗玛峰的高度/** * @author 18269 * @date 2 ...

  4. 【问题】redhat安装dig

    转自:https://blog.csdn.net/ricky_hust/article/details/8868131 最终可行的方法 在linux下没有单独的dig和nslookup的包,而是以bi ...

  5. 【前端】低版本IE浏览器访问网站一片空白

    最近在客户那里,发现一个奇葩的问题,系统上IE浏览器访问网站一片空白,显示无法访问. 但是相同的网站系统,在我们的电脑上又可以访问且IE浏览器版本相同,没法只有,装虚拟模拟客户环境复现一下了. 发现在 ...

  6. 多线程 multiprocessing 的几个小例子

    1.Pipe import multiprocessing as multip,time from multiprocessing import Process,Pipe,Event,Conditio ...

  7. 有关PHPstorm的git环境的配置和git密钥的生成总结

    phpstorm上配置git环境的配置总感觉很简单,没发现看似简单的东西浪费我好多时间.我在网上查了一下关于phpstorm的git环境的配置没有具体的总结 所以我把自己的配过程简单总结了一下 接下来 ...

  8. 保护你的Linux系统的九个老生常谈

    在现在这个世道中,保障基于Linux的系统的安全是十分重要的.但是,你得知道怎么干.一个简单反恶意程序软件是远远不够的,你需要采取其它措施来协同工作.那么试试下面这些手段吧. 1. 使用SELinux ...

  9. Java File类方法使用详解

    Java File类的功能非常强大,利用java基本上可以对文件进行所有操作.文本将对Java File 文件操作的类详细的分析,并将File类中的常用方法进行简单介绍. 构造函数 public cl ...

  10. 【51nod 1340】地铁环线

    题目 有一个地铁环线,环线中有N个站台,标号为0,1,2,...,N-1.这个环线是单行线,一共由N条有向边构成,即从0到1,1到2,..k到k+1,...,N-2到N-1,N-1到0各有一条边.定义 ...