personal_signTransaction

描述:签名一个新的消息调用交易,如果数据字段中包含代码,则签名一个合约。

parameter

Object - 交易对象,结果如下:

参数名 数据类型 备注
from String, 20 字节 发送交易的源地址
to String, 20字节 交易的目标地址,当创建新合约时可选
gas String 交易执行可用 gas 量,可选整数,默认值 90000,未用 gas 将返还
gasPrice String gas 价格,默认值:待定(To-Be-Determined)
value String 交易发送的金额,可选整数
data String 合约的编译带啊或被调用方法的签名及编码参数
nonce String nonce,可以使用同一个nonce来实现挂起的交易的重写
密码 String 创建账户时的密码
"params": [{
    "from": "0xA6FB67336FA6678e63b82700eba6b6275B01B6DD",
    "to": "0x12699a74ab9A2D4208B41C6A73A38774E3f7851F",
    "gas": "0x76c0",
    "gasPrice": "0x9184e72a000",
    "value": "0x1",
    "nonce": "0x3",
    "data": ""
}, ""]

return

数据类型 备注
Object 签名后的交易对象
String 交易签名后的字符串

example

Request:

curl -X POST \
http://127.0.0.1:8283 \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "personal_signTransaction",
    "params": [{
        "from": "0xA6FB67336FA6678e63b82700eba6b6275B01B6DD",
        "to": "0x12699a74ab9A2D4208B41C6A73A38774E3f7851F",
        "gas": "0x76c0",
        "gasPrice": "0x9184e72a000",
        "value": "0x1",
        "nonce": "0x3",
        "data": ""
    }, ""]
}'

Response:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "raw": "0xf865038609184e72a0008276c09412699a74ab9a2d4208b41c6a73a38774e3f7851f01801ca0cf9961451e4e46088a25d6115cf877cee68ff73253797ebf7694b4c029fad097a020f0de45914e9a9d1e3013e8f43eb43683433a3fa26d1114a0c78fbf53e4df76",
        "tx": {
            "nonce": "0x3",
            "gasPrice": "0x9184e72a000",
            "gas": "0x76c0",
            "to": "0x12699a74ab9A2D4208B41C6A73A38774E3f7851F",
            "value": "0x1",
            "input": "0x",
            "v": "0x1c",
            "r": "0xcf9961451e4e46088a25d6115cf877cee68ff73253797ebf7694b4c029fad097",
            "s": "0x20f0de45914e9a9d1e3013e8f43eb43683433a3fa26d1114a0c78fbf53e4df76",
            "hash": "0xe52ab2c2ce83445f6931db583a805b7a281b13edcdbbd7c3aee3f6b6c22ff770"
        }
    }
}