contract_maintainContract

升级合约、冻结合约、解冻合约。 只有合约的部署者才拥有升级合约、冻结合约、解冻合约的权限。

Parameters

  1. <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

  1. <string> - 32字节的十六进制字符串,交易的哈希值。

Example1:升级合约

  1. # Request
  2. curl localhost:8081 --data '{"jsonrpc":"2.0", "namespace":"global", "method": "contract_maintainContract","params":[{
  3. "from": "17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
  4. "to":"0x3a3cae27d1b9fa931458b5b2a5247c5d67c75d61",
  5. "timestamp":1481767474717000000,
  6. "nonce": 8054165127693853,
  7. "payload":"0x6fd7cc16000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  8. "signature":"0x19c0655d05b9c24f5567846528b81a25c48458a05f69f05cf8d6c46894b9f12a02af471031ba11f155e41adf42fca639b67fb7148ddec90e7628ec8af60c872c00",
  9. "opcode": 1}],
  10. "id": 1}'
  11.  
  12.  
  13. # Response
  14. {
  15. "jsonrpc":"2.0",
  16. "namespace":"global",
  17. "id":1,
  18. "code":0,
  19. "message":"SUCCESS",
  20. "result":"0xd7a07fbc8ea43ace5c36c14b375ea1e1bc216366b09a6a3b08ed098995c08fde"
  21. }

Example2:冻结合约

  1. # Request
  2. curl localhost:8081 --data '{"jsonrpc":"2.0", "namespace":"global", "method": "contract_maintainContract","params":[{
  3. "from": "17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
  4. "to":"0x3a3cae27d1b9fa931458b5b2a5247c5d67c75d61",
  5. "timestamp":1481767474717000000,
  6. "nonce": 8054165127693853,
  7. "signature":"0x19c0655d05b9c24f5567846528b81a25c48458a05f69f05cf8d6c46894b9f12a02af471031ba11f155e41adf42fca639b67fb7148ddec90e7628ec8af60c872c00",
  8. "opcode": 2}],
  9. "id": 1}'
  10.  
  11. # Response
  12. {
  13. "jsonrpc":"2.0",
  14. "namespace":"global",
  15. "id":1,
  16. "code":0,
  17. "message":"SUCCESS",
  18. "result":"0xd7a07fbc8ea43ace5c36c14b375ea1e1bc216366b09a6a3b08ed098995c08fde"
  19. }

Example3:解冻合约

  1. # Request
  2. curl localhost:8081 --data '{"jsonrpc":"2.0", "namespace":"global", "method": "contract_maintainContract","params":[{
  3. "from": "17d806c92fa941b4b7a8ffffc58fa2f297a3bffc",
  4. "to":"0x3a3cae27d1b9fa931458b5b2a5247c5d67c75d61",
  5. "timestamp":1481767474717000000,
  6. "nonce": 8054165127693853,
  7. "signature":"0x19c0655d05b9c24f5567846528b81a25c48458a05f69f05cf8d6c46894b9f12a02af471031ba11f155e41adf42fca639b67fb7148ddec90e7628ec8af60c872c00",
  8. "opcode": 3}],
  9. "id": 1}'
  10.  
  11. # Response
  12. {
  13. "jsonrpc":"2.0",
  14. "namespace":"global",
  15. "id":1,
  16. "code":0,
  17. "message":"SUCCESS",
  18. "result":"0xd7a07fbc8ea43ace5c36c14b375ea1e1bc216366b09a6a3b08ed098995c08fde"
  19. }