Send transactions via RPC

Merkle supports sending transactions via the standard eth_sendRawTransaction and the eth_sendPrivateTransaction methods.

Your custom RPC endpoint can be found in the merkle dashboard.

eth_sendRawTransaction

Example of a request:

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
    "params": [
        "0xf869018203e882520894f17f52151ebef6c7334fad080c5704d77216b732881bc16d674ec80000801ba02da1c48b670996dcb1f447ef9ef00b33033c48a4fe938f420bec3e56bfd24071a062e0aa78a81bf0290afbc3a9d8e9a068e6d74caa66c5e0fa8a46deaae96b0833",
        "customer-123" // optional source tag
    ],
}

Example of a response:

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

eth_sendPrivateTransaction

This RPC is similar to eth_sendRawTransaction

Example of a request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_sendPrivateTransaction",
  "params": [
    {
      "tx": "0x1111ddddd...",
      "maxBlockNumber": "0x00000", // not used, backward compatibility
      "source": "customer-123", // optional source tag
      "preferences": {
        "fast": true, // not used, backward compatibility
      }
    }
  ]
}

The response is similar to eth_sendRawTransaction

{    
    "id": 1,
    "jsonrpc": "2.0",
    "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

eth_sendRawPrivateTransaction

This RPC is the same as eth_sendPrivateTransaction and only exists for compatibilty.

Example of a request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_sendRawPrivateTransaction",
  "params": [
    {
      "tx": "0x1111ddddd...",
      "maxBlockNumber": "0x00000", // not used, backward compatibility
      "source": "customer-123", // optional source tag
      "preferences": {
        "fast": true, // not used, backward compatibility
      }
    }
  ]
}

The response is similar to eth_sendRawTransaction

{    
    "id": 1,
    "jsonrpc": "2.0",
    "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

eth_getTransactionByHash

This RPC method mimics eth_getTransactionByHash for private transactions.

Example of a request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionByHash",
  "params": [
    "0x..." // transaction hash
  ]
}

The response is similar to eth_getTransactionByHash, however, the fields gasPrice, v, r and s are removed.

{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "blockHash" : "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
      "blockNumber" : "0x5bad55",
      "chainId" : "0x1",
      "from" : "0x398137383b3d25c92898c656696e41950e47316b",
      "gas" : "0x1d45e",
      "gasPrice" : "0x0",
      "hash" : "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
      "input" : "0xf7d8c88300000000000000000000000000000000000000000000000000000000000cee6100000000000000000000000000000000000000000000000000000000000ac3e1",
      "nonce" : "0x18",
      "r" : "0x0",
      "s" : "0x0",
      "to" : "0x0",
      "transactionIndex" : "0x11",
      "type" : "0x0",
      "v" : "0x0",
      "value" : "0x1c6bf526340000"
   }
}

Last updated