BSN-DDC 基础网络 DDC SDK 详细设计(八):示例
- 2022-12-08 北京
本文字数:10722 字
阅读完需:约 35 分钟
2022 年 1 月 25 日,区块链服务网络发展联盟(简称“BSN 联盟”)推出了“BSN-DDC 基础网络”(简称 DDC 网络)。DDC 网络的推出,为 NFT 技术在我国的落地提供基础设施能力支撑,并为其合规发展保驾护航。
DDC(Distributed Digital Certificate)即分布式数字凭证,其属性和功能类似于 NFT。NFT 是现实或数字世界中某个事物在区块链上的数字化权益证明,尽管目前大多被用于数字艺术品版权领域,然而其本质上是一种区块链分布式数据库技术,并不带有特定的业务属性,它的潜在使用场景是非常广泛的,可应用在数字商品凭证、票证、账户管理、知识产权等各种领域。
DDC 网络不直接向个人用户提供服务,而是向拥有 DDC/NFT 业务的平台方提供极其便捷的网络接入服务,以方便这些平台以极低的成本提供 DDC/NFT 的生成和管理服务。
DDC-SDK 是用于开发者与 DDC 合约交互的 API 工具。为了让运营方或各平台方对 DDC-SDK 整体设计有一个全面详细的了解,同时为项目的开发、测试、验证、交付等环节提供原始依据以及开发指导,BSN 研习社推出 BSN-DDC 基础网络 DDC SDK 详细设计系列。分别从整体设计,DID 功能设计,DDC 权限管理、费用管理,官方合约 BSN-DDC-721,官方合约 BSN-DDC-1155,交易查询、区块查询、签名事件,数据解析,示例等八个方面,全面详细的介绍 DDC-SDK。
本期是系列文章第八期,示例。
4.1 区块信息示例
4.1.1 泰安链
{
"dbHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": [],
"gasLimit": "0x0",
"gasUsed": "0x0",
"hash": "0xfa639d1454362a8cdfcab1ca1948a5defaf7048b28f67e80780ab1e24e8f8c59",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"number": "0x1",
"parentHash": "0x249f59e00beac8424a7821c4750fdd70c128f4ce795afbab53f345e9fce95d1a",
"receiptsRoot": "0x69a04fa6073e4fc0947bac7ee6990e788d1e2c5ec0fe6c2436d0892e7f3c09d2",
"sealer": "0x0",
"sealerList": [
"4ca3a91a4937355dba6a2e5fe76141479a1fc44e9caa86750092dab64e0b8382f6b8476749c2d2de414350a54491620d38813d2a1442f524e36e3d9946109c4d"
],
"signatureList": [
{
"index": "0x0",
"signature": "0x4602135870d9a4846e2536d4a48e831825a5d95768dd0d4f08544a0bd4c2af41242dec1751a05c07d7572027f8d6ac1625c48145beb004e2dce8b7ce9e2bb73d00"
}
],
"stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x175ac38cf10",
"transactions": [
{
"blockHash": "0xfa639d1454362a8cdfcab1ca1948a5defaf7048b28f67e80780ab1e24e8f8c59",
"blockLimit": "0x100",
"blockNumber": "0x1",
"chainId": "0x1",
"extraData": "0x",
"from": "0x57c7be32cbfb3bfed4fddc87efcc735b4e945fb3",
"gas": "0x2faf080",
"gasPrice": "0xa",
"groupId": "0x1",
"hash": "0x3961fac263d8e640b148ddcfafd71d2069e93a006abc937c32fb16cfa96e661d",
"input": "0x4ed3885e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a464953434f2042434f5300000000000000000000000000000000000000000000",
"nonce": "0x3eb675ec791c2d19858c91d0046821c27d815e2e9c151604912205000002968",
"signature": {
"r": "0x9edf7c0cb63645442aff11323916d51ec5440de979950747c0189f338afdcefd",
"s": "0x2f3473184513c6a3516e066ea98b7cfb55a79481c9db98e658dd016c37f03dcf",
"signature": "0x9edf7c0cb63645442aff11323916d51ec5440de979950747c0189f338afdcefd2f3473184513c6a3516e066ea98b7cfb55a79481c9db98e658dd016c37f03dcf00",
"v": "0x0"
},
"to": "0x8c17cf316c1063ab6c89df875e96c9f0f5b2f744",
"transactionIndex": "0x0",
"value": "0x0"
}
],
"transactionsRoot": "0xb880b08df3b43a9ffc334d7a526522b33e004ef95403d61d76454b6085b9b2f1"
}
4.1.2 武汉链
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": "0x2",
"extraData": "0xd883010a08846765746888676f312e31362e37856c696e757800000000000000a7381c6f48e36d85b06ccc073de74836892b458b61caa512d5113e901abef08606aa9405d5ae035ff4e78daccfdc2362209d1f9475e1d77d50f018652372b69601",
"gasLimit": "0x7a1200",
"gasUsed": "0x3e21d",
"hash": "0x7bb27e906261ce362551463d34950ddf989b6d860eabc4664e831937108675ad",
"logsBloom": "0x00000000000000000000000000000000002008000000010000000000100000000000000000000000400000004000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000001000004000000000020000000000000000000800000000000800000000000000000010000000000000000000000000000000000000001000000020000000008000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000400000000100000000000000020000000080000040000000000010000000000000000000000000000000002000000",
"miner": "0x87a1243b8ac7363c3667d6ad6b89bec20ff022fe",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"number": "0x1b5c4e",
"parentHash": "0xc0f3bc11897b020a9f71ea77cd7f3cdb7ef86778779ba17b3893eee0dc876b49",
"receiptsRoot": "0xe826d1a5608bd8351d5ee7ac9a10c3c8d08f3a0f703f687016e1edde8b469eb1",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x475",
"stateRoot": "0xd918ab8cd0e6dd07dda0a59db8d8866110f523d799e70f30bd0ac7201f3bca80",
"timestamp": "0x61c67c48",
"totalDifficulty": "0x36b89d",
"transactions": [
{
"blockHash": "0x7bb27e906261ce362551463d34950ddf989b6d860eabc4664e831937108675ad",
"blockNumber": "0x1b5c4e",
"from": "0x019ba4600e117f06e3726c0b100a2f10ec52339e",
"gas": "0x3e21d",
"gasPrice": "0x4d7c6d00",
"hash": "0x25392b914c3c2d0fa7fd5fe41d2c218fe81a1be63eb80484c110432f40f8054f",
"input": "0x146d9ddc0000000000000000000000009d37d92d3bca605a49f21642c309e578b16040fd000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000056464632d3200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000056464632d31000000000000000000000000000000000000000000000000000000",
"nonce": "0x1a",
"to": "0x45bcf28556494fb116c4623f8f32091476933fe3",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x0",
"v": "0x2b89",
"r": "0x6d0cb65392d3857e0ccb82f7c372b628074ec2d74bfde2230057cce97429aadd",
"s": "0x13cef22abd8d4e81eb875430706cd9cc3513900854d5474cd7a08b5751e1af97"
}
],
"transactionsRoot": "0xd7cd21ddeb2710404c7f075f5b66c3d626aad5819c757dac5b50e99007ba1961",
"uncles": []
}
}
4.1.3 文昌链
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"baseFeePerGas": "0x7",
"difficulty": "0x0",
"extraData": "0x",
"gasLimit": "0xffffffff",
"gasUsed": "0x0",
"hash": "0x8d24a1833846d4362cd039ed5ef8f762f3d4ed29b362fc8cb85f73ea0dfe499d",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0xc29d6bb924a12f890adaff4f04b5aba54cbfb6a5",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"number": "0xb44",
"parentHash": "0x28875d32ef3f2ff1b52e147459f3bd31a01b936a9d06ba8b47818886d9098ab9",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x253",
"stateRoot": "0xc7954e969d7583b0319fda81686007e7791fa858e26b09827010e1aed764b90f",
"timestamp": "0x61dd87c5",
"totalDifficulty": "0x0",
"transactions": [],
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncles": []
}
}
4.2 交易回执信息示例
4.2.1 泰安链
{
"blockHash": "0x977efec48c248ea4be87016446b40d7785d7b71b7d4e3aa0b103b9cf0f5fe19e",
"blockNumber": "0xa",
"contractAddress": "0x0000000000000000000000000000000000000000",
"from": "0xcdcce60801c0a2e6bb534322c32ae528b9dec8d2",
"gasUsed": "0x1fb8d",
"input": "0xb602109a000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000203078313030303030303030303030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000000832303139303733300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002616100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026262000000000000000000000000000000000000000000000000000000000000",
"logs": [ ],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"output": "0x0000000000000000000000000000000000000000000000000000000000000000",
"root":"0x38723a2e5e8a17aa7950dc008209944e898f69a7bd10a23c839d341e935fd5ca",
"status": "0x0",
"to": "0x15538acd403ac1b2ff09083c70d04856b8c0bdfd",
"transactionHash": "0x708b5781b62166bd86e543217be6cd954fd815fd192b9a124ee9327580df8f3f",
"transactionIndex": "0x0"
}
4.2.2 武汉链
{
"jsonrpc": "2.0",
"id": 0,
"result": {
"blockHash": "0x8cba08237576f10cc7728c63c4c1f0767613b8386c797e30ca295f58ab703325",
"blockNumber": "0x1b61ff",
"contractAddress": null,
"cumulativeGasUsed": "0x3161c",
"effectiveGasPrice": "0x4d7c6d00",
"from": "0x019ba4600e117f06e3726c0b100a2f10ec52339e",
"gasUsed": "0x3161c",
"logs": [
{
"address": "0x920c8c4e79d975891765ec286afb8792b26a7887",
"topics": [
"0xe5e4f0955699fa27be3f7aeb5a9e4ab78b6a37914fd44e5b08c4b78e56f04aa0",
"0x000000000000000000000000019ba4600e117f06e3726c0b100a2f10ec52339e",
"0x00000000000000000000000045bcf28556494fb116c4623f8f32091476933fe3"
],
"data": "0xd3fc986400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a",
"blockNumber": "0x1b61ff",
"transactionHash": "0x31b09b1e618bcb8a513f4970300179f38583a881af4d03953bff79f1ca0e53d0",
"transactionIndex": "0x0",
"blockHash": "0x8cba08237576f10cc7728c63c4c1f0767613b8386c797e30ca295f58ab703325",
"logIndex": "0x0",
"removed": false
},
{
"address": "0x45bcf28556494fb116c4623f8f32091476933fe3",
"topics": [
"0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62",
"0x000000000000000000000000019ba4600e117f06e3726c0b100a2f10ec52339e",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000019ba4600e117f06e3726c0b100a2f10ec52339e"
],
"data": "0x000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000064",
"blockNumber": "0x1b61ff",
"transactionHash": "0x31b09b1e618bcb8a513f4970300179f38583a881af4d03953bff79f1ca0e53d0",
"transactionIndex": "0x0",
"blockHash": "0x8cba08237576f10cc7728c63c4c1f0767613b8386c797e30ca295f58ab703325",
"logIndex": "0x1",
"removed": false
}
],
"logsBloom": "0x00000000000000000000000000000000002008000000000000000000100000000000000000000000400000004000000000000000000000000000000000002000800000000000000000000000000000000000000000000000000000001000004000000000020000000000000000000800000000000000000000000000000010000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000008100000000000000020000000080000040000000000010000000000000000000000000000080000000000",
"status": "0x1",
"to": "0x45bcf28556494fb116c4623f8f32091476933fe3",
"transactionHash": "0x31b09b1e618bcb8a513f4970300179f38583a881af4d03953bff79f1ca0e53d0",
"transactionIndex": "0x0",
"type": "0x0"
}
}
4.2.3 文昌链
{
"jsonrpc": "2.0",
"id": 0,
"result": {
"blockHash": "0x9149b2138d340898c86b96ca07de62bd8612ccd66320bf4f45216b53e55b1ffe",
"blockNumber": "0x700c",
"contractAddress": null,
"cumulativeGasUsed": "0x189aa",
"from": "0x2a14331f1f2d3ba0d750f4c4916e69b1dc38d721",
"gasUsed": "0x189aa",
"logs": [{
"address": "0xdac50c90b934aded33b6adc9f5855ab8a9efb09a",
"topics": ["0x623400fa99cb4c5485584d19857bba72895e7e3400646f9fc46f627a605c267c", "0x0000000000000000000000005804a5f927ce7382ad194fd25bcaa189dad92a39"],
"data": "0x00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000083132333132333231000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d706c6174666f726d4e616d653100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000831323331323332310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x700c",
"transactionHash": "0x4b286a32b43e3bf07e9b4967573871bf1eec808f33c577581c6f9f4620a3097e",
"transactionIndex": "0x0",
"blockHash": "0x9149b2138d340898c86b96ca07de62bd8612ccd66320bf4f45216b53e55b1ffe",
"logIndex": "0x0",
"removed": false
}, {
"address": "0xdac50c90b934aded33b6adc9f5855ab8a9efb09a",
"topics": ["0x3a99d1f905eb66fd0850dd6e2156668b6ae1f16f41cd49dd7c6d4fb5147f784f", "0x0000000000000000000000005804a5f927ce7382ad194fd25bcaa189dad92a39"],
"data": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
"blockNumber": "0x700c",
"transactionHash": "0x4b286a32b43e3bf07e9b4967573871bf1eec808f33c577581c6f9f4620a3097e",
"transactionIndex": "0x0",
"blockHash": "0x9149b2138d340898c86b96ca07de62bd8612ccd66320bf4f45216b53e55b1ffe",
"logIndex": "0x1",
"removed": false
}],
"logsBloom": "0x00100000000000000000000000000000000000200000000000000000000000000400000000800000000000000000000000000000000000000000000000000000000000000000000900000000000008000000000000000000000000000800000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0xdac50c90b934aded33b6adc9f5855ab8a9efb09a",
"transactionHash": "0x4b286a32b43e3bf07e9b4967573871bf1eec808f33c577581c6f9f4620a3097e",
"transactionIndex": "0x0",
"type": "0x0"
}
}
4.3 交易信息示例
4.3.1 泰安链
{
"blockHash": "0xfa639d1454362a8cdfcab1ca1948a5defaf7048b28f67e80780ab1e24e8f8c59",
"blockLimit": "0x100",
"blockNumber": "0x1",
"chainId": "0x1",
"extraData": "0x",
"from": "0x57c7be32cbfb3bfed4fddc87efcc735b4e945fb3",
"gas": "0x2faf080",
"gasPrice": "0xa",
"groupId": "0x1",
"hash": "0x3961fac263d8e640b148ddcfafd71d2069e93a006abc937c32fb16cfa96e661d",
"input": "0x4ed3885e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a464953434f2042434f5300000000000000000000000000000000000000000000",
"nonce": "0x3eb675ec791c2d19858c91d0046821c27d815e2e9c151604912205000002968",
"signature": {
"r": "0x9edf7c0cb63645442aff11323916d51ec5440de979950747c0189f338afdcefd",
"s": "0x2f3473184513c6a3516e066ea98b7cfb55a79481c9db98e658dd016c37f03dcf",
"signature": "0x9edf7c0cb63645442aff11323916d51ec5440de979950747c0189f338afdcefd2f3473184513c6a3516e066ea98b7cfb55a79481c9db98e658dd016c37f03dcf00",
"v": "0x0"
},
"to": "0x8c17cf316c1063ab6c89df875e96c9f0f5b2f744",
"transactionIndex": "0x0",
"value": "0x0"
}
4.3.2 武汉链
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x8cba08237576f10cc7728c63c4c1f0767613b8386c797e30ca295f58ab703325",
"blockNumber": "0x1b61ff",
"from": "0x019ba4600e117f06e3726c0b100a2f10ec52339e",
"gas": "0x3161c",
"gasPrice": "0x4d7c6d00",
"hash": "0x31b09b1e618bcb8a513f4970300179f38583a881af4d03953bff79f1ca0e53d0",
"input": "0xd3fc9864000000000000000000000000019ba4600e117f06e3726c0b100a2f10ec52339e000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000012546f6b656e2d526564446174652d577831360000000000000000000000000000",
"nonce": "0x29",
"to": "0x45bcf28556494fb116c4623f8f32091476933fe3",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x0",
"v": "0x2b89",
"r": "0xac4f674255eb65589ad83e6c590c3c77a8e058ced78350be6bad2524aeed1f8b",
"s": "0x2dbab9a1c8f4b622dba70e9a14be27a53c736593ddbcaaf843be08d5be514b94"
}
}
4.3.3 文昌链
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"blockHash": "0x9149b2138d340898c86b96ca07de62bd8612ccd66320bf4f45216b53e55b1ffe",
"blockNumber": "0x700c",
"from": "0x2a14331f1f2d3ba0d750f4c4916e69b1dc38d721",
"gas": "0x493e0",
"gasPrice": "0x989680",
"hash": "0x4b286a32b43e3bf07e9b4967573871bf1eec808f33c577581c6f9f4620a3097e",
"input": "0xbac7ad520000000000000000000000005804a5f927ce7382ad194fd25bcaa189dad92a3900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
"nonce": "0xfa",
"to": "0xdac50c90b934aded33b6adc9f5855ab8a9efb09a",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x0",
"v": "0x1c",
"r": "0xcec487128c0d1b614984997152fe2d88e6963831bb902f6800f3355cdcdd12b",
"s": "0x6c3b007b5b54a05c0b55a5608cc8f5b5bff064ce160d95f61ad00539c51976df"
}
}
4.4 离线生成账户
4.4.1 功能介绍
平台方或终端用户可以通过此方法生成离线账户
4.4.2 API 定义
方法定义:
Account createAccount();
调用者:平台方、终端用户;
核心逻辑:无
输入参数:
输出参数:
4.5 接入 Url 设置
4.4.1 功能介绍
平台方或终端用户可以通过此方法对接入的网关 URL 地址进行设置
4.4.2 API 定义
方法定义:
Boolean setGatewayUrl(String gatewayUrl);
调用者:平台方、终端用户;
核心逻辑:无
输入参数:
输出参数:
4.6 接入 Key 设置
4.4.1 功能介绍
平台方或终端用户可以通过此方法对接入的 Key 进行设置,注:apiKey 在设置的时候 KEY 用“x-api-key”,值根据实际情况填写。
4.4.2 API 定义
方法定义:
Boolean setGatewayApiKey(String apiKey);
调用者:平台方、终端用户;
核心逻辑:无
输入参数:
输出参数:
本文资料内容来源于 BSN-DDC SDK 详细设计-V1.0,GitHub 地址为:
https://github.com/BSN-DDC/did-sdk
欲浏览更多信息,请您点击登录查看。
BSN研习社
还未添加个人签名 2021-11-05 加入
还未添加个人简介
评论