Replies: 4 comments 2 replies
-
the error log2021-11-02T14:37:16.474 full_node chia.rpc.rpc_server : WARNING Error while handling message: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
the standard coin is exist(venv) yeqin@yeqin-QiTianM410-N000:~/chia$ cdv rpc coinrecords --by id 0x31e60be51eb67b66c1acea07bc5b9fdc3913fbac6aaf4062407a7089894b501f
[
{
"coin": {
"amount": 100000000,
"parent_coin_info": "0x4d34426a505fa9f9bd11734a1442d6b360750009f539fa273e8e48b2fee3f09e",
"puzzle_hash": "0xa1f222c319199f0ef7aa2db67b883647a9056fbe9c1f13468fec2c789cf0c36a"
},
"coinbase": false,
"confirmed_block_index": 669285,
"spent": false,
"spent_block_index": 0,
"timestamp": 1633104343
}
]
|
Beta Was this translation helpful? Give feedback.
-
i optimize python code but push the rpc also show error "UNKNOW UNSPENT"import sys
import json
from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
from chia.types.condition_opcodes import ConditionOpcode
from chia.util.hash import std_hash
from clvm.casts import int_to_bytes
from functools import reduce
from chia.types.blockchain_format.program import Program
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( # standard_transaction
puzzle_for_pk,
calculate_synthetic_secret_key,
DEFAULT_HIDDEN_PUZZLE_HASH,
)
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from typing import Dict, List, Tuple, Optional, Union
# Converts a hexadecimal string in an array to bytes
def convertConditions(arrs):
for i in range(0, len(arrs)):
ob=arrs[i]
if isinstance(ob,list):
convertConditions(ob)
elif isinstance(ob,str) and ob.index("0x") == 0:
arrs[i]=bytes.fromhex(ob[2:])
def sign_standard_spend(coinName: bytes,priv: PrivateKey, conditions: List[List]):
delegated_puzzle_solution = Program.to((1, conditions))
solution = Program.to([[], delegated_puzzle_solution, []])
return solution,AugSchemeMPL.sign(
calculate_synthetic_secret_key(priv, DEFAULT_HIDDEN_PUZZLE_HASH),
(delegated_puzzle_solution.get_tree_hash() + coinName + DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA),
)
data=json.loads(sys.argv[1])
#secret key
SK=PrivateKey.from_bytes(bytes.fromhex(data["sk"][2:]))
#public key
PK=SK.get_g1()
#programe
puzzlePrograme=puzzle_for_pk(PK)
#coin id
CoinName= bytes.fromhex(data["id"][2:])
#conditions
condition_args: List[List] = data["args"]
convertConditions(condition_args)
solution,signature=sign_standard_spend(CoinName,SK,condition_args)
output={'puzzle_reveal':str(puzzlePrograme),'solution':str(solution),'signature':str(signature)}
print(json.dumps(output))
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
about me
The question
i'am writing driver script for chialisp.i ran into a problem with spent the standard coin.
i driver script use nodejs dsl , use python script to signature.
Spentbundler. json is successfully signed and pushed to the node with error message "unkown unspent"
I know this error indicates that the node library did not find the coin, but I have carefully confirmed that it exists and that there is no problem with spending smart currency.
I'd like to ask for official support, if I missed something.
The environment
ubuntu20.4
chia version 1.2.6
chia network:testnet
js driver
python signature for standard coin
invoke cmd
spent_bundler.json
Beta Was this translation helpful? Give feedback.
All reactions