It's a little bit, but note how to deal with it
Run a query to get Roles using the Hyperledger Iroha library
from iroha import Iroha, IrohaCrypto, IrohaGrpc
import iroha_config
net = IrohaGrpc(iroha_config.IROHA_HOST)
iroha = Iroha(iroha_config.ADMIN_ACCOUNT)
admin_priv_key = iroha_config.ADMIN_PRIV_KEY
# Creating a Query
get_block_query = iroha.query(
'GetRoles'
)
# Sign Transaction
IrohaCrypto.sign_query(get_block_query, iroha_config.ADMIN_PRIV_KEY)
# Send Transaction
response = net.send_query(get_block_query)
print(response)
Details of the error
error_response {
message: "Query: [[bad timestamp: sent from future, timestamp: 1594256328577, now: 1594147827999 ]]\n"
}
query_hash: "e4567087a82943225e0a774cf4b4349a62f35854f947b8ecf78039a945ae3858"
Caused by a time lag between the client running Python and the VM running iroha
Set the time with the following command
ntpdate ntp.nict.jp
9 Jul 10:18:36 ntpdate[8383]: step time server 133.243.238.244 offset 108402.649465 sec
Execution result after error handling
roles_response {
roles: "admin"
roles: "user"
roles: "money_creator"
}
query_hash: "9b27f830f9a388590a9131f7960b4d3aca8908614cc89fa6631c11d5365196b8"
Recommended Posts