node.js - 如何推送交易EOS区块链(eosjs - unsatisfied_authorization)?
问题描述
我使用锚钱包。
这是初始化代码
const privateKeys = ["myprivatekey"];
const signatureProvider = new JsSignatureProvider(privateKeys);
const rpc = new JsonRpc(config.mainnet, { fetch });
const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
return {rpc, api};
然后我尝试推送交易
const transaction = await api.transact({
actions: [{
account: 'eosio',
name: 'buyrambytes',
authorization: [{
actor: 'username',
permission: 'active',
}],
data: {
payer: 'username',
receiver: 'username',
bytes: 8192,
},
}]
}, {
blocksBehind: 3,
expireSeconds: 30,
});
(文档示例)
并收到错误
details: [
{
message: `transaction declares authority '{"actor":"username","permission":"active"}', but does not have signatures for it.`,
file: 'authorization_manager.cpp',
line_number: 643,
method: 'get_required_keys'
}
],
json: {
code: 401,
message: 'UnAuthorized',
error: {
code: 3090003,
name: 'unsatisfied_authorization',
what: 'Provided keys, permissions, and delays do not satisfy declared authorizations',
details: [Array]
}
}
}
也许我输入了错误的私钥(Anchor -> Export private key -> Copy key)或其他东西,idk。
所有其他功能(例如 get_block 等)工作正常
解决方案
推荐阅读
- python - 从python中的模块导入类
- azure - 从 Visual Studio 发布到 Azure 虚拟机
- python - 在不关闭 GUI 窗口的情况下停止线程
- laravel - 有一种方法可以自动将模型注入 laravel 中的控制器,而无需使用 Illuminate\Http\Request?
- python-3.x - 如何将按钮输入为整数
- swift - 复杂的自定义导航 SwiftUI
- android - 如何使用 Retrofit2 和 GSON 从响应中获取特定的 JSON 数组?
- node.js - 使用node js读取和操作一个TS文件
- cordova - SVG模糊过滤器在iOS wkwebview上不起作用
- javascript - 将参数传递给部分类和超级类中的构造函数,javascript