Bytom信息上链教程

比原项目仓库:
地址:
Gitee地址:
用比原链(Bytom)实现信息上链
很多了解比原链的都知道,比原链是专注信息和数字资产在链上交互和流转的公链项目,信息上链不是比原链核心能力,所以并没有在钱包端做一个功能入口,但是比原链提供了相关的接口可以将一些信息写到链上去 。
那如何实现信息上链呢?使用特殊的操作,这个操作可以进行销毁资产的操作,但因为其可以附带信息,所以就可以实现信息上链的功能 。
请往下看,也用请求演示,然后用写了一个接口的demo, 在用代码实现之前,我们先要做一些准备工作 。
【Bytom信息上链教程】请求build-接口:

Bytom信息上链教程

文章插图

Bytom信息上链教程

文章插图
请求参数:
{"base_transaction": null,"actions": [{"account_id": "0KTCS3R5G0A02","amount": 10000000,"asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type": "spend_account"}, {"account_id": "0KTCS3R5G0A02","amount": 100,"asset_id": "608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cd","type": "spend_account"}, {"account_id": "0KTCS3R5G0A02","amount": 100,"asset_id": "608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cd","arbitrary": "77656c636f6d65efbc8ce6aca2e8bf8ee69da5e588b0e58e9fe5ad90e4b896e7958c","type": "retire"}],"ttl": 0,"time_range": 1521625823}
请求sign-接口:
Bytom信息上链教程

文章插图
请求参数:
{"password": "huangxinglong123","transaction": {"allow_additional_actions": false,"local": true,"raw_transaction": "0701dfd5c8d505020160015e560352e415b41be7648b2241ffdabf56259bc618525f62ac123dce32002110f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0989fe3020001160014adb6632c5b10c6d5b6f97b8d1250f6e409e11c0101000161015f560352e415b41be7648b2241ffdabf56259bc618525f62ac123dce32002110f0608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cd9cc5b191f3190101160014dcfd9b78c24260823e318153665d511d6c4ecb1b010003013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0ebbcde02011600147a9baebd37dba3f14960624ed8e6ca3cc9d5f73800013e608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cdb8c4b191f31901160014f0370fdf7a7bec7b34cc62fd5291071a3dc3d9b0000147608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cd6401246a2277656c636f6d65efbc8ce6aca2e8bf8ee69da5e588b0e58e9fe5ad90e4b896e7958c00","signing_instructions": [{"position": 0,"witness_components": [{"keys": [{"derivation_path": ["0000002c","00000099","0100000000000000","0100000000000000","4600000000000000"],"xpub": "1c03161a08a4dbb7df153815a28f733fec1ac7579f954c4834e5ce9f0ad8deb260ecb2066a8623b69aa936f5798f4dcb9572bc476f2c8171953ce054d58a759f"}],"quorum": 1,"signatures": null,"type": "raw_tx_signature"}, {"type": "data","value": "4f089176a5bca95ec9227b8a87dfec947c59453805bf46d3f5a18f8032255b5a"}]}, {"position": 1,"witness_components": [{"keys": [{"derivation_path": ["0000002c","00000099","0100000000000000","0100000000000000","4700000000000000"],"xpub": "1c03161a08a4dbb7df153815a28f733fec1ac7579f954c4834e5ce9f0ad8deb260ecb2066a8623b69aa936f5798f4dcb9572bc476f2c8171953ce054d58a759f"}],"quorum": 1,"signatures": null,"type": "raw_tx_signature"}, {"type": "data","value": "67512f9250f559699e32c72c8af29096b1556af145f6ecc0c306e6acc88bbfaa"}]}]}}
请求-接口:
Bytom信息上链教程

文章插图
请求参数:
Bytom信息上链教程

文章插图
{"raw_transaction": "0701dfd5c8d505020160015e560352e415b41be7648b2241ffdabf56259bc618525f62ac123dce32002110f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0989fe3020001160014adb6632c5b10c6d5b6f97b8d1250f6e409e11c01630240c7004022db674ff2961b540d4edab846d550429ae9a92311ba375a4f452331422961fdcde3bf79631755dd12df409e24a849158d4aeab919cab81520fb7d1e02204f089176a5bca95ec9227b8a87dfec947c59453805bf46d3f5a18f8032255b5a0161015f560352e415b41be7648b2241ffdabf56259bc618525f62ac123dce32002110f0608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cd9cc5b191f3190101160014dcfd9b78c24260823e318153665d511d6c4ecb1b6302406b75ef5a9decfa31d4f5ae06e0fb14ca507ba4a03715874d1d831516945121573b9b858e4d7527d209c1f89f74e0aa4c4e38afd098cbadaff31b9107167099012067512f9250f559699e32c72c8af29096b1556af145f6ecc0c306e6acc88bbfaa03013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0ebbcde02011600147a9baebd37dba3f14960624ed8e6ca3cc9d5f73800013e608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cdb8c4b191f31901160014f0370fdf7a7bec7b34cc62fd5291071a3dc3d9b0000147608037f96e8d1613d900c67a0730cc90e2a03311fb7d091588f7eb551a6103cd6401246a2277656c636f6d65efbc8ce6aca2e8bf8ee69da5e588b0e58e9fe5ad90e4b896e7958c00"}