UTXO Workshop:如何获取Alice的sigscript?
UTXO Workshop: how to get Alice's sigscript?
这可能是个愚蠢的问题...
我在玩 utxo-workshop,下面有一条评论询问如何获得爱丽丝的 sigscript。
我尝试按照 utxo.rs
中的测试用例中的程序进行操作:
let alice_signature = sp_io::crypto::sr25519_sign(SR25519, &alice_pub_key, &transaction.encode()).unwrap();
transaction.inputs[0].sigscript = H512::from(alice_signature);
但是 returns 一个错误:called `Option::unwrap()` on a `None` value
.
我猜交易应该是这样的:
{
"inputs": [
{
"outpoint": "0x76584168d10a20084082ed80ec71e2a783abbb8dd6eb9d4893b089228498e9ff",
"sigscript": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
],
"outputs": [
{
"value": 50,
"pubkey": "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48"
}
]
}
如何在 Alice 为 Bob 花费 50 utxo 的交易中获得签名:
0x6ceab99702c60b111c12c2867679c5555c00dcd4d6ab40efa01e3a65083bfb6c6f5c1ed3356d7141ec61894153b8ba7fb413bf1e990ed99ff6dee5da1b24fd83
?
或者我如何在 polkadot.js 中完成?
好吧,基本上我只是用了Pair
to sign the transaction inside the chain_spec.rs
of the node module。
并且也只是在项目之外,从 polkascan.
这可能是个愚蠢的问题...
我在玩 utxo-workshop,下面有一条评论询问如何获得爱丽丝的 sigscript。
我尝试按照 utxo.rs
中的测试用例中的程序进行操作:
let alice_signature = sp_io::crypto::sr25519_sign(SR25519, &alice_pub_key, &transaction.encode()).unwrap();
transaction.inputs[0].sigscript = H512::from(alice_signature);
但是 returns 一个错误:called `Option::unwrap()` on a `None` value
.
我猜交易应该是这样的:
{
"inputs": [
{
"outpoint": "0x76584168d10a20084082ed80ec71e2a783abbb8dd6eb9d4893b089228498e9ff",
"sigscript": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
],
"outputs": [
{
"value": 50,
"pubkey": "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48"
}
]
}
如何在 Alice 为 Bob 花费 50 utxo 的交易中获得签名:
0x6ceab99702c60b111c12c2867679c5555c00dcd4d6ab40efa01e3a65083bfb6c6f5c1ed3356d7141ec61894153b8ba7fb413bf1e990ed99ff6dee5da1b24fd83
?
或者我如何在 polkadot.js 中完成?
好吧,基本上我只是用了Pair
to sign the transaction inside the chain_spec.rs
of the node module。
并且也只是在项目之外,从 polkascan.