新手问答 dawn 4.2 RPC push_transaction error 3090003 unsatisfied_authorization

Surou · June 01, 2018 · Last by JCRunner replied at September 10, 2018 · 2713 hits
#include <eosiolib/eosio.hpp>
using namespace eosio;

class hello : public eosio::contract {
  public:
      using contract::contract;

      /// @abi action 
      void hi( account_name user ) {
         print( "Hello, ", name{user} );
      }
};

EOSIO_ABI( hello, (hi) )
const EOS_CONFIG = {
  contractName: "dapp.token", // Contract name
  contractReceiver: "eosio", // User executing the contract (should be paired with private key)
  clientConfig: {
    keyProvider: '5KeqsXty9Sa8GfJgNfkckYxKKGcAWE4AWmUHiw6ifDcnaa2i', // Your private key
    httpEndpoint: 'http://192.168.1.112:8888' // EOS http endpoint
  }
}

class Wish extends React.Component {
  constructor(props) {
    super(props)
    this.state = { pingStatus: false }
  }

  sendPing() {
    this.setState({ pingStatus: 'loading' })
    let eosClient = EOS.Localnet(EOS_CONFIG.clientConfig)

    eosClient.contract(EOS_CONFIG.contractName)
      .then((contract) => {
        console.log(EOS_CONFIG.contractName + '合约加载成功!')
        contract.hi(EOS_CONFIG.contractReceiver, { authorization: [EOS_CONFIG.contractReceiver] })
          .then((res) => { this.setState({ pingStatus: 'success' }) })
          .catch((err) => { this.setState({ pingStatus: 'fail' }); console.log(err) })
      })
  }

{"compression":"none","transaction":{"expiration":"2018-06-01T03:11:51","ref_block_num":17608,"ref_block_prefix":2693467624,"net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"dapp.token","name":"hi","authorization":[{"actor":"eosio","permission":"active"}],"data":"0000000000ea3055"}],"transaction_extensions":[]},"signatures":["SIG_K1_KXci48jtdCMZXB7q9uZ251VwUKKXTFAxRspJ2Zq3Fnik8Y7WsWQaHxFo8EdroMGhLss992m9mxiAQChqJmeKN6Axaq5SXn"]}
{"code":500,"message":"Internal Service Error","error":{"code":3090003,"name":"unsatisfied_authorization","what":"provided keys, permissions, and delays do not satisfy declared authorizations","details":[{"message":"transaction declares authority '{\"actor\":\"eosio\",\"permission\":\"active\"}', but does not have signatures for it under a provided delay of 0 ms","file":"authorization_manager.cpp","line_number":405,"method":"check_authorization"}]}}
共收到 10 条回复

https://github.com/EOSIO/eos/issues/3652

Putting the chain id while signing the transaction fixes this issue.

You can get chain id from /v1/chain/get_info where you get ref_block_num and ref_block_prefix

curl http://localhost:8888/v1/wallet/sign_transaction -X POST -d '[{"ref_block_num":21453,"ref_block_prefix":3165644999,"expiration":"2017-12-08T10:28:49","scope":["initb","initc"],"read_scope":[],"messages":[{"code":"currency","type":"transfer","authorization":[{"account":"initb","permission":"active"}],"data":"000000008093dd74000000000094dd74e803000000000000"}],"signatures":[]}, ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"], "<INSERT_CHAIN_ID_HERE>"]'
Surou [Topic was deleted] 中提及了此贴 01 Jun 17:58

我加了也没用

4Floor has deleted

我也是,加了CHAIN_ID没用啊,有成功的同学吗?

试试get_required_keys,看看是不是密钥用的不对

这个问题解决了么?我也遇到这个问题了,谢谢各位分享下

请问您解决了吗? 我 也遇到同样的问题。

dangerous 回复

写个小demo,或者测试代码,

Surou 回复

你好,这个问题怎么解决的啊

destiny008 回复

get_required_keys的请求数据该怎么设置?这个 rpc该如何使用

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up