通过 JSON RPC API 向以太坊合约发送交易

Send transactions to Ethereum contracts via JSON RPC API

我正在玩 geth 并希望通过 JSON RPC API 与合约进行交互。但是,我很困惑,因为 eth.sendTransaction API.

中没有 input 的位置

Per Ethereum Gitbooketh.sendTransaction 接受这样的参数:

params: [{
  "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
  "to": "0xd46e8dd67c5d32be8058bb8eb970870f072445675",
  "gas": "0x76c0", // 30400,
  "gasPrice": "0x9184e72a000", // 10000000000000
  "value": "0x9184e72a", // 2441406250
  "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]

所有这些字段都有意义,但没有指定输入的地方。使用其他工具,例如控制台和 Web 应用程序,我可以 sendTransaction 并注意到 TX 采用如下形式:

> eth.getTransactionFromBlock(60)
{
  blockHash: "0xc386191621e45e170d50c1caacc9090b7117e09d0847c46f77f6a3c822ec5580",
  blockNumber: 60,
  from: "0xd9b56ae6e0f7a7e0e0dec74b685b2c7f3f543472",
  gas: 66666,
  gasPrice: 50000000000,
  hash: "0x28aa9e720e11f2f81490b6500a3a56c19ec77b936fc745d16c302387837f324e",
  input: "0xc6888fa10000000000000000000000000000000000000000000000000000000000000064",
  nonce: 6,
  to: "0x689495d3e1ff1b955bc4d0bde622bdb34dbb787b",
  transactionIndex: 0,
  value: 0
}

注意有一个输入字段。那么是否可以通过 JSON RPC API 发送交易?如果是这样,应该使用哪个 API?

事务输入由 eth_sendTransaction RPC 消息的 data 参数表示。