eos icon indicating copy to clipboard operation
eos copied to clipboard

provided keys, permissions ,and delays do not satisfy declared authorizations when I newaccount

Open Lobesien opened this issue 8 years ago • 13 comments

I'm developing on EOS Release v1.0.0 Testnet . so I created new account, it returns error code 3090003 after push_transaction. I pack the context_free_data and use node to sign with chainID,I really don't know what is missing

Here's what i did:

get_info

{ "head_block_time": "2018-06-06T06:50:44", "block_cpu_limit": 199900, "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f", "head_block_producer": "eosio", "head_block_id": "000013f27ae57cd9fbc99158dfce40a741056169fedc3fb2f520a90f99dbb97f", "virtual_block_cpu_limit": 32970587, "virtual_block_net_limit": 173212263, "last_irreversible_block_id": "000013f146f1ce12ba51ab8f596a61825a8b7b9dc11cd60d2449f2a9576a59b5", "block_net_limit": 1048576, "last_irreversible_block_num": 5105, "server_version": "a9526dcd", "head_block_num": 5106}

sign_transaction request:

[{"actions":[{"name":"newaccount","data":"0000000000ea30550000000000008c3101000000010003da49f8d994353689a3801927ce88646ee7590d2308918dda37e788985b4508f00100000001000000010002ca58212f5acdf17e5ded69b29ac248fc9088bedc31a3aca17e05984bfbc4ca6a01000000","account":"eosio","authorization":[{"actor":"eosio","permission":"active"}]}],"delay_sec":0,"expiration":"2018-06-06T14:51:15","max_cpu_usage_ms":0,"max_net_usage_words":0,"ref_block_num":5106,"ref_block_prefix":1485949435,"signatures":[],"transaction_extensions":[],"context_free_data":[],"context_free_actions":[]},["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"],"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"]

response:

{ "expiration":"2018-06-06T14:51:15", "ref_block_num":5106, "ref_block_prefix":1485949435, "max_net_usage_words":0, "max_cpu_usage_ms":0, "delay_sec":0, "context_free_actions":[ ] , "actions":[ { "account":"eosio", "name":"newaccount", "authorization":[ { "actor":"eosio", "permission":"active"} ] , "data":"0000000000ea30550000000000008c3101000000010003da49f8d994353689a3801927ce88646ee7590d2308918dda37e788985b4508f00100000001000000010002ca58212f5acdf17e5ded69b29ac248fc9088bedc31a3aca17e05984bfbc4ca6a01000000"} ] , "transaction_extensions":[ ] , "signatures":[ "SIG_K1_KBH1Cj2tieR9XibGD7HjqVhJFtsdNZnaCTeWmWXEjBXDbzbCMtGmxc6dt6Cwt7xPfgzKLiS6K65P8HBQ8nTmBjiJuxoUnD"] , "context_free_data":[ ] }

push_transaction

request:

{"compression":"none","packed_context_free_data":"00","packed_trx":"6384175bf213fbc9915800000000010000000000ea305500409e9a2264b89a010000000000ea305500000000a8ed3232660000000000ea30550000000000008c3101000000010003da49f8d994353689a3801927ce88646ee7590d2308918dda37e788985b4508f00100000001000000010002ca58212f5acdf17e5ded69b29ac248fc9088bedc31a3aca17e05984bfbc4ca6a0100000000","signatures":["SIG_K1_KBH1Cj2tieR9XibGD7HjqVhJFtsdNZnaCTeWmWXEjBXDbzbCMtGmxc6dt6Cwt7xPfgzKLiS6K65P8HBQ8nTmBjiJuxoUnD"]}

response:

"message": "Internal Service Error", "code": 500, "error": { "what": "provided keys, permissions, and delays do not satisfy declared authorizations", "code": 3090003, "name": "unsatisfied_authorization", "details": [ { "line_number": 405, "message": "transaction declares authority '{ "actor":"eosio", "permission":"active"} ', but does not have signatures for it under a provided delay of 0 ms", "method": "check_authorization", "file": "authorization_manager.cpp"} ] }

Lobesien avatar Jun 06 '18 07:06 Lobesien

I'm using EOS v1.0.1, the output i'm using EOSDevHelper is:

get_info

{
    "block_cpu_limit": 199900,
    "block_net_limit": 1048576,
    "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
    "head_block_id": "00007b258b71bea1ef5ccb83dba64e65c4435c1255f0df30eb1630fc400f13a4",
    "head_block_num": 31525,
    "head_block_producer": "eosio",
    "head_block_time": "2018-06-06T10:46:27",
    "last_irreversible_block_id": "00007b24503a86c579ff009002128a423884a35a9ea819ca8a880d519da72c87",
    "last_irreversible_block_num": 31524,
    "server_version": "379cb1a9",
    "virtual_block_cpu_limit": 2e+08,
    "virtual_block_net_limit": 1048576000
}

push_transaction request

{
    "compression": "none",
    "packed_context_free_data": "00",
    "packed_trx": "a1bb175b257bef5ccb8300000000010000000000ea305500409e9a2264b89a010000000000ea305500000000a8ed3232660000000000ea305500a6330da988cca501000000010003798f6c0ac1248b6a8d0ee89f9c651acc5ba40ae5c606c305d2b37fa279a575730100000001000000010003471596fc0905ae2e4b5d34adf196e16cdcdcb7ab26812570d2c9d94ab57a2a7f0100000000",
    "signatures": [
        "SIG_K1_KYRdsY7cV8nV8vAxHbCYcPMCmFiNiznnzGizp76bt3CjS8p6hq3y8wffeF3geacswQT3qMVNb8gnWDMUX1m7A97Yzuu2wN"
    ]
}

response

{
    "processed": {
        "action_traces": [
            {
                "act": {
                    "account": "eosio",
                    "authorization": [
                        {
                            "actor": "eosio",
                            "permission": "active"
                        }
                    ],
                    "data": {
                        "active": {
                            "accounts": [
                            ],
                            "keys": [
                                {
                                    "key": "EOS7NYHRankQpjfKNTgWa12hnj6mmRSxhgGUr3AWntZSdgUfBfdCv",
                                    "weight": 1
                                }
                            ],
                            "threshold": 1,
                            "waits": [
                            ]
                        },
                        "creator": "eosio",
                        "name": "oraclechain",
                        "owner": {
                            "accounts": [
                            ],
                            "keys": [
                                {
                                    "key": "EOS7kmd71EmNLBJ1ruWUSh78osk9hYNXrXA8pve8cFTJqXFxn948B",
                                    "weight": 1
                                }
                            ],
                            "threshold": 1,
                            "waits": [
                            ]
                        }
                    },
                    "hex_data": "0000000000ea305500a6330da988cca501000000010003798f6c0ac1248b6a8d0ee89f9c651acc5ba40ae5c606c305d2b37fa279a575730100000001000000010003471596fc0905ae2e4b5d34adf196e16cdcdcb7ab26812570d2c9d94ab57a2a7f01000000",
                    "name": "newaccount"
                },
                "console": "",
                "cpu_usage": 0,
                "elapsed": 30,
                "inline_traces": [
                ],
                "receipt": {
                    "abi_sequence": 0,
                    "act_digest": "34cefcb4530ad5a7efeb23daebec67180976d9b55c1b3953c024d0ee9a571a68",
                    "auth_sequence": [
                        [
                            "eosio",
                            31531
                        ]
                    ],
                    "code_sequence": 0,
                    "global_sequence": 31581,
                    "receiver": "eosio",
                    "recv_sequence": 31555
                },
                "total_cpu_usage": 0,
                "trx_id": "f5959af6bb242614389bd107488dee78dd4732b5bc216ec7b97976583a8aafce"
            }
        ],
        "elapsed": 175,
        "except": null,
        "id": "f5959af6bb242614389bd107488dee78dd4732b5bc216ec7b97976583a8aafce",
        "net_usage": 200,
        "receipt": {
            "cpu_usage_us": 175,
            "net_usage_words": 25,
            "status": "executed"
        },
        "scheduled": false
    },
    "transaction_id": "f5959af6bb242614389bd107488dee78dd4732b5bc216ec7b97976583a8aafce"
}

Everything looks fine to me, maybe you can check your code again.

spartucus avatar Jun 06 '18 10:06 spartucus

if my json data is right , the problem must be serialize. I read oraclechain code and use Java to implement serialize. but sign with EOS Node still can't pass checker

Lobesien avatar Jun 07 '18 02:06 Lobesien

When you serialize transactions, don't forget chain id, it is null before Dawn-v4.2, now it is retrieved from get_info.

spartucus avatar Jun 07 '18 02:06 spartucus

EOS v1.0.1 get_info server_version is 0961a560 ,not 379cb1a9

Lobesien avatar Jun 07 '18 02:06 Lobesien

getDigestForSignature need chainId for sign tx. But I didn't see chainId in serialize transactions

` TransactionHeader::serialize(writer);

    SerializeCollection(context_free_action, writer);
    SerializeCollection(actions, writer);
    SerializeCollection(transaction_extensions, writer);`

Lobesien avatar Jun 07 '18 02:06 Lobesien

Yes, i mean sig.

spartucus avatar Jun 07 '18 03:06 spartucus

getDigestForSignature I got this:

chainID:cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f newaccount name is qaz owner key EOS7zQstGSP4URAArek9FZZ27cCpu73dsFRBGebaQvEXghiMEZmYf active key EOS5zzHEBx1i9hWg3H7Qvg9tMZLbxEH6iqSf6utVnfghwy3pssmUS expiration:2018-06-07T15:28:17 ref_block_num:165672 ref_block_prefix:1930806799

cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f91de185b28870fc6157300000000010000000000ea305500409e9a2264b89a010000000000ea305500000000a8ed3232660000000000ea3055000000000000beb10100000001000398896c599727b141b482c92dc5bc1e5d7fcb55308eead64d5e02ec5eb7919c6501000000010000000100029273c8b0a13b1df37398c8694090336c86b826529e7c3c23b52723b60ac215d7010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

the data is correct, right? with chainID and the empty context_free_data, then ecc_sign it.

I use eosio private_key to sign ,it's public key is EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV

it's right?

Lobesien avatar Jun 07 '18 08:06 Lobesien

Try EOSDevHelper, it has create account function, then you can compare it's output with yours.

spartucus avatar Jun 07 '18 10:06 spartucus

yes , I use EOSDevHelper, just Signature is different. so I get wrong with Digest or pri_key, but I didn't know which. how could I figure it?

Lobesien avatar Jun 07 '18 11:06 Lobesien

原来你会中文啊

就是我用了PocketEOS-IOS,PocketEOS-Android,但是签名依旧和EOSDevHelper不同的,因为EOSDevHelper成功在我的私链上创建了账户,所以我模拟他的数据去签名,原文内容是一致的。但是我发现PocketEOS-Android在生成确认性K值时使用了一个安全随机数,这就导致每次打开app签名同样一笔transaction时得到的SIG完全不同。按说micro-ecc应当在签名同一笔transaction都可以得到相同SIG。 我的签名校验失败和算法应该有很大关系,但是现在我能查到的3部分代码,得到的SIG都是完全不同的。 而且PocketEOS-IOS使用的就是EOSDevHelper中的uECC.c完成签名的,所以很难确定该如何去修复这个问题

Lobesien avatar Jun 08 '18 07:06 Lobesien

你直接在PocketEOS-Android上提issue吧,在那讨论

spartucus avatar Jun 08 '18 10:06 spartucus

@Robwpy, I met the same problem, Do you know what is the root cause of such problem?

readygo586 avatar Sep 22 '18 15:09 readygo586

解决了吗

TheDreamOfABillionGirls avatar Nov 13 '18 10:11 TheDreamOfABillionGirls