Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

咨询下,示例里面有eos签名的,但是data看起来是一个16进制,确认下是否把字典转成16进制data进行sign。 #16

Closed
zmubai opened this issue Oct 29, 2018 · 5 comments

Comments

@zmubai
Copy link

zmubai commented Oct 29, 2018

///主要这里的data一开始看起来就是16进制,而不是一个字典明文,不太清楚这个16进制data如何加工得来?
//未处理的data 字典
{"compression": "none",
"transaction": {
"expiration": "
....//忽略
}

//示例
let wallet = try! WalletManager.importEOS(from: TestData.mnemonic, accountName: "", permissions: [], metadata: WalletMeta(chain: .eos, source: .mnemonic), encryptBy: TestData.password, at: BIP44.eosLedger)
let txs = [
EOSTransaction(
data: "c578065b93aec6a7c811000000000100a6823403ea3055000000572d3ccdcd01000000602a48b37400000000a8ed323225000000602a48b374208410425c95b1ca80969800000000000453595300000000046d656d6f00",
publicKeys: ["EOS88XhiiP7Cu5TmAUJqHbyuhyYgd6sei68AU266PyetDDAtjmYWF"],
chainID: TestData.eosChainID
)
]
let result = try! WalletManager.eosSignTransaction(walletID: wallet.walletID, txs: txs, password: TestData.password)
print(result[0])
XCTAssertEqual(1, result.count)
XCTAssertEqual(
result[0],
EOSSignResult(hash: "6af5b3ae9871c25e2de195168ed7423f455a68330955701e327f02276bb34088", signs: ["SIG_K1_KjZXm86HMVyUd59E15pCkrpn5uUPAAsjTxjEVRRueEvGciinxRS3sATmEEWdkb8hRNHhf6SXofsz4qzPdD6mfZ67FoqLxh"])
)

@XuNeal
Copy link
Contributor

XuNeal commented Oct 31, 2018

因为签名数据都有一个序列化的过程,而EOS数据的序列化不同于Ethereum和BTC,而是使用了比较特殊的序列化方式,并且在签名时额外附加了一下头信息。
我们这边为了简便直接使用了EOSJS进行数据序列化,详细信息你可以参见:https://github.com/EOSIO/eosjs/blob/master/src/eosjs-serialize.ts

@limengCode
Copy link

{"compression": "none",
"transaction": {
"expiration": "
....//忽略
}
请问这个data的含义是什么,字典里面包含了哪些内容?

@limengCode
Copy link

序列化要用EOSJS这个库?

@XuNeal
Copy link
Contributor

XuNeal commented Dec 7, 2018

嗯,目前因为EOS序列化比较特殊,所以目前暂时使用了这个库来加速开发。

@XuNeal
Copy link
Contributor

XuNeal commented Jan 17, 2019

This issue will be closed as it has not update for a long time. You can reopen it if you have any other problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants