我正在尝试基于以下示例在javascript SDK中实现一个事务处理器。
https://github.com/hyperledger/sawtooth-core/blob/master/sdk/examples/intkey_javascript/index.js
下面是我在javascript SDK中运行事务处理器的代码
//validator public key
const validatorAddress = '024c512a6d66917d7d00f52fa299a88594915dab27bddbcd2a80154984d7948c3c';
const IntegerKeyHandler = require('./handler');
const startProcessor = function startProcessor(){
const transactionProcessor = new TransactionProcessor(validatorAddress);
transactionProcessor.addHandler(new IntegerKeyHandler())
transactionProcessor.start()
}
但我收到无效参数错误
错误:在(/var/accubits-workspace/hypeerledger-sawtooth/tuts/node_modules/sawtooth-sdk/messaging/stream.js:85:18) (/var/accubits-workspace/hypeerledger-sawtooth/tuts/node_modules/sawtooth-sdk/processor/index.的Stream.connect (/var/accubits-workspace/hypeerledger-sawtooth/tuts/node_modules/zeromq/lib/index.js:510:13)上的exports.Socket.Socket.connect Stream.connect的参数无效js:72:18) at Object.startProcessor (/var/accubits-workspace/hypeerledger-sawtooth/tuts/index.js:62:26) at Layer.handle as handle_request at next (/var/accubits-workspace/hypeerledger-sawtooth/tuts/node_modules/express/lib/router/route.js:137:13) at Route/var/accubits-workspace/hypeerledger-sawtooth/tuts/node_modules/express/lib/router/index.js:281:22
的Layer.handle as handle_request的.dispatch (/var/accubits-workspace/hypeerledger-sawtooth/tuts/node_modules/express/lib/router/route.js:112:3)
发布于 2018-07-02 16:27:09
将验证器地址更改为验证的url,可以是tcp://validator:4004
或tcp://localhost:4004
下面是完整的代码:
'use strict'
const { TransactionProcessor } = require('sawtooth-sdk/processor')
const IntegerKeyHandler = require('./integer_key_handler')
const address = 'tcp://validator:4004' // If you are not running it inside docker container then change the address to this tcp://localhost:4004
const transactionProcessor = new TransactionProcessor(address);
transactionProcessor.addHandler(new IntegerKeyHandler());
transactionProcessor.start();
https://stackoverflow.com/questions/51131415
复制相似问题