contract_maintainContract
升级合约、冻结合约、解冻合约。 只有合约的部署者才拥有升级合约、冻结合约、解冻合约的权限。
Parameters
<Object>
from
:<string>
- 20字节的十六进制字符串,交易发送方的地址。to
:<string>
- 20字节的十六进制字符串,合约地址。nonce
:<number>
- 16位随机数,该值必须为十进制整数。extra
:<string>
-[可选] 交易的额外信息。timestamp
:<number>
- 交易发生时间戳(单位ns)。payload
:<string>
- [可选] 编译后的新合约字节码。升级合约才需要这个字段。signature
:<string>
- 交易签名。type
:<string>
- 指定合约执行引擎,默认为“evm”。如果合约代码由java语言编写,则需要设置该值为“jvm”。opcode
: 值为1
表示升级合约,值为2
表示冻结合约、值为3
表示解冻合约。
注解
说明:to合约地址需要在部署完合约以后,调用 tx_getTransactionReceipt 方法来获取。
Returns
<string>
- 32字节的十六进制字符串,交易的哈希值。
Example1:升级合约
- # Request
- curl localhost:8081 --data '{"jsonrpc":"2.0", "namespace":"global", "method": "contract_maintainContract","params":[{
- "from": "17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
- "to":"0x3a3cae27d1b9fa931458b5b2a5247c5d67c75d61",
- "timestamp":1481767474717000000,
- "nonce": 8054165127693853,
- "payload":"0x6fd7cc16000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
- "signature":"0x19c0655d05b9c24f5567846528b81a25c48458a05f69f05cf8d6c46894b9f12a02af471031ba11f155e41adf42fca639b67fb7148ddec90e7628ec8af60c872c00",
- "opcode": 1}],
- "id": 1}'
- # Response
- {
- "jsonrpc":"2.0",
- "namespace":"global",
- "id":1,
- "code":0,
- "message":"SUCCESS",
- "result":"0xd7a07fbc8ea43ace5c36c14b375ea1e1bc216366b09a6a3b08ed098995c08fde"
- }
Example2:冻结合约
- # Request
- curl localhost:8081 --data '{"jsonrpc":"2.0", "namespace":"global", "method": "contract_maintainContract","params":[{
- "from": "17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
- "to":"0x3a3cae27d1b9fa931458b5b2a5247c5d67c75d61",
- "timestamp":1481767474717000000,
- "nonce": 8054165127693853,
- "signature":"0x19c0655d05b9c24f5567846528b81a25c48458a05f69f05cf8d6c46894b9f12a02af471031ba11f155e41adf42fca639b67fb7148ddec90e7628ec8af60c872c00",
- "opcode": 2}],
- "id": 1}'
- # Response
- {
- "jsonrpc":"2.0",
- "namespace":"global",
- "id":1,
- "code":0,
- "message":"SUCCESS",
- "result":"0xd7a07fbc8ea43ace5c36c14b375ea1e1bc216366b09a6a3b08ed098995c08fde"
- }
Example3:解冻合约
- # Request
- curl localhost:8081 --data '{"jsonrpc":"2.0", "namespace":"global", "method": "contract_maintainContract","params":[{
- "from": "17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
- "to":"0x3a3cae27d1b9fa931458b5b2a5247c5d67c75d61",
- "timestamp":1481767474717000000,
- "nonce": 8054165127693853,
- "signature":"0x19c0655d05b9c24f5567846528b81a25c48458a05f69f05cf8d6c46894b9f12a02af471031ba11f155e41adf42fca639b67fb7148ddec90e7628ec8af60c872c00",
- "opcode": 3}],
- "id": 1}'
- # Response
- {
- "jsonrpc":"2.0",
- "namespace":"global",
- "id":1,
- "code":0,
- "message":"SUCCESS",
- "result":"0xd7a07fbc8ea43ace5c36c14b375ea1e1bc216366b09a6a3b08ed098995c08fde"
- }
当前内容版权归 Hyperchain 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Hyperchain .