Producer

Initialization

const producer = await broker.producer(topic, [options])
  • topic string (optional - default=topic-tx-crafter): Kafka topic where to produce message.
  • options object (optional): see Kafka-node producer options.

Send

const producerPayload = {
    chainId: '888',
    to: '0xc7b043d83553ffaa8a3a09e67e8d8d8333a66880',
    call: {
        method: 'transfer(address,uint256)',
        args: ['0xdbb881a51cd4023e4400cef3ef73046743f08da3', '100000']
    },
    gas: 2000000,
    from: '0x7e654d251da770a068413677967f6d3ea2fea9e4'
}
const tx = await producer.send(producerPayload)

Returns

  • offset: number: offset of the message sent.
  • id: string: the metadata id created by Orchestrate is not declared in the message.
{ offset: 9, id: '5b479d04-8dcc-498d-af51-c3e456a070f4' }

Producer Payload

Field Type Description Example
chainId string(number) The chain id to send the transaction ‘3’, ‘42’
to string(hex) Address of the recipient of the transaction ‘0x8f371DAA8A5325f53b754A7017Ac3803382bc847’
value string(number) hex Value to transfer
from string(hex) Public address that will sign the transaction ‘0xd71400daD07d70C976D6AAFC241aF1EA183a7236’
protocol protocol object Add details on the transaction protocol { name: ‘quorum.tessera’, tag: ‘v2.2.2’ }
privateFrom string(base64) When sending a private transaction, the sending party’s base64-encoded public key to use. If not present and passing private_for, use the default key as configured in Quorum TransactionManager ‘ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc=’
privateFor array[string] When sending a private transaction, an array of the recipients’ base64-encoded public keys ’[‘ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc=’]’
call call object Field to detail the transaction method to call {contract: ‘SimpleToken’, method: ‘transfer(address,uint256), args: [‘0xd71400daD07d70C976D6AAFC241aF1EA183a7236’, 100000]}
raw string(hex) Signed transaction. This field is only useful in the payload when sending raw transactions, please check the how-to to know more. ‘0xf8ab04843b9aca … 6e7f832b3c96d49f8e2’
metadata string - metadata object Name of the contract to deploy (only used for constructor(…) method) ‘d4fc5002-5ba2-43e3-8591-5f46fcb4412f’, {id: ‘d4fc5002-5ba2-43e3-8591-5f46fcb4412f’, extra: {test: ‘testId’}}

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’}

Call Object (Request)

Field Type Description Example
contract string - contract object Name of the contract to deploy (only used for constructor(…) method) ‘SimpleToken’, {name: ‘SimpleToken’, tag:’v0.2.0’}
method string - method object Name of the contract to deploy (only used for constructor(…) method) ‘transfer(address,uint256)’ {signature:’constructor()’}
args (string-number-bool-array)[ ] List of arguments to call the method Possible args: bool: true/false uint/int: string(number/hex)/number address: string(hex) bytes: string(hex) string: string array: array[bool/uint/int/address/bytes] [‘arg1’, true, 200]

Contract Object (Request)

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’
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’

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’}’

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’}