Ethereum 通过JSON RPC API向以太坊合同发送事务

Ethereum 通过JSON RPC API向以太坊合同发送事务,ethereum,Ethereum,我正在玩geth,希望通过JSON RPC API与合同进行交互。然而,我感到困惑,因为在eth.sendTransactionAPI中没有input的位置 Per,eth.sendTransaction接受如下参数: params: [{ "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": "0xd46e8dd67c5d32be8058bb8eb970870f072445675", "gas": "0x76c0",

我正在玩
geth
,希望通过JSON RPC API与合同进行交互。然而,我感到困惑,因为在
eth.sendTransaction
API中没有
input
的位置

Per,
eth.sendTransaction
接受如下参数:

params: [{
  "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
  "to": "0xd46e8dd67c5d32be8058bb8eb970870f072445675",
  "gas": "0x76c0", // 30400,
  "gasPrice": "0x9184e72a000", // 10000000000000
  "value": "0x9184e72a", // 2441406250
  "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]
> 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
}
所有这些字段都有意义,但没有地方指定输入。使用其他工具,如控制台和web应用程序,我可以
sendTransaction
,并注意到TX的形式如下:

params: [{
  "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
  "to": "0xd46e8dd67c5d32be8058bb8eb970870f072445675",
  "gas": "0x76c0", // 30400,
  "gasPrice": "0x9184e72a000", // 10000000000000
  "value": "0x9184e72a", // 2441406250
  "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]
> 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
param表示。

很高兴您能回答。在哪里可以找到有关
数据编码的更多信息?我搜索了gitbook,但没有任何线索。这取决于你的合同在做什么,以及它是如何建立的。如果它来自坚固或蛇语,它将遵循以太坊契约ABI:。