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. TypeScript入门七:TypeScript的枚举

    关于枚举 数字枚举 字符串枚举 异构枚举 计算的和常量成员 运行时的枚举与反向映射 常量枚举与外部枚举 一.关于枚举 枚举:一个集的枚举是列出某些有穷序列集的所有成员的程序,或者是一种特定类型对象的计 ...

  2. sql语句开启事务

    以下为示例代码: begin tran update 表 where 姓名='A' update 表 where 姓名='B' rollback else commit

  3. 【Linux】Linux基本命令

    一.Linux关机 shutdown -h 10 10min后关机 shutdown -h 10:00   10:00关机 shutdown -h now 或 halt 或 poweroff 立即关机 ...

  4. bond模式详解

    目录 bond模式详解 一.什么是bond? 二.为什么使用bond? 三.bond模式配置 1.配置linux bond 2.将bond绑定到ovs上面(可选) 四.bond模式 1.模式0 2.模 ...

  5. idou老师教你学Istio 19 : Istio 流量治理功能原理与实战

    一.负载均衡算法原理与实战 负载均衡算法(load balancing algorithm),定义了几种基本的流量分发方式,在Istio中一共有4种标准负载均衡算法. •Round_Robin: 轮询 ...

  6. elasticsearch查询:启动项目报错No property ... found for...Did you mean '...'?

    网上找的案例是: 实体类字段定义:private String sku_no;dao中接口名定义:Goods findBySkuNo(String skuNo);spring-data按照接口方法定义 ...

  7. 前端知识体系:JavaScript基础-原型和原型链-理解 es6 中class构造以及继承的底层实现原理

    理解 es6 中class构造以及继承的底层实现原理 原文链接:https://blog.csdn.net/qq_34149805/article/details/86105123 1.ES6 cla ...

  8. Idea中提交SVN或git时,忽略某些文件不提交

    第一步:点击 setting 第二步:点击Editor下的File Types 第三步:编辑,在后面添加 *.iml;*.idea;*.gitignore;*.sh;*.classpath;*.pro ...

  9. 执行mysql脚本文件

    一般都是连接mysql执行sql语句: 在命令行下输入 mysql -h localhost -u root -p回车,然后输入密码即可; 或直接运行mysql自带的连接工具,然后输入密码即可. 执行 ...

  10. 自定义错误throw

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...