subscan-explorer / subscan-essentials Goto Github PK
View Code? Open in Web Editor NEWPolkadot Substrate Explorer Subscan
Home Page: https://www.subscan.io
License: GNU General Public License v3.0
Polkadot Substrate Explorer Subscan
Home Page: https://www.subscan.io
License: GNU General Public License v3.0
data.events are showing inconsistent behaviours, some time missing on public server, some time missing on private server
curl -XPOST https://westend.subscan.io/api/scan/block -d '{"block_num": 222841}' -H "Content-Type: application/json" | jq
data.events
showing an empty array in this public testnet subscan
{
"code": 0,
"message": "Success",
"ttl": 1,
"data": {
"block_num": 222841,
"block_timestamp": 1587622782,
"hash": "0x32e61276d35b3a415716496dacd06e1951ce02272f859e0f16bd3281a1da16aa",
"parent_hash": "0x0e9cd4ce2d45d6a1966688c8e5af3ae9f9d328dbaf23b6b7f1e8e11437cb1f5e",
"state_root": "0xd423f2b07a07d54d8a01999b420a69ba8c933a02300054750f1372a8e0a099ea",
"extrinsics_root": "0x3a013d5fb19cf166315bb6f14df946f2893081e38216dad6af8bb676b277a4b4",
"extrinsics": [
{
"block_timestamp": 1587622782,
"block_num": 222841,
"extrinsic_index": "222841-0",
"call_module_function": "set",
"call_module": "timestamp",
"params": "[{\"name\":\"now\",\"type\":\"Compact\\u003cMoment\\u003e\",\"value\":1587622782,\"value_raw\":\"\"}]",
"account_id": "",
"account_index": "",
"signature": "",
"nonce": 0,
"extrinsic_hash": "",
"success": true,
"fee": "0",
"account_display": null
},
{
"block_timestamp": 1587622782,
"block_num": 222841,
"extrinsic_index": "222841-1",
"call_module_function": "final_hint",
"call_module": "finalitytracker",
"params": "[{\"name\":\"hint\",\"type\":\"Compact\\u003cBlockNumber\\u003e\",\"value\":222838,\"value_raw\":\"\"}]",
"account_id": "",
"account_index": "",
"signature": "",
"nonce": 0,
"extrinsic_hash": "",
"success": true,
"fee": "0",
"account_display": null
},
{
"block_timestamp": 1587622782,
"block_num": 222841,
"extrinsic_index": "222841-2",
"call_module_function": "set_heads",
"call_module": "parachains",
"params": "[{\"name\":\"heads\",\"type\":\"Vec\\u003cAttestedCandidate\\u003e\",\"value\":null,\"value_raw\":\"\"}]",
"account_id": "",
"account_index": "",
"signature": "",
"nonce": 0,
"extrinsic_hash": "",
"success": true,
"fee": "0",
"account_display": null
}
],
"events": [],
"logs": [
{
"block_num": 222841,
"log_index": "222841-0",
"log_type": "PreRuntime",
"origin_type": "PreRuntime",
"data": "{\"data\":\"0x01000000009588c50f000000005801736a97bb9573819ff6ef3ac7a66f8ce43b6382b1f5a03732488a675064589b0cbbfd6e0daeaadad67f70c6ae46b6e1db357cedb3e0d974bf7968077a6b0180cd55df40b8cb404bed3516fc847aff41d253e430a7d8596c4204261e7e4007\",\"engine\":1161969986}"
},
{
"block_num": 222841,
"log_index": "222841-1",
"log_type": "Seal",
"origin_type": "Seal",
"data": "{\"data\":\"0x1a53e367ab0dac3ef35666916c5ad7fc40858a971571daead257e36383fd313056b4774915a08699da94f8ad035beb531bc91b6d9751cb89e3eb8af637992d8c\",\"engine\":1161969986}"
}
],
"event_count": 0,
"extrinsics_count": 3,
"spec_version": 4,
"validator": "5FZoQhgUCmqBxnkHX7jCqThScS2xQWiwiF61msg63CFL3Y8f",
"validator_name": "",
"validator_index_ids": "",
"finalized": true,
"account_display": {
"address": "5FZoQhgUCmqBxnkHX7jCqThScS2xQWiwiF61msg63CFL3Y8f",
"display": "",
"judgements": null,
"parent_display": "",
"parent": "",
"account_index": "",
"identity": false
}
}
}
In the self-hosted instance , it contains some data for data.events
{
"code": 0,
"message": "Success",
"ttl": 1,
"data": {
"block_num": 222841,
"block_timestamp": 1587622782,
"hash": "0x32e61276d35b3a415716496dacd06e1951ce02272f859e0f16bd3281a1da16aa",
"parent_hash": "0x0e9cd4ce2d45d6a1966688c8e5af3ae9f9d328dbaf23b6b7f1e8e11437cb1f5e",
"state_root": "0xd423f2b07a07d54d8a01999b420a69ba8c933a02300054750f1372a8e0a099ea",
"extrinsics_root": "0x3a013d5fb19cf166315bb6f14df946f2893081e38216dad6af8bb676b277a4b4",
"extrinsics": [
{
"block_timestamp": 1587622782,
"block_num": 222841,
"extrinsic_index": "222841-0",
"call_module_function": "set",
"call_module": "timestamp",
"params": "[{\"name\":\"now\",\"type\":\"Compact\\u003cMoment\\u003e\",\"value\":1587622782,\"value_raw\":\"\"}]",
"account_id": "",
"account_index": "",
"signature": "",
"nonce": 0,
"extrinsic_hash": "",
"success": false,
"fee": "0"
},
{
"block_timestamp": 1587622782,
"block_num": 222841,
"extrinsic_index": "222841-1",
"call_module_function": "final_hint",
"call_module": "finalitytracker",
"params": "[{\"name\":\"hint\",\"type\":\"Compact\\u003cBlockNumber\\u003e\",\"value\":222838,\"value_raw\":\"\"}]",
"account_id": "",
"account_index": "",
"signature": "",
"nonce": 0,
"extrinsic_hash": "",
"success": true,
"fee": "0"
},
{
"block_timestamp": 1587622782,
"block_num": 222841,
"extrinsic_index": "222841-2",
"call_module_function": "set_heads",
"call_module": "parachains",
"params": "[{\"name\":\"heads\",\"type\":\"Vec\\u003cAttestedCandidate\\u003e\",\"value\":null,\"value_raw\":\"\"}]",
"account_id": "",
"account_index": "",
"signature": "",
"nonce": 0,
"extrinsic_hash": "",
"success": true,
"fee": "0"
}
],
"events": [
{
"event_index": "222841-0",
"block_num": 222841,
"extrinsic_idx": 0,
"module_id": "system",
"event_id": "ExtrinsicSuccess",
"params": "[{\"type\":\"DispatchInfo\",\"value\":{\"class\":\"Normal\",\"paysFee\":false,\"weight\":10000000},\"value_raw\":\"\"}]",
"event_idx": 0,
"extrinsic_hash": "",
"block_timestamp": 0
},
{
"event_index": "222841-258",
"block_num": 222841,
"extrinsic_idx": 258,
"module_id": "indices",
"event_id": "IndexAssigned",
"params": "[{\"type\":\"AccountId\",\"value\":\"0000000080969800000000000201000002000000000000ca9a3b000000000201\",\"value_raw\":\"\"},{\"type\":\"AccountIndex\",\"value\":0,\"value_raw\":\"\"}]",
"event_idx": 1,
"extrinsic_hash": "",
"block_timestamp": 0
},
{
"event_index": "222841-0",
"block_num": 222841,
"extrinsic_idx": 0,
"module_id": "",
"event_id": "",
"params": "[]",
"event_idx": 2,
"extrinsic_hash": "",
"block_timestamp": 0
}
],
"logs": [
{
"block_num": 222841,
"log_index": "222841-0",
"log_type": "PreRuntime",
"origin_type": "",
"data": "{\"data\":\"0x01000000009588c50f000000005801736a97bb9573819ff6ef3ac7a66f8ce43b6382b1f5a03732488a675064589b0cbbfd6e0daeaadad67f70c6ae46b6e1db357cedb3e0d974bf7968077a6b0180cd55df40b8cb404bed3516fc847aff41d253e430a7d8596c4204261e7e4007\",\"engine\":1161969986}"
},
{
"block_num": 222841,
"log_index": "222841-1",
"log_type": "Seal",
"origin_type": "",
"data": "{\"data\":\"0x1a53e367ab0dac3ef35666916c5ad7fc40858a971571daead257e36383fd313056b4774915a08699da94f8ad035beb531bc91b6d9751cb89e3eb8af637992d8c\",\"engine\":1161969986}"
}
],
"event_count": 3,
"extrinsics_count": 3,
"spec_version": 0,
"validator": "5FZoQhgUCmqBxnkHX7jCqThScS2xQWiwiF61msg63CFL3Y8f",
"validator_name": "",
"validator_index_ids": "",
"finalized": true
}
}
It would be useful to have the ability to share a link such as https://kusama.subscan.io/tools/price_converter?from=USD&to=KSM&value=1000&block=1234, that allows to include the information in proposal/tips by the Author.
So instead of having to explain why one requests XXX.XX KSM, the link above can be provided this and it would contain all the relevant information.
The link should answer to:
I was trying to start the services with docker but got these log in subscan-observer. The log keeps repeating. Any idea why?
subscan-observer_1 | sh: 1: ../target/subscan: not found
subscan-observer_1 | 2020/09/23 16:09:56 substrate not running
subscan-observer_1 | 2020/09/23 16:09:56 open /subscan/cmd/log/substrate_pid: no such file or directory
subscan-observer_1 | 2020/09/23 16:09:56 start watch filepath: ../configs
Here is my docker-compose yaml:
version: "2.4"
services:
subscan-api:
build: .
image: subscan/api
environment: &app_base
MYSQL_HOST: mysql
MYSQL_PASS: 'helloload'
MYSQL_DB: 'subscan'
REDIS_ADDR: redis:6379
CHAIN_WS_ENDPOINT: 'ws://polkadot-test:9944'
NETWORK_NODE: 'westend'
WEB_HOST: 'http://subscan-api:4399'
ports:
- '4399:4399'
networks:
- app_net
subscan-observer:
environment:
<<: *app_base
image: subscan/api
command: ["python","run.py","substrate"]
networks:
- app_net
networks:
app_net:
external: true
Is there a limit to using subscan.io‘s api
Serve docs at /docs
, list the APIs, if there is any swagger.yml
would be better.
*Service.afterEvent is invoked in a go routine, where event
is a pointer. This leads to a problem because in a for-loop, that event
variable will be mutated to next value in the loop.
sync the block height 1299111
query with table chain_blocks_1
insert with table chain_blocks.
curl -H "Content-Type: application/json" -X POST -d '{"block_num":1299111}' http://0.0.0.0:4399/api/scan/block
(/opt/subscan-essentials/internal/dao/chainBlock.go:106)
[2020-08-25 14:09:03] [0.70ms] SELECT * FROM chain_blocks_1
WHERE (block_num = 1299111)
[0 rows affected or returned ]
curl -H "Content-Type: application/json" -X POST -d '{"block_hash":"0x71477e84e640498dcabee5044ec67a393ccbad47fb1077bcb83663553729e2fd"}' http://0.0.0.0:4399/api/scan/block
{"code":0,"message":"Success","ttl":1,"data":null}
(/opt/subscan-essentials/internal/dao/chainBlock.go:96)
[2020-08-25 14:10:34] [0.59ms] SELECT * FROM chain_blocks_1
WHERE (hash = '0x71477e84e640498dcabee5044ec67a393ccbad47fb1077bcb83663553729e2fd')
[0 rows affected or returned ]
(/opt/subscan-essentials/internal/dao/chainBlock.go:96)
[2020-08-25 14:10:34] [0.52ms] SELECT * FROM chain_blocks
WHERE (hash = '0x71477e84e640498dcabee5044ec67a393ccbad47fb1077bcb83663553729e2fd')
[0 rows affected or returned ]
[2020-08-25 13:36:54] [0.52ms] SELECT * FROM chain_blocks_1
WHERE (block_num = 1299111)
INFO 08/25-13:36:54.740 /opt/subscan-essentials/internal/service/substrate.go:199 Block num 1299111 hash 0x71477e84e640498dcabee5044ec67a393ccbad47fb1077bcb83663553729e2fd
[2020-08-25 13:36:54] [0.79ms] DELETE FROM chain_extrinsics_1
WHERE (block_num = 1299111)
[2020-08-25 13:36:54] [0.76ms] INSERT INTO chain_extrinsics_1
(extrinsic_index
,block_num
,block_timestamp
,extrinsic_length
,version_info
,call_code
,call_module_function
,call_module
,params
,account_id
,signature
,nonce
,era
,is_signed
,success
,fee
) VALUES ('1299111-0',1299111,1598333778,'','04','0300','set','timestamp','[{"name":"now","type":"Compact\u003cMoment\u003e","value":1598333778,"value_raw":""}]','','',0,'',false,true,'0')
[2020-08-25 13:36:54] [0.62ms] INSERT INTO chain_extrinsics_1
(extrinsic_index
,block_num
,block_timestamp
,extrinsic_length
,version_info
,call_code
,call_module_function
,call_module
,params
,account_id
,signature
,nonce
,era
,is_signed
,success
,fee
) VALUES ('1299111-1',1299111,1598333778,'','04','0a00','final_hint','finalitytracker','[{"name":"hint","type":"Compact\u003cBlockNumber\u003e","value":1299108,"value_raw":""}]','','',0,'',false,true,'0')
[2020-08-25 13:36:54] [0.53ms] INSERT INTO chain_extrinsics_1
(extrinsic_index
,block_num
,block_timestamp
,extrinsic_length
,version_info
,call_code
,call_module_function
,call_module
,params
,account_id
,signature
,nonce
,era
,is_signed
,success
,fee
) VALUES ('1299111-2',1299111,1598333778,'','04','1400','set_heads','parachains','[{"name":"heads","type":"Vec\u003cAttestedCandidate\u003e","value":null,"value_raw":""}]','','',0,'',false,true,'0')
[2020-08-25 13:36:54] [0.74ms] INSERT INTO chain_extrinsics_1
(extrinsic_index
,block_num
,block_timestamp
,extrinsic_length
,version_info
,call_code
,call_module_function
,call_module
,params
,account_id
,signature
,nonce
,era
,extrinsic_hash
,is_signed
,success
,fee
) VALUES ('1299111-3',1299111,1598333778,'','84','0503','transfer_keep_alive','balances','[{"name":"dest","type":"Address","value":"3b2d6bcdfcf6c7efe7814fb7af10b93ed99be8d38fe076905d0b4ef8b8004c77","value_raw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"12300000000","value_raw":""}]','0363649faf7a83d0bc0d9faa9c6a5efa8adc772190b8072210bc825895ca3570','05cf93acb74c63d5ad272ddec49e4b4c49a0efa27706bfc4ac0e886a2e9961bfc93d6aa125d14b723967bd0e99f0be36f9a21447d07e84edcc5889e215885900',2,'3502','0x682e579cbdd79b155b820996178131775694f774d7b7e10819aaae0906e53258',true,true,'154000000')
[2020-08-25 13:36:54] [0.40ms] DELETE FROM chain_events_1
WHERE (block_num = 1299111)
[2020-08-25 13:36:54] [0.42ms] DELETE FROM chain_logs_1
WHERE (block_num = 1299111)
[2020-08-25 13:36:54] Error 1062: Duplicate entry '1299111-0' for key 'log_index'
[2020-08-25 13:36:54] [0.68ms] INSERT INTO chain_logs
(block_num
,log_index
,log_type
,data
,finalized
) VALUES (1299111,'1299111-0','PreRuntime','{"data":"0x0104000000e3c5e00f00000000e2d8dcbea6be4a33d2c93942432c8179d9a151009777fd2256d1e5c8bef4cb2e7b14c80428de182f35d9daac60e1781284cff54235f6c1d769c4f85c9d515505dd0c9d17e49dec12a930f877d1022bac3f2b993c9934ae9de1b9b7ca8e43a101","engine":1161969986}',true)
[2020-08-25 13:36:54] Error 1062: Duplicate entry '1299111-1' for key 'log_index'
[2020-08-25 13:36:54] [0.91ms] INSERT INTO chain_logs
(block_num
,log_index
,log_type
,data
,finalized
) VALUES (1299111,'1299111-1','Seal','{"data":"0x866cfcc0148a32e3b54a623b83ee14eadbe55d10104636f8627c97cd172b112b73f813e51c2117ca667a691d9d397ad5fb9ce693a50c34d47727b4d981b4f48f","engine":1161969986}',true)
[2020-08-25 13:36:54] Error 1062: Duplicate entry '1299111' for key 'block_num'
[2020-08-25 13:36:54] [0.55ms] INSERT INTO chain_blocks
(block_num
,block_timestamp
,hash
,parent_hash
,state_root
,extrinsics_root
,logs
,extrinsics
,event_count
,extrinsics_count
,event
,spec_version
,validator
,codec_error
,finalized
) VALUES (1299111,1598333778,'0x71477e84e640498dcabee5044ec67a393ccbad47fb1077bcb83663553729e2fd','0x4a4588c167c7f4e07b231f29b0cc71cd666be82f662d016971c6eaacaba19a85','0xfe04dbe76c1f03297c061fb04f2201abe1e8f713d8397237ba036920a4c29370','0x2418d6d957399a4b44692777a2de4f1db1446fcfb0d3483b8b35da1fe0dc795c','["0x0642414245b5010104000000e3c5e00f00000000e2d8dcbea6be4a33d2c93942432c8179d9a151009777fd2256d1e5c8bef4cb2e7b14c80428de182f35d9daac60e1781284cff54235f6c1d769c4f85c9d515505dd0c9d17e49dec12a930f877d1022bac3f2b993c9934ae9de1b9b7ca8e43a101","0x05424142450101866cfcc0148a32e3b54a623b83ee14eadbe55d10104636f8627c97cd172b112b73f813e51c2117ca667a691d9d397ad5fb9ce693a50c34d47727b4d981b4f48f"]','["0x280403000b50f81d247401","0x1c040a00924a4f00","0x1004140000","0x3902840363649faf7a83d0bc0d9faa9c6a5efa8adc772190b8072210bc825895ca35700005cf93acb74c63d5ad272ddec49e4b4c49a0efa27706bfc4ac0e886a2e9961bfc93d6aa125d14b723967bd0e99f0be36f9a21447d07e84edcc5889e2158859003502080005033b2d6bcdfcf6c7efe7814fb7af10b93ed99be8d38fe076905d0b4ef8b8004c7707001b23dd02"]',0,4,'',18,'aee72821ca00e62304e4f0d858122a65b87c8df4f0eae224ae064b951d39f610',false,true)
[2020-08-25 13:37:07] [0.53ms] INSERT INTO chain_extrinsics_1
(extrinsic_index
,block_num
,block_timestamp
,extrinsic_length
,version_info
,call_code
,call_module_function
,call_module
,params
,account_id
,signature
,nonce
,era
,is_signed
,success
,fee
) VALUES ('1299113-3',1299113,1598333790,'','04','0c00','heartbeat','imonline','[{"name":"heartbeat","type":"Heartbeat\u003cBlockNumber\u003e","value":{"authorityIndex":39,"blockNumber":1299111,"networkState":{"externalAddresses":["6c2f6970342f33342e38392e37362e3134312f7463702f3330333333","602f6970342f31302e302e302e31342f7463702f3330333333","642f6970342f31302e302e312e3231352f7463702f3330333333","602f6970342f31302e302e302e37342f7463702f3330333333"],"peerId":"98002408011220033f905adb4cf5d2e453a5be6584cdef7ac945a44837ad078119c352179861df"},"sessionIndex":543},"value_raw":""},{"name":"_signature","type":"\u003cAuthorityId as RuntimeAppPublic\u003e::Signature","value":"c50000004ec0716818a1cdfa9dd56367993a4c15d694cad2a9749e1fe7b047f4acb66373bbffc367444c74b7a8b5ec39d0fd4bf45d0fd960d1dcae007a1c48e8","value_raw":""}]','','',0,'',false,true,'0')
Some package names are conflict with blockchain concepts such as dao
, needs to check and update if it is possible, btw, the open-source version subscan needs substrate library only, this can be updated as well
in this rpc
/api/scan/extrinsic、/api/scan/block
The event field is empty in the respone.
[2020-08-25 18:59:05] [0.33ms] SELECT * FROM chain_events_1
WHERE (event_index = '1285217-2')
[0 rows affected or returned ]
I have been running the program for two hours. The data table in MySQL is empty. How to solve it.
terminal:
(/root/subscan-essentials/internal/dao/runtimeVersion.go:32)
[2020-09-02 08:53:40] [0.32ms] SELECT spec_version,raw_data FROM `runtime_versions` ORDER BY spec_version DESC,`runtime_versions`.`id` ASC LIMIT 1
[0 rows affected or returned ]
INFO 09/02-08:53:42.594 /root/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:97 blademaster: start http listen addr: [::]:4399
mysql :
@freehere107
May I confirm if the file in
#79 (comment)
is still correct & updated to check in to this repo? 🙇♂️ thanks
Subscan is generated by an old version of kratos, which doesn't have some new features of kratos, need to give it a try if this is easy to implement.
curl -H "Content-Type: application/json" -X POST -d '{"hash":"0xf037b127a5c0ab9cf73e9b907a1d41f02789b33d3a6d622f615abddf643e3588"}' http://127.0.0.1:4399/api/scan/extrinsic
reponse
{"code":0,"message":"Success","ttl":1,"data":null}
===========
curl -H "Content-Type: application/json" -X POST -d '{"extrinsic_index":"1270914-3"}' http://127.0.0.1:4399/api/scan/extrinsic
reponse
{"code":0,"message":"Success","ttl":1,"data":{"block_timestamp":1598164302,"block_num":1270914,"extrinsic_index":"1270914-3","call_module_function":"transfer","call_module":"balances","account_id":"12zaAbcdGQXqRnJLzXPEicaexuNgrguUKRSrXsavbupHaJwK","signature":"3a8007a409fe44e952205ed8c269d57e26a374fc637b03186e06e9ac8e409311e7d827c5fb00eae0009e1bb4936a324a6fc1e240dff43cb9ad9196c73847978e","nonce":0,"extrinsic_hash":"0xf037b127a5c0ab9cf73e9b907a1d41f02789b33d3a6d622f615abddf643e3588","success":true,"params":[{"name":"dest","type":"Address","value":"56daf75bd0f09c11d798263bc79baeb77c4b4af1dbd372bbe532b1f8702b2a7e","valueRaw":""},{"name":"value","type":"Compact\u003cBalance\u003e","value":"14999835000000","valueRaw":""}],"event":[],"fee":"155000000","finalized":false}}
It's showing the following on firefox (fine on chrome) when accessing https://www.subscan.io/
Secure Connection Failed
An error occurred during a connection to kusama.subscan.io. The OCSP response does not include a status for the certificate being verified.
Error code: MOZILLA_PKIX_ERROR_OCSP_RESPONSE_FOR_CERT_MISSING
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.
Subscan is initialized by Kratos, but part of the file structure follows the Kratos and part of not. So we have to decide that should we upgrade Subscan to the latest structure of Kratos
The benefits of following Kratos are
On the other hand
The latest Kratos use google/wire which Subscan doesn't use to connect service components, and the auto-generating API feature seems require this.
api/scan/extrinsic
for exp:
lost field: account_display、error、lifetime。
the success field has diff result.
0xf2082f630332982494cad241a29d6e7744a381c64424b6f0ad295b208ea48377
the website is false,but the github code is true.
I tried the API example at https://documenter.getpostman.com/view/1618960/TVCe1oRU?version=latest
curl --location --request POST 'https://polkadot.subscan.io/api/open/account' \
> --header 'Content-Type: application/json' \
> --data-raw '{
> "address": "E457XaKbj2yTB2URy8N4UuzmyuFRkcdxYs67UvSgVr7HyFb"
> }'
{"code":10001,"message":"Params Error","ttl":1}
curl --location --request POST 'https://polkadot.subscan.io/api/open/account/extrinsics' \
> --header 'Content-Type: application/json' \
> --data-raw '{
> "address": "E457XaKbj2yTB2URy8N4UuzmyuFRkcdxYs67UvSgVr7HyFb",
> "row": 20
> }'
{"code":10001,"message":"Params Error","ttl":1}
People who use Subscan will serve their own chain which means the default version of Subscan should support a node-template
, but not Darwinia(we already have subscan.io
Some code like daemon
can be removed because Subscan can satisfy the scan
feature for the node-template
without them.
why not provide transfer , search api
Subscan start a crab server by default now. #9
Plugin demo
Plugin Template
Plugin gen tools
我看源码有通过 rpc 调用 python 的 decoder,所以内置的 golang 的 lib/scalecodec 和 rpc decode 分别什么情况下用呢
Subscan can browse all substrate chain in theory, a node-template example is required.
In detail page
https://polkadot.subscan.io/extrinsic/0x2cc489ee273125d3efae9ea8246a6d3057c139412eae7dca3ddf31b9def62985
https://polkadot.subscan.io/block/2407269?tab=comment
while blocks more recent than it all finalized
the judgement is not shown for different accounts
e.g. https://polkadot.subscan.io/account/14K71ECxvekU8BXGJmSQLed2XssM3HdBYQBuDUwHeUMUgBHk
It seems, that a identity.provideJudgement
extrinsic is not recognised, if sent through a proxy
e.g. https://polkadot.subscan.io/extrinsic/1286861-2
Hi there, I have the subscan api and daemon running in Kubernetes. Logs look nominal but certain requests fail with the following error:
ERROR 12/15-19:21:01.588 /go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/recovery.go:26 http call panic: POST /api/scan/metadata HTTP/1.1
Complete stack trace:
assignment to entry in nil map
goroutine 101 [running]:
github.com/go-kratos/kratos/pkg/net/http/blademaster.Recovery.func1.1(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/recovery.go:20 +0xb8
panic(0xb6ddc0, 0xd3ea40)
/usr/local/go/src/runtime/panic.go:969 +0x166
github.com/itering/subscan/internal/service.(*Service).Metadata(0xc00012b330, 0xc0004e50f0, 0x230000000040e076, 0xc0004e5090)
/tmp/subscan-essentials/internal/service/common.go:26 +0x9b
github.com/itering/subscan/internal/server/http.metadata(0xc00030e180)
/tmp/subscan-essentials/internal/server/http/scan.go:14 +0x2d
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Context).Next(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/context.go:84 +0x3b
github.com/itering/subscan/internal/middleware.CORS.func1(0xc00030e180)
/tmp/subscan-essentials/internal/middleware/cors.go:19 +0x556
github.com/go-kratos/kratos/pkg/net/http/blademaster.HandlerFunc.ServeHTTP(0xc789a8, 0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:72 +0x30
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Context).Next(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/context.go:84 +0x3b
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*RateLimiter).Limit.func1(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/ratelimit.go:51 +0x3bc
github.com/go-kratos/kratos/pkg/net/http/blademaster.HandlerFunc.ServeHTTP(0xc0003cadf0, 0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:72 +0x30
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Context).Next(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/context.go:84 +0x3b
github.com/go-kratos/kratos/pkg/net/http/blademaster.Logger.func1(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/logger.go:26 +0xde
github.com/go-kratos/kratos/pkg/net/http/blademaster.HandlerFunc.ServeHTTP(0xc77a38, 0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:72 +0x30
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Context).Next(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/context.go:84 +0x3b
github.com/go-kratos/kratos/pkg/net/http/blademaster.Trace.func1(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/trace.go:38 +0x603
github.com/go-kratos/kratos/pkg/net/http/blademaster.HandlerFunc.ServeHTTP(0xc77a60, 0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:72 +0x30
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Context).Next(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/context.go:84 +0x3b
github.com/go-kratos/kratos/pkg/net/http/blademaster.Recovery.func1(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/recovery.go:30 +0x4e
github.com/go-kratos/kratos/pkg/net/http/blademaster.HandlerFunc.ServeHTTP(0xc77a58, 0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:72 +0x30
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Context).Next(0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/context.go:84 +0x3b
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Engine).handleContext(0xc00060b200, 0xc00030e180)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:327 +0x402
github.com/go-kratos/kratos/pkg/net/http/blademaster.(*Engine).ServeHTTP(0xc00060b200, 0xd5a7a0, 0xc0002c8000, 0xc0000b6100)
/go/pkg/mod/github.com/go-kratos/[email protected]/pkg/net/http/blademaster/server.go:490 +0x152
net/http.serverHandler.ServeHTTP(0xc000568460, 0xd5a7a0, 0xc0002c8000, 0xc0000b6100)
/usr/local/go/src/net/http/server.go:2836 +0xa3
net/http.(*conn).serve(0xc000274140, 0xd5cf60, 0xc0004a4440)
/usr/local/go/src/net/http/server.go:1924 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2962 +0x35c
I'm actively trying to pinpoint the issue, if anyone has any ideas, that would be greatly appreciated :)
There are a lot of os tools support the daemon feature, subscan open source can only play a service role, and this will make the repo tidier.
I am cloning the repo and then following the instructions on the readme file but it doesn't even have a make file, probably I am doing something wrong, if so it'll be awesome if someone can help me with the steps to setting up a running subscan repo on my localhost.
Thanks in adv!
Subscan is a backend service in the technical arch, which also means we can run any scripts in one language before starting the server.
sub
and cmd
Just like the .maintain
file in the substrate, too many files make the source code hard to read.
The latest transfers of edgeware were happened in 25 days ago on https://edgeware.subscan.io/transfer . But I did receive some EDG with polkadot.js wallet yesterday. What happened?
Data synchronization method is which one, currently I do not have synchronization, help
At present, Subscan is displaying price info for KSM and DOT. The backend is collecting price info at regular intervals for quite some time. It's about time to generate price history chart views and provide historical price info through API for external applications. A feature request was received about fetching historical prices based on the timestamp or block height and a currency converter between token and USD based on a specific time or block height thought API. Such applications like grant proposal or on-chain proposal applying for treasury funding with requested amount denominated in tokens or USD and vice versa.
API documentation:
UI tool:
Two APIs should be created, general price query and currency conversion.
Examples below are for easy demonstration purposes. Please make necessary changes when implementing and update docs accordingly.
Historical price query.
@endpoint: /api/open/price
@method: POST
@param base: Base Currency [KSM|DOT|RING] Those tokens that have meaningful collectible price info.
@param quote: Quote Currency [USD], by default USD. Right now, we only support USD. This parameter can be omitted for the time being. But it's kept here for a future extension that API may include quote currency such as BTC, ETH, etc.
@param time: Unix timestamp or block height by checking the integer range for passed-in value. The blockchain of the block height is determined by the API domain prefix. If omitted, return the latest price. Because price info is fetched and stored in DB at intervals, the requested time will hit blank most of the time, in this case, return the latter price of the two price points before and after. These two price points should be returned as a reference as well to keep it as objective as possible and let the external application decide how to deal with the data. In order to support query price based on block height, when saving price at a particular time, its corresponding block height should be kept as well, or an internal function exists to facilitate time2height conversion.
Example:
# Check KSM's latest price
# kusama.subscan.io/api/open/price?base=KSM
curl -POST -H "Content-Type: application/json" --data '{ "base":KSM}' https://kusama.subscan.io/api/open/price
# Check DOT's USD price at block height 56704
# polkadot.subscan.io/api/open/price?base=DOT"e=USD&time=56704
curl -POST -H "Content-Type: application/json" --data '{ "base":"DOT", "quote":"USD", "time":56704}' polkadot.subscan.io/api/open/price
# response
{
"code": 0,
"message": "Success",
"generated_at": 1593181254, # Time of API response time stamp
"data": {
"price": 117.32,
"time": 1593175348,
"height": 56731,
"generated_at": 1593181254 # Time of API response time stamp
"records": [
{
"price": 112.12,
"time": 1593173934,
"height": 56700,
},
{
"price": 117.32,
"time": 1593175348,
"height": 56731,
}
] # Price points before and after
}
}
Conversion calculator returns the amount of target currency base on the amount of source currency given historical price.
@endpoint: /api/open/currency_converter
@method: POST
@param from: Token to convert [KSM|DOT|RING] Those tokens that have meaningful collectible price info.
@paarm value: Amount of tokens to convert
@param to: Target token [KSM|DOT|RING] Those tokens that have meaningful collectible price info. If same as from
, always return the same output as value
value.
@param time: Unix timestamp or block height by checking the integer range for passed-in value. The blockchain of the block height is determined by the API domain prefix. If omitted, use the latest price for conversion, otherwise use the price at a specified time or block height for conversion.
Example:
# Based on latest price, query 1000KSM=?USD
kusama.subscan.io/api/open/currency_converter?from=KSM&value=1000&to=USD
curl -POST -H "Content-Type: application/json" --data '{ "from":"KSM","value":1000,"from":"USD","quote":"DOT"}' https://kusama.subscan.io/api/open/currency_converter
# Based on the pric at block height 56704, query 1000USD=?Dot
# polkadot.subscan.io/api/open/currency_converter?from=USD&value=1000&to=DOT&time=5670
curl -POST -H "Content-Type: application/json" --data '{ "time":56704,"value":1000,"from":"USD","quote":"DOT"}' https://polkadot-cc1.subscan.io/api/open/currency_converter
# response
{
"code": 0,
"message": "Success",
"generated_at": 1593181254, # Time of API response time stamp
"data": {
"output": "8.5236958745", # Follow the price api sample above, DOT/USD: 117.32 @ #56704
"price": {
"price": "117.32",
"time": 1593175348,
"height": 56704,
"records":[
...
]
} # price object can use the same object in /price API
}
}
List of currencies that support price query and conversion.
@endpoint: /api/open/currencies
@method: POST
@params: none
Example:
# List of currencies that support price query and conversion at Kusama Network
# kusama.subscan.io/api/open/currencies
curl -POST -H "Content-Type: application/json" https://kusama.subscan.io/api/open/currencies
{
"code": 0,
"message": "Success",
"generated_at": 1593181254,
"data": {
"currencies": ["KSM/USD", "KSM/BTC"]
}
}
# List of currencies that support price query and conversion at Darwinia Network
# darwinia.subscan.io/api/open/currencies
curl -POST -H "Content-Type: application/json" https://darwinia.subscan.io/api/open/currencies
{
"code": 0,
"message": "Success",
"generated_at": 1593181254,
"data": {
"currencies": ["RING/USD", "KTON/USD"]
}
}
A UI tool to support currency conversion based on API service.
From Currency
and input Amount
Datetime
picker or block height numberTo Currency
Amount
The following Polkadot extrinsic is currently missing on Subscan.io: 0x4457c25b6812e9262eeab142f77abeb2411b1e3192c930a47f3a226deebcb226
However, the same extrinsic is present on Polkascan
How to change the network "Polkadot" or "Westend"?
I suppose there must be some reasons that daemon is used, though it is inconvenient for me for several reasons.
Follow the design of kratos #11
.proto
for the APII am learning to develop the Polkadot parachain and I am building the subscan-essentials project. I can run subscan-essentials now, but I don't know how to configure it to work with acala testnet. Thank you!
I query the block using /api/scan/block
on westend testnet. Here is the result I got. However, I can only find the sender address but not able to find the destination address inside the results. May I ask how do you derive the destination address?
Here is the block query link: https://westend.subscan.io/block/2523060
The transaction is from 5HpLdCTNBQDjFomqpG2XWadgB4zHTuqQqNHhUyYbett7k1RR
to 5EZqthsiPj7KXWstSxKSZAVvjaBZ4ELWqX2nZ6cesCCUTyDW
.
{
"block_num":2523060,
"block_timestamp":1601991294,
"hash":"0xbabe0ae35f20f9941bbd8626ebe9335de252121e32bb88b440b9f9bb052e5640",
"parent_hash":"0xede820ba16808da69d7fabbd1e47ba076949db942847cb86377b8eebac80a91d",
"state_root":"0xa51168e805ac358f7f638a43f6d2f90d89eb81357608c9291664fd52994346e4",
"extrinsics_root":"0x5ed129c950df95ddd1baf2666cc787981f94e02c1f13fc9a0bda4f3ba094331d",
"extrinsics":[
{
"block_timestamp":1601991294,
"block_num":2523060,
"extrinsic_index":"2523060-0",
"call_module_function":"set",
"call_module":"timestamp",
"params":"[{\"name\":\"now\",\"type\":\"Compact\\u003cMoment\\u003e\",\"value\":1601991294,\"value_raw\":\"\"}]",
"account_id":"",
"account_index":"",
"signature":"",
"nonce":0,
"extrinsic_hash":"",
"success":true,
"fee":"0",
"account_display":null
},
{
"block_timestamp":1601991294,
"block_num":2523060,
"extrinsic_index":"2523060-1",
"call_module_function":"final_hint",
"call_module":"finalitytracker",
"params":"[{\"name\":\"hint\",\"type\":\"Compact\\u003cBlockNumber\\u003e\",\"value\":2523057,\"value_raw\":\"\"}]",
"account_id":"",
"account_index":"",
"signature":"",
"nonce":0,
"extrinsic_hash":"",
"success":true,
"fee":"0",
"account_display":null
},
{
"block_timestamp":1601991294,
"block_num":2523060,
"extrinsic_index":"2523060-2",
"call_module_function":"transfer",
"call_module":"balances",
"params":"[{\"name\":\"dest\",\"type\":\"Address\",\"value\":\"6eb1a1db00a5e6e586daf5bcdd384fa4a0fde2be0714541520d0b6d8f6ea193d\",\"value_raw\":\"\"},{\"name\":\"value\",\"type\":\"Compact\\u003cBalance\\u003e\",\"value\":\"500000000000\",\"value_raw\":\"\"}]",
"account_id":"5HpLdCTNBQDjFomqpG2XWadgB4zHTuqQqNHhUyYbett7k1RR",
"account_index":"",
"signature":"ee8a916dbd6991e2902bb85df0a19527c54fa953adc795b8e7d0447690ab341ac60e1d8b9861311ad2d2b057ddba75d3a74c77369c87646b7b78188bca916985",
"nonce":3573,
"extrinsic_hash":"0xf53b8dfc8c3427c7774a7ffd7e4ec4c31fc47fdcffca40d55bef1e9f7c4eeb0b",
"success":true,
"fee":"15500000001",
"account_display":{
"address":"5HpLdCTNBQDjFomqpG2XWadgB4zHTuqQqNHhUyYbett7k1RR",
"display":"",
"judgements":null,
"parent_display":"",
"parent":"",
"account_index":"",
"identity":false
}
}
],
"events":[
{
"event_index":"2523060-2",
"block_num":2523060,
"extrinsic_idx":2,
"module_id":"balances",
"event_id":"Transfer",
"params":"[{\"type\":\"AccountId\",\"value\":\"fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf266\",\"value_raw\":\"\"},{\"type\":\"AccountId\",\"value\":\"6eb1a1db00a5e6e586daf5bcdd384fa4a0fde2be0714541520d0b6d8f6ea193d\",\"value_raw\":\"\"},{\"type\":\"Balance\",\"value\":\"500000000000\",\"value_raw\":\"\"}]",
"event_idx":2,
"extrinsic_hash":"0xf53b8dfc8c3427c7774a7ffd7e4ec4c31fc47fdcffca40d55bef1e9f7c4eeb0b",
"block_timestamp":0
},
{
"event_index":"2523060-2",
"block_num":2523060,
"extrinsic_idx":2,
"module_id":"balances",
"event_id":"Deposit",
"params":"[{\"type\":\"AccountId\",\"value\":\"aebb0211dbb07b4d335a657257b8ac5e53794c901e4f616d4a254f2490c43934\",\"value_raw\":\"\"},{\"type\":\"Balance\",\"value\":\"15500000001\",\"value_raw\":\"\"}]",
"event_idx":3,
"extrinsic_hash":"0xf53b8dfc8c3427c7774a7ffd7e4ec4c31fc47fdcffca40d55bef1e9f7c4eeb0b",
"block_timestamp":0
}
],
"logs":[
{
"block_num":2523060,
"log_index":"2523060-0",
"log_type":"PreRuntime",
"origin_type":"PreRuntime",
"data":"{\"data\":\"0x02010000001513ea0f00000000\",\"engine\":1161969986}"
},
{
"block_num":2523060,
"log_index":"2523060-1",
"log_type":"Seal",
"origin_type":"Seal",
"data":"{\"data\":\"0x943444a2abf4267e7663617272305585a33f525ca60279b156225df4e9215a4f38334131e49955e8c944e618916e10f93b4640629971e6b64e38fe1559d96e84\",\"engine\":1161969986}"
}
],
"event_count":2,
"extrinsics_count":3,
"spec_version":44,
"validator":"5G1ojzh47Yt8KoYhuAjXpHcazvsoCXe3G8LZchKDvumozJJJ",
"validator_name":"",
"validator_index_ids":"",
"finalized":true,
"account_display":{
"address":"5G1ojzh47Yt8KoYhuAjXpHcazvsoCXe3G8LZchKDvumozJJJ",
"display":"",
"judgements":null,
"parent_display":"",
"parent":"",
"account_index":"",
"identity":false
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.