1. 摘要
本文介绍Tezos链的在线编译环境smartpy.io的界面和功能介绍。
2. 内容
8.5.1 编译主界面
点击“RUN”,根据提示解决掉问题,即可编译通过。
编译页面8.5.2 add_test测试结果
右侧显示add_test的界面解释及测试结果。
add_test测试结果8.5.3 网络信息
网址:https://smartpy.io/origination
网络信息1 网络信息2其中chain_id为网络编号,level为区块链。有了这些基本信息,可以调用https(RPC)对应接口了。
例如:https://testnet-tezos.giganode.io/chains/NetXxkAx4woPLyu/blocks/321757
可以返回区块信息:
{
"protocol": "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",
"chain_id": "NetXxkAx4woPLyu",
"hash": "BM6xbXCrCJKzEcJuth9tQvs8RWuRALUu2MZLzcu3gCSBoddnqwm",
"header": {
"level": 321757,
"proto": 1,
"predecessor": "BMKWKSKukJEFgXhuzrx3EMVgpmGS9mm88xH1XEXFeZd3STHdK2v",
"timestamp": "2021-07-06T02:17:54Z",
"validation_pass": 4,
"operations_hash": "LLoauYxeDpBh7tqGuNBDWzPqrenEJWWKAbWZV3ZVLjVVYXq9QRyWw",
"fitness": [
"01",
"000000000004e8dc"
],
"context": "CoWVRQQDHmtSEsnWaC1YceFLFsaCe6AtiW6mVaQXeTH3v34Eis17",
"priority": 0,
"proof_of_work_nonce": "08351e3d3e370000",
"signature": "sigtML711oEmYXHLZtL4geNyFbtEyoqt93hGbsXWVjVmNna9YA78YqZkG9zC1UUbNamyuYg6ZoWuKLTNp2vmjcQjyyfEsgzk"
},
"metadata": {
"protocol": "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",
"next_protocol": "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",
"test_chain_status": {
"status": "not_running"
},
"max_operations_ttl": 60,
"max_operation_data_length": 32768,
"max_block_header_length": 238,
"max_operation_list_length": [
{
"max_size": 4194304,
"max_op": 2048
},
{
"max_size": 32768
},
{
"max_size": 135168,
"max_op": 132
},
{
"max_size": 524288
}
],
"baker": "tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9",
"level": {
"level": 321757,
"level_position": 321756,
"cycle": 157,
"cycle_position": 220,
"voting_period": 314,
"voting_period_position": 220,
"expected_commitment": false
},
"level_info": {
"level": 321757,
"level_position": 321756,
"cycle": 157,
"cycle_position": 220,
"expected_commitment": false
},
"voting_period_kind": "proposal",
"voting_period_info": {
"voting_period": {
"index": 314,
"kind": "proposal",
"start_position": 321536
},
"position": 220,
"remaining": 803
},
"nonce_hash": null,
"consumed_gas": "159417746",
"deactivated": [],
"balance_updates": [
{
"kind": "contract",
"contract": "tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9",
"change": "-512000000",
"origin": "block"
},
{
"kind": "freezer",
"category": "deposits",
"delegate": "tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9",
"cycle": 157,
"change": "512000000",
"origin": "block"
},
{
"kind": "freezer",
"category": "rewards",
"delegate": "tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9",
"cycle": 157,
"change": "33750000",
"origin": "block"
}
]
},
"operations": [
[
{
"protocol": "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",
"chain_id": "NetXxkAx4woPLyu",
"hash": "onrAxofEToSmQMsZWByabczTrgd1LQX9VzuGSfdeComDGB31bkU",
"branch": "BMKWKSKukJEFgXhuzrx3EMVgpmGS9mm88xH1XEXFeZd3STHdK2v",
"contents": [
{
"kind": "endorsement_with_slot",
"endorsement": {
"branch": "BMKWKSKukJEFgXhuzrx3EMVgpmGS9mm88xH1XEXFeZd3STHdK2v",
"operations": {
"kind": "endorsement",
"level": 321756
},
"signature": "sigiEN9mEzALNaqzM4rRwFNFDPEzcRABbZt8uEGdB3Z1zuViGsUcMAqsBtmHktD1hmUv5YaRxGGoScWvuKGfXxenzABbdDKU"
},
"slot": 5,
"metadata": {
"balance_updates": [
{
"kind": "contract",
"contract": "tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9",
"change": "-256000000",
"origin": "block"
},
{
"kind": "freezer",
"category": "deposits",
"delegate": "tz1aWXP237BLwNHJcCD4b3DutCevhqq2T1Z9",
"cycle": 157,
"change": "256000000",
"origin": "block"
},
...
"kind": "big_map",
"id": "7676",
"diff": {
"action": "update",
"updates": []
}
}
]
}
}
]
}
}
],
"signature": "sigWnR9D7p9xrb7MKna71URAA3AWXtAbXpPPH56bm1wYDt3eU1d1NyRpNqtRmARW3MY9jUAWW8dWnpU5NZCAvus1y7CJYTSP"
}
]
]
}
3. 参考
(1) 智能合约在线编辑器 https://smartpy.io/ide
(2) smartpy智能合约参考文档 https://smartpy.io/reference.html
网友评论