transfer에러

해결됨
조현열 프로필

기린넷에서 아이디를 생성하여

말씀하신그대로 해본결과 오류가 뜹니다..

1
2
3
4
5
6
7
8
9
const config = {
    httpEndpoint : 'https://api-kylin.eosasia.one',
    chainId: '5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191',
    keyProvider: ['5KCBFuyZTRYMdjT5sJXMjbELutxhUAPBeqZzXkvSHoRsMtnartx'],
};
const Eos = require('eosjs');
 
Eos(config).transfer('apibankdap11','apibankdap11','0.0001 EOS','testEosjs')
    .then(console.log).catch(console.error);
cs

 

{"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 '{\"a

ctor\":\"apibankdap11\",\"permission\":\"active\"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [], provided keys [\"EOS7RBbdEoP3nqLDRkrVKwJUCy8MPrt6NH6u2NGtwpcunnr7qFenk\"], and a delay max limit of 388800

0000 ms","file":"authorization_manager.cpp","line_number":524,"method":"check_authorization"}]}}

 

Dong Jun Kwon 프로필
Dong Jun Kwon 7달 전

from 과 to를 같은 아이디로 넣으면 오류 납니다.

조현열 프로필
조현열 7달 전

다른 아이디를 넣고 해보았습니다.

동시에 만든 계정입니다.

const config = {
httpEndpoint : 'https://api-kylin.eosasia.one',
chainId: '5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191',
keyProvider: ['5KCBFuyZTRYMdjT5sJXMjbELutxhUAPBeqZzXkvSHoRsMtnartx']
};
const Eos = require('eosjs');

Eos(config).transfer('apibankdap11','apibankdap12','50.0000 EOS','testEosjs')
.then(console.log).catch(console.error);

{"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 '{\"a

ctor\":\"apibankdap11\",\"permission\":\"active\"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [], provided keys [\"EOS7RBbdEoP3nqLDRkrVKwJUCy8MPrt6NH6u2NGtwpcunnr7qFenk\"], and a delay max limit of 388800

0000 ms","file":"authorization_manager.cpp","line_number":524,"method":"check_authorization"}]}}

 

조현열 프로필
조현열 7달 전

코드 수정후 적용시켜 보았습니다.

콘솔로 정상출력 확인하였습니다.

const config = {
httpEndpoint : 'https://api-kylin.eosasia.one',
chainId: '5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191',
keyProvider: ['5KCBFuyZTRYMdjT5sJXMjbELutxhUAPBeqZzXkvSHoRsMtnartx'],
permission: 'apibankdap11@active',
sign:true,
broadcast:false,

};
const Eos = require('eosjs');

Eos(config).transfer('apibankdap11','apibankdap11','0.0001 EOS','testEosjs')
.then(console.log).catch(console.error);

(콘솔출력)

$ node transfer
{ transaction_id:
'e57d508a2a924306b61431d095d8f1a5f68b7797011efea8ba9da28189550bb8',
broadcast: false,
transaction:
{ compression: 'none',
transaction:
{ expiration: '2019-07-18T00:01:30',
ref_block_num: 44473,
ref_block_prefix: 596515683,
max_net_usage_words: 0,
max_cpu_usage_ms: 0,
delay_sec: 0,
context_free_actions: [],
actions: [Array],
transaction_extensions: [] },
signatures:
[ 'SIG_K1_JxCPjgxWeLEG7EFhyGzCcn58NzEbjX29tAoEkrZocnV4jr3dASJkyDscwzmer7ov4NReaLCw6Bot1AeWWSp8mj8cZT6yy3' ] } }

 

const config = {
httpEndpoint : 'https://api-kylin.eosasia.one',
chainId: '5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191',
keyProvider: ['5KCBFuyZTRYMdjT5sJXMjbELutxhUAPBeqZzXkvSHoRsMtnartx'],
permission: 'apibankdap11@active',
sign:true,
broadcast:false,

};
const Eos = require('eosjs');

Eos(config).transfer('apibankdap11','apibankdap12','0.0001 EOS','testEosjs')
.then(console.log).catch(console.error);

(콘솔출력)

$ node transfer
{ transaction_id:
'feb105f5d746d526bab9a0346a19e510238938dbc4b6ab7bb960deab9f78b7dc',
broadcast: false,
transaction:
{ compression: 'none',
transaction:
{ expiration: '2019-07-18T00:15:13',
ref_block_num: 46045,
ref_block_prefix: 64492761,
max_net_usage_words: 0,
max_cpu_usage_ms: 0,
delay_sec: 0,
context_free_actions: [],
actions: [Array],
transaction_extensions: [] },
signatures:
[ 'SIG_K1_KgKZw3pma2AMxLK1ru4HcHnvPnFvzhScqsEixzBgckseg8iMe2jFpqXJBV11EvZUyApNjhzh8vgFDMX9rXf9NSsmcUXtV7' ] } }

 

출력한 transaction_id를 이용하여 검색해보았는데,,,

 

 

 

정상적으로 적용이 안됀것을 확인하여... 우분투 keosd로 transaction을 발생시켜 노드에 적용돼는지 테스트 해보았습니다.

 

apibank@apibank-VirtualBox:~/eos/contracts$ cleos --print-request --print-response -u https://api-kylin.eosasia.one push action apibankdap11 create '["apibankdap11",15,"","id_01","cleos transfer test"]' -p apibankdap11
REQUEST:
---------------------
POST /v1/chain/get_abi HTTP/1.0
Host: api-kylin.eosasia.one
content-length: 36
Accept: */*
Connection: close

{
"account_name": "apibankdap11"
}
---------------------
RESPONSE:
---------------------
{
"account_name": "apibankdap11",
"abi": {
"version": "eosio::abi/1.1",
"types": [],
"structs": [{
"name": "contract_trx",
"base": "",
"fields": [{
"name": "id",
"type": "uint64"
},{
"name": "user_id",
"type": "string"
},{
"name": "trx_data",
"type": "string"
},{
"name": "trx_memo",
"type": "string"
}
]
},{
"name": "create",
"base": "",
"fields": [{
"name": "user",
"type": "name"
},{
"name": "contid",
"type": "uint64"
},{
"name": "ab_id",
"type": "string"
},{
"name": "data",
"type": "string"
},{
"name": "memo",
"type": "string"
}
]
}
],
"actions": [{
"name": "create",
"type": "create",
"ricardian_contract": ""
}
],
"tables": [{
"name": "trx",
"index_type": "i64",
"key_names": [],
"key_types": [],
"type": "contract_trx"
}
],
"ricardian_clauses": [],
"error_messages": [],
"abi_extensions": [],
"variants": []
}
}
---------------------
REQUEST:
---------------------
POST /v1/chain/get_info HTTP/1.0
Host: api-kylin.eosasia.one
content-length: 0
Accept: */*
Connection: close


---------------------
RESPONSE:
---------------------
{
"server_version": "14185431",
"chain_id": "5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191",
"head_block_num": 57584457,
"last_irreversible_block_num": 57584121,
"last_irreversible_block_id": "036ea9f9ce77ac738fa3715e5f3d48066b340f60abccbe66214873e8636f05e2",
"head_block_id": "036eab4939e9289bdce7013f010e6ad54fe8bf15c78f46d29127c4048dcde995",
"head_block_time": "2019-07-17T23:52:11.500",
"head_block_producer": "gravitypooll",
"virtual_block_cpu_limit": 250000000,
"virtual_block_net_limit": 1048576000,
"block_cpu_limit": 249900,
"block_net_limit": 1048576,
"server_version_string": "v1.8.1",
"fork_db_head_block_num": 57584457,
"fork_db_head_block_id": "036eab4939e9289bdce7013f010e6ad54fe8bf15c78f46d29127c4048dcde995"
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/get_public_keys HTTP/1.0
Host: /home/apibank/eosio-wallet/keosd.sock:
content-length: 0
Accept: */*
Connection: close


---------------------
RESPONSE:
---------------------
[
"EOS6MeSrXpyff9z4sFqWogs8LiPx27AxHRke7yHW996Zv3wDNesjk"
]
---------------------
REQUEST:
---------------------
POST /v1/chain/get_required_keys HTTP/1.0
Host: api-kylin.eosasia.one
content-length: 682
Accept: */*
Connection: close

{
"transaction": {
"expiration": "2019-07-17T23:52:41",
"ref_block_num": 43513,
"ref_block_prefix": 1584505743,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [{
"account": "apibankdap11",
"name": "create",
"authorization": [{
"actor": "apibankdap11",
"permission": "active"
}
],
"data": "104235094e735c350f00000000000000000569645f303113636c656f73207472616e736665722074657374"
}
],
"transaction_extensions": []
},
"available_keys": [
"EOS6MeSrXpyff9z4sFqWogs8LiPx27AxHRke7yHW996Zv3wDNesjk"
]
}
---------------------
RESPONSE:
---------------------
{
"required_keys": [
"EOS6MeSrXpyff9z4sFqWogs8LiPx27AxHRke7yHW996Zv3wDNesjk"
]
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/sign_transaction HTTP/1.0
Host: /home/apibank/eosio-wallet/keosd.sock:
content-length: 764
Accept: */*
Connection: close

[{
"expiration": "2019-07-17T23:52:41",
"ref_block_num": 43513,
"ref_block_prefix": 1584505743,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [{
"account": "apibankdap11",
"name": "create",
"authorization": [{
"actor": "apibankdap11",
"permission": "active"
}
],
"data": "104235094e735c350f00000000000000000569645f303113636c656f73207472616e736665722074657374"
}
],
"transaction_extensions": [],
"signatures": [],
"context_free_data": []
},[
"EOS6MeSrXpyff9z4sFqWogs8LiPx27AxHRke7yHW996Zv3wDNesjk"
],
"5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191"
]
---------------------
RESPONSE:
---------------------
{
"expiration": "2019-07-17T23:52:41",
"ref_block_num": 43513,
"ref_block_prefix": 1584505743,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [{
"account": "apibankdap11",
"name": "create",
"authorization": [{
"actor": "apibankdap11",
"permission": "active"
}
],
"data": "104235094e735c350f00000000000000000569645f303113636c656f73207472616e736665722074657374"
}
],
"transaction_extensions": [],
"signatures": [
"SIG_K1_KmKvRDnA2LyzTspZqia8RtrBAPs5CWWrTdqvekzQkT75a8zPZEEqjV4n3gSigae34fMwfoQHhLQvcGFVgZkYg9hwysDqPz"
],
"context_free_data": []
}
---------------------
REQUEST:
---------------------
POST /v1/chain/push_transaction HTTP/1.0
Host: api-kylin.eosasia.one
content-length: 398
Accept: */*
Connection: close

{
"signatures": [
"SIG_K1_KmKvRDnA2LyzTspZqia8RtrBAPs5CWWrTdqvekzQkT75a8zPZEEqjV4n3gSigae34fMwfoQHhLQvcGFVgZkYg9hwysDqPz"
],
"compression": "none",
"packed_context_free_data": "",
"packed_trx": "c9b42f5df9a98fa3715e0000000001104235094e735c3500000000a86cd44501104235094e735c3500000000a8ed32322b104235094e735c350f00000000000000000569645f303113636c656f73207472616e73666572207465737400"
}
---------------------
RESPONSE:
---------------------
{
"transaction_id": "3e0f5f1fdfbd2a3e865d9d5d457894054e8e11438ead7986e3c6d1db27622056",
"processed": {
"id": "3e0f5f1fdfbd2a3e865d9d5d457894054e8e11438ead7986e3c6d1db27622056",
"block_num": 57584460,
"block_time": "2019-07-17T23:52:13.000",
"producer_block_id": null,
"receipt": {
"status": "executed",
"cpu_usage_us": 262,
"net_usage_words": 17
},
"elapsed": 1364,
"net_usage": 136,
"scheduled": false,
"action_traces": [{
"action_ordinal": 1,
"creator_action_ordinal": 0,
"closest_unnotified_ancestor_action_ordinal": 0,
"receipt": {
"receiver": "apibankdap11",
"act_digest": "9a6342fbcc8b14d6f9d41cc5758cb07a0b8729b0853daf42dd36c56811f52fa5",
"global_sequence": 270779674,
"recv_sequence": 5,
"auth_sequence": [[
"apibankdap11",
10
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"receiver": "apibankdap11",
"act": {
"account": "apibankdap11",
"name": "create",
"authorization": [{
"actor": "apibankdap11",
"permission": "active"
}
],
"data": {
"user": "apibankdap11",
"contid": 15,
"ab_id": "",
"data": "id_01",
"memo": "cleos transfer test"
},
"hex_data": "104235094e735c350f00000000000000000569645f303113636c656f73207472616e736665722074657374"
},
"context_free": false,
"elapsed": 1219,
"console": "",
"trx_id": "3e0f5f1fdfbd2a3e865d9d5d457894054e8e11438ead7986e3c6d1db27622056",
"block_num": 57584460,
"block_time": "2019-07-17T23:52:13.000",
"producer_block_id": null,
"account_ram_deltas": [{
"account": "apibankdap11",
"delta": 259
}
],
"except": null,
"error_code": null,
"inline_traces": []
}
],
"account_ram_delta": null,
"except": null,
"error_code": null
}
}
---------------------
executed transaction: 3e0f5f1fdfbd2a3e865d9d5d457894054e8e11438ead7986e3c6d1db27622056 136 bytes 262 us
# apibankdap11 <= apibankdap11::create {"user":"apibankdap11","contid":15,"ab_id":"","data":"id_01","memo":"cleos transfer test"}
warn 2019-07-17T23:52:12.014 thread-0 main.cpp:495 print_resuwarning: transaction executed locally, but may not be confirmed by the network yet

출력됀로그 에서 transaction_id 확인후 테스트넷 반영여부를 확인하였습니다.

정상적으로 출력이 돼는군요....

전체 actions 확인해보고싶어 확인해봤더니 koesd로 발생시킨 action만 테스트넷에 반영이 돼었군요...

강사님의 소스로는 출력만돼고 반영이 안돼는데 

eosjs 로 dapp서비스를 해야하는데,, 어떻게 해야합니까?

 

Dong Jun Kwon 프로필
Dong Jun Kwon 7달 전

우선 잘못된 부분부터 말씀드릴께요.

apibankdap11의 키가 아닌 apibankdap12 이 계정의 프라이빗 키입니다. broadcast를 false하면서 블록체인에다 올리지 않고 내부에서 그냥 처리되듯이 하기 때문에 오류가 안나고 진행된 부분입니다.

오류 나왔을 때 오류를 잘보면 거기에 답이 있습니다. 아마 broadcast를 config에서 빼고(빼면 디폴트가 true입니다.) 하시면 아래과 같이 에러가 날 것입니다.

{"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\":\"apibankdap11\",\"permission\":\"active\"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [], provided keys [\"EOS7RBbdEoP3nqLDRkrVKwJUCy8MPrt6NH6u2NGtwpcunnr7qFenk\"], and a delay max limit of 3888000000 ms","file":"authorization_manager.cpp","line_number":524,"method":"check_authorization"}]}}

물론 친절하지 않지만 저기를 보면 해당 소스의 오류를 찾을수 있습니다. 저 같은 경우 보통 "what"을 많이 봅니다.

아마 제가 강의했던 셈플 소스에는 broadcast가 없는것으로 보이네요..^^

eosjs를 사용해서 많은 eos dapp들이 서비스를 하고 있습니다. 좀더 익숙해지시고 공부하시면 하실 수 있을꺼라 생각합니다.

좀더 팁을 드린다면 transfer가 간편해서 많이 쓰일수는 있지만 저같은 경우는 transfer는 잘 사용하지 않고 아래와 같이 transaction을 많이 습니다. 

Eos(config).transaction(
{
actions: [
{
account: 'eosio.token',
name: 'transfer',
authorization: [{
actor: 'zxcvbasdfg11',
permission: 'active'
}],
data: {
from: 'zxcvbasdfg11',
to: 'zxcvbasdfg12',
quantity: '1.0000 EOS',
memo: 'test'
}
}
]
}
).then(console.log).catch(console.error);
조현열 프로필
조현열 7달 전

제대로 돌아가는것을 확인하였습니다.

도움말씀 감사합니다.

지식공유자 되기
많은 사람들에게 배움의 기회를 주고,
경제적 보상을 받아보세요.
지식공유참여
기업 교육을 위한 인프런
“인프런 비즈니스” 를 통해 모든 팀원이 인프런의 강의들을
자유롭게 학습하는 환경을 제공하세요.
인프런 비즈니스