HomeDeveloper MaterialsEnterprise App Gateway via KafkaStream Transactions over Webhooks

Stream Transactions over Webhooks

You can use a standard REST client like Postman to connect to your node’s Webhook and easily stream Ethereum transactions modeled as lightweight YAML via the Kafka-backed EthConnect tier. EthConnect will assemble the object into a properly formed Ethereum transaction, sign it with the private key of the specified account address and provide reliable delivery to your Kaleido chain.

Note that the following information is also available in-console via the REST API Gateway in Kaleido Connect.  You can access the REST Gateway by clicking the Connect option on the node dropdown or by viewing the node details and clicking the + CONNECT button in the upper right portion of the details screen.

Set up the connection

  • Generate an Application Credential in the Kaleido console
    • Make sure to leave the console open with the credentials displayed until you have copied them
  • Open your favorite REST client, such as Postman
  • Set the Authorization type to Basic Auth in the REST client
  • Set the Username to the username from your application credential
  • Set the Password to the password from your application credential
  • Back in the Kaleido console, go to your node details
    • You will need the WEBHOOKS URL and the Ethereum Address in the USER ACCOUNTS row
  • Back in the REST client, Set the Method to POST
  • Set the URL to the WEBHOOKS URL of your node, for example https://u0d7zazjno-u0aopxc5lf-connect.us-east-2.kaleido.io
  • Set the Body type to Raw

Submit a simple request to deploy a contract

  • Define the body as follows – replacing the placeholder 0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with your USER ACCOUNTS address. Note that this snippet uses YAML format for the sake of readability, however JSON syntax is also supported:

    type: DeployContract
from: "0x00000000000000000000000000000000000"
    - 12345
gas: 100000000
compilerVersion: '0.5'
solidity: |-
    pragma solidity >=0.4.24 <0.6.0;
     * @title Simple Storage
     * @dev Read and write values to the chain
    contract simplestorage {
        uint public storedData;
         * @dev Constructor sets the default value
         * @param initVal The initial value
        constructor(uint initVal) public {
            storedData = initVal;
         * @dev Set the value
         * @param x The new value
        function set(uint x) public {
            storedData = x;
         * @dev Get the value
        function get() public view returns (uint retVal) {
            return storedData;
  • Submit the request

You should see a response similar to the following:

    "sent": true,
    "id": "e95a9197-c2f7-4775-767b-85ab9b0535b6"

Get the reply

  • Change the Method to GET
  • Add /replies to the URL, for example https://u0d7zazjno-u0aopxc5lf-connect.us-east-2.kaleido.io/replies
  • Submit the request

If you see [] as the response, you need to retry this step as the request has not yet been processed by the Ethereum node. Depending on the consensus algorithm being used by your chain, it could take up to 20 seconds for the reply to be received

  • You should see a response similar to the following – if so you have just committed a transaction into a block on your chain:
      "_id": "10b24e3b-6160-46f2-7ea9-518d276fe50a",
      "blockHash": "0x98f25e4f0d5c5578eb211ee763799d2a62dcc14cc8127188106019768c365f70",
      "blockNumber": "17127",
      "blockNumberHex": "0x42e7",
      "cumulativeGasUsed": "134221",
      "cumulativeGasUsedHex": "0x20c4d",
      "gasUsed": "134221",
      "gasUsedHex": "0x20c4d",
      "headers": {
          "id": "6d7a4dfc-e735-4a10-719a-05feac8669b2",
          "requestId": "10b24e3b-6160-46f2-7ea9-518d276fe50a",
          "requestOffset": "u0d7zazjno-u0aopxc5lf-requests:0:5",
          "timeElapsed": 9.350811604,
          "timeReceived": "2018-07-27T18:25:36Z",
          "type": "TransactionSuccess"
      "receivedAt": 1532715946473,
      "status": "1",
      "statusHex": "0x1",
      "to": null,
      "transactionHash": "0xc7b755b2253c75b453bb2e3b92741d16503097dad50d7e5e586c19c32d0c6c6e",
      "transactionIndex": "0",
      "transactionIndexHex": "0x0"

Submit a transaction to the newly deployed contract

  • Set the Method back to POST
  • Set the URL back to the base / URL, for example https://u0d7zazjno-u0aopxc5lf-connect.us-east-2.kaleido.io/
  • Set the body as follows:
    • Replacing the 0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX placeholder for the from: parameter with your USER ACCOUNTS address
    • Replacing the 0xYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY placeholder for the to: parameter with the contractAddress you received in the response payload after deploying the contract

  type: SendTransaction
  - value: 4276993775
    type: uint256
gas: 1000000
methodName: set
  • Repeat the steps in the Get the Reply section above to see the result

You will continue to see the old reply until the transaction has been processed Depending on the consensus algorithm being used by your chain, it could take up to 20 seconds for the reply to be processed

Use the Block Explorer to see your transactions on the chain

See Navigating the Block Explorer to learn more about the features of the Kaleido Block Explorer.