Consumer Group

Initialization

const consumer = await broker.consumerGroup(topics, [options])
const consume = consumer.consume()

consume.on('message', message => {
    console.log('Message consumed: ', message)
})

Message Consumed

The message consumes Orchestrate’s Envelope corresponding to one transaction with Consumer Group Payload fields.

Consumer Group Payload

Field Type Description Example
topic string Name of the topic of the message consumed ‘topic-tx-decoded’
value orchestrate response object Response of the Orchestrate request { chain: { id: ‘888’ }, protocol: undefined,from: ‘0x7e654d251da770a068413677967f6d3ea2fea9e4’, tx: { txData: [Object], raw:‘0xf90c6609843b9 … 26a70348d8af78c’, hash: ‘0x7d2964f091440e202c67ff7853bbf2e1c73de7886698caa6b1b965348d34f055’ }, receipt: { txHash: ‘0x7d2964f091440e202c67ff7853bbf2e1c73de7886698caa6b1b965348d34f055’,blockHash: ‘0x9cd956c7209a0f768dcb902671273fa5f43cf4233316ee4d673acbbcb7546e92’, blockNumber: 7223, txIndex: 0, contractAddress: ‘0x07b847b7cf6f76176cac224a1d1ddc417ef3888b’, postState: ‘’, status: 1, bloom: ‘0x000000000 … 00000000000’, logsList: [Array], gasUsed: 815261, cumulativeGasUsed: 815261 }, errorsList: [], args: { call: [Object], pb_private: undefined }, metadata: { id: ‘8c668fc5-7984-4439-816f-f396cd377bb9’, extraMap: {} } }
offset number Message offset in the topic 10
partition number Partition of the message 0
key buffer Partition key of the message

Orchestrate Response Object

Field Type Description Example
chain object ChainId of the Orchestrate request { id: ‘888’ }
protocol protocol object Protocol to be used in the Orchestrate request { name: ‘quorum.tessera’, tag: ‘v2.2.2’, extraMap: {} }
from string Address supposed to sign the Orchestrate request ‘0x7e654d251da770a068413677967f6d3ea2fea9e4’
tx tx object Transaction detail to be executed { txData: [Object], raw: ‘0xf90c6609843b9 …26a70348d8af78c’, hash: ‘0x7d2964f091440e202c67ff7853bbf2e1c73de7886698caa6b1b965348d34f055’ }
receipt receipt object Receipt of the transaction { txHash: ‘0xf37291705cd42b6d2a49579a4b6f639eded6964f1c2c41fad920170c22c49534’, blockHash: ‘0x2311426739570437d12b0d266ac6efc06e231f4bbda2f7b635e3b4918ff16be6’, blockNumber: 12220907, txIndex: 0, contractAddress: ‘0x0000000000000000000000000000000000000000’, postState: ‘’, status: 1, bloom: ‘0x00000 … 000000’, logsList: [], gasUsed: 114252, cumulativeGasUsed: 114252 }
errorsList array List of errors from Orchestrate when processing this Orchestrate request [ { message: ‘rpc error: code = Internal desc = Could not load by TxHash pg: no rows in result set chain_id:”42” tx_hash:”0xf37291705cd42b6d2a49579a4b6f639eded6964f1c2c41fad920170c22c49534” ‘, code: 0, extraMap: [] } ]
args args object Arguments of the transaction (including private args if needed) { call: {contract: [Object], method: [Object], args: []}, pb_private: undefined }
metadata metadata object Metadata included in the Orchestrate request { id: ‘8c668fc5-7984-4439-816f-f396cd377bb9’, extraMap: {} }

Protocol Object

Field Type Description Example
name string Name of the protocol ‘ethereum.constantinople’, ‘besu.orion’
tag string Version tag of the protocol ‘v2.2.4’
extra object Extra information {test: ‘test’}

Tx Object (Response)

Field Type Description Example
txData txData object Fields used to sign the transaction { nonce: 4, to: ‘0xc7b043d83…67e8d8d8333a66880’, value: undefined, gas: 2000000, gasPrice: ‘1000000000’, data: ‘0xa9059cbb00000000 … 0000000186a0’ }
raw string(hex) Signed transaction ‘0xf8ab04843b9aca … 6e7f832b3c96d49f8e2’
hash array Transaction hash stored in the Orchestrate request ‘0x0a0cafa26ca3f411…d7a72e534136104b5447a210’

TxData Object (Response)

Field Type Description Example
nonce number Nonce used for the transaction 4
to string(hex) Account or smart contract address ‘0xc7b043d83…7e8d8d8333a66880’
value string(number) Value to transfer ‘20000’
gas number Gas limit to be consumed for this transaction 2000000
gasPrice string(number) Gas price used or this transaction ‘2000000’
data string(hex) Hash of the method signature (4 bytes) followed by encoded parameters ‘0xa9059cbb00000000000 … 0002386f26fc10000’

Receipt Object (Response)

Field Type Description Example
txHash string Hash this transaction ‘0xa6e9939bf85a119e38bba…64954c6c4d6991399579c1’
blockHash string Hash of the block where this transaction was in ‘0x7bf0bd196dc53693c7d74c…da37313f5b3aae3aa8f59’
blockNumber number Block number where this transaction was in 683
txIndex number Index of this transaction inside the block 0
contractAddress string(hex) The contract address created, if the transaction was a contract creation, otherwise null ‘0xe5ce65038f9d1c841a33cc816ee674f8a0e31e74’
bloom string(hex) The bloom filter for the logs of the block ‘0x000200000 … 0000000000’
status number 0 indicates transaction failure , 1 indicates transaction succeeded 1 or 0
postState string NA NA
logsList array[log object] List of logs (aka. events) of the transaction [ { address: ‘0xe5ce65038f9d1c841a33cc816ee674f8a0e31e74’, topicsList: [Array], data: ‘0x000000000 … e0c9bab2400000’, event: ‘Approval(address,address,uint256)’, decodedDataMap: [Object], blockNumber: 483, txHash: ‘0xa6e9939bf85a1 … 6c4d6991399579c1’, txIndex: 0, blockHash: ‘0x30d88cdd7511 … 3f09cde23d681a6’, index: 0, removed: false } ]
gasUsed number The amount of gas used by this specific transaction alone 815261
cumulativeGasUsed number The total amount of gas used when this transaction was executed in the block 815261

Log Object (Response)

Field Type Description Example
address string(hex) Contract address ‘0xa6e9939bf85a119e38bba74a…6c4d6991399579c1’
topicsList array[string(hex)] List of the event signature and hashes of event’s indexed arguments ’[‘0xddf252ad1be2c89b…c4a11628f55a4d23b3ef’, ‘0x00000000000000000…000000000000000000’, ‘0x000000000000000…13677967f6d3ea2fea9e4’ ]’
data string Data of the non-indexed arguments of the event ‘0x00000000…0000000000021e19e0c9bab2400000’
event string Event signature ‘Approval(address,address,uint256)’
decodedDataMap object Decoded event with value as string format. Arrays should be parsed as JSON { owner: ‘0x000000000…000000000000000000’, spender: ‘0x7E654d251…3677967F6d3Ea2FeA9E4’, value: ‘10000000000000000000000’ }
blockNumber number Block number that includes this event 50
txHash number Transaction hash that includes this event ‘0xa6e9939bf85a…0482c064954c6c4d6991399579c1’
txIndex number Transaction index that includes this event 0
blockHash string(hex) Block hash that includes this event ‘0xc448362abbebe…7481edfdb973f592fc4e6787ec’
index number Index of the event 0
removed bool True when the log was removed, due to a chain reorganization. false if its a valid log. true or false

Args Object (Response)

Field Type Description Example
call call object Fields related to the transaction call (contract, method, arguments) { contract: { id: { name: ‘SimpleToken’, tag: ‘’ }, abi: ‘’, bytecode: ‘’, deployedbytecode: ‘’ },method: { signature: ‘constructor()’, abi: ‘’ }, argsList: [] }
pb_private private object Fields related to privacy protocol

Call Object (Response)

Field Type Description Example
contract object Fields related to the contract for the Orchestrate Request { id: { name: ‘SimpleToken’, tag: ‘’ }, abi: ‘’, bytecode: ‘’, deployedbytecode: ‘’ }
method method object Fields related to the method called for the Orchestrate Request { signature: ‘transfer(address,uint256)’, abi: ‘’ }
argsList array Inputs of method call [ ‘0xdbb881a51cd4…f3ef73046743f08da3’, ‘100’ ]

Contract Object (Response)

Field Type Description Example
id id Contract Object (Response) id given to the contract on the registry ‘ id: { name: ‘SimpleToken’, tag: ‘’ }’
abi object/json ABI in json format to call ’[{ constant:false, inputs: [{name:’recipient’,type:’address’},{name:’amount’,type:’uint256’}], name:’transfer’, outputs:[ {name:’‘,type:’bool’} ] payable: false, stateMutability: ‘nonpayable’, type: ‘function’ }]’
bytecode string(hex) Contract bytecode ‘0x608060405234 .... e578063995fac’
deployed bytecode string(hex) Contract deployed bytecode ‘0x606060526004 .... 1006a188ef215’

id Contract Object (Response)

Field Type Description Example
name string Name of the contract stored in the ABI registry ‘SimpleToken’
tag string Tag version to query in the contract registry ‘v0.2.0’

Method Object

Field Type Description Example
signature string Signature of the method referenced in the ABI registry ‘transfer(address,uint256)’ ‘constructor()’
abi object/json Method ABI in json format to craft and call ’{ constant:false, inputs:[{name:’recipient’,type:’address’},{name:’amount’,type:’uint256’}], name:’transfer’, outputs:[ {name:’‘,type:’bool’} ] payable: false, stateMutability: ‘nonpayable’, type: ‘function’ }’

Private Object (Response)

Field Type Description Example
privateFrom string When sending a private transaction, the sending party’s base64-encoded public key to use ‘ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc=’
privateFor array[string] When sending a private transaction, an array of the recipients’ base64-encoded public keys [‘ROAZBWtSacx…FePR5ce4TSIzmJ0Bc=’]
privateTxType string For Quorum >=2.2.1 support NA

Metadata Object

Field Type Description Example
id string Id to attach in the Orchestrate request ‘a78b0e65-2ae5-48c3-97d0-0c3a2bbe8110’
extra object Extra metadata to attach in the Orchestrate request {extra1: ‘testExtra1’, extra2: ‘testExtra2’}