在前一篇帖子中考虑了使用 Hive 区块链的 custom_json_operation 将用户文章中的句子记录到区块链上,在这个过程中也同时记录了句子的所有者,提交时间和其 Hash256 值。我们的目标是能在区块链上唯一地记录这些句子以确定这些句子的所有权,并按照这些句子的所有权分配文章所产生的价值。前面的解决方法无法实现这一目标,因为 custom_json_operation 无法保证所记录在区块链上的句子的唯一性,因为同样一条句子可以使用多个 custom_json_operation 被先后记录在区块链上。
为了能在区块链上唯一地记录一条句子,我们考虑实现一个新的操作,称做 post_sentence_operation,在向区块链提交这个操作的时候会验证该操作中的句子是否已经存在于区块链上,如果已经存在,则提交操作会失败,以保证记录到区块链上的句子的唯一性。
还是以上一篇帖子中的短文章
We split an article into sentences. For each sentence, we calculate its sha256 hash value. Then we broadcast the sentences to a blockchain along with its sha256 hash and some meta info. By doing this, we can record the contributions of each author to the article in sentence level.
为例,我们实现的 post_sentence_operation 的结果如下:
{
'previous': '0000000d07df2e3d8e1a837866a818325f4ced8d',
'timestamp': '2022-10-10T07:37:33',
'witness': 'initminer',
'transaction_merkle_root': 'c416105eebb0eb21b29b767b0460436ebbc5dbf7',
'extensions': [],
'witness_signature': '20fda85e41034f137292088769e6fffaec6edda252e4ea9425302bc04688eada6132b26026d2b58a4cce5763d4f5f76eec1331ef59ecc6b0b685ebda73bbc19537',
'transactions': [
{
'ref_block_num': 0,
'ref_block_prefix': 0,
'expiration': '2022-10-10T07:38:00',
'operations': [
{
'type': 'post_sentence_operation',
'value': {
'author': 'initminer',
'time': '2022-10-10T07:37:31.638717',
'hash': '14629c1c5aa59aa1725ef9fbfe18ed3eb1e0cc989a1520a2fc6d350dae08e781',
'sentence': 'We split an article into sentences.'
}
}
],
'extensions': [],
'signatures': ['1f0b6ccb5698304649b032ecec361cfdbd37198293066ef6174ee0f2ae56a39fcc1cc40afa2274cd6840c8bae02d24d7bcf9c5893f76013610b46edd48b5e5abf4']
},
{
'ref_block_num': 0,
'ref_block_prefix': 0,
'expiration': '2022-10-10T07:38:00',
'operations': [
{
'type': 'post_sentence_operation',
'value': {
'author': 'initminer',
'time': '2022-10-10T07:37:31.688617',
'hash': 'dbafd6a74295ce7a2bdceb16a8ce4d9c8c90273212e7a6d41b84ca6c212e8ea7',
'sentence': 'For each sentence, we calculate its sha256 hash value.'
}
}
],
'extensions': [],
'signatures': ['1f2167b48de954597b0e9f411ce5021e26c3ab48552d5bf0a9291004778196b5aa6088084e45621e5c8c7f6d8716cb4b6a54428b5a662bfd1523ca9c1a00e77f0f']
},
{
'ref_block_num': 0,
'ref_block_prefix': 0,
'expiration': '2022-10-10T07:38:00',
'operations': [
{
'type': 'post_sentence_operation',
'value': {
'author': 'initminer',
'time': '2022-10-10T07:37:31.729193',
'hash': '8e9d1c9b459234f6ff2c5d34a3811fae96446be76256288f8d5120e918151025',
'sentence': 'Then we broadcast the sentences to a blockchain along with its sha256 hash and some meta info.'
}
}
],
'extensions': [],
'signatures': ['1f4fd521da466f19070e96b7685b86efc0cbc18423cf18bc0f4def40901ff703a06cadaa2af8c03aae4f2c43030dd7c7c0ed601091871db6ff6cdcb6298b8f5341']
},
{
'ref_block_num': 0,
'ref_block_prefix': 0,
'expiration': '2022-10-10T07:38:00',
'operations': [
{
'type': 'post_sentence_operation',
'value': {
'author': 'initminer',
'time': '2022-10-10T07:37:31.763094',
'hash': '16cbcb572fdf0d73edea310bf51bb1077cb0e58f3093ad1de26f90ad53ef5ea9',
'sentence': 'By doing this, we can record the contributions of each author to the article in sentence level.'
}
}
],
'extensions': [],
'signatures': ['1f4c1e6b1516f1275f1d6e091f7bc141a1c343c7ffe76c9c94ea01c74652f2370e6c19c6825e2619672574504496d25f0e5ddb2d48c2402cf07369d3418e7d4e39']
}
],
'block_id': '0000000eb31e2020c603e742425162bb72bc7734',
'signing_key': 'TST6LLegbAgLAy28EHrffBVuANFWcFgmqRMW13wBmTExqFE9SCkg4',
'transaction_ids': [
'83be92f8226823098b08d5a17166da2d92e906c6',
'640a9b5504181e5e6fb5baf8f702a5a5d9080b12',
'ae899cf378c1080950a4d549fb2ab7526c7ea345',
'0b43868add57db4a760f9763a3fe4620f1daf264'
],
'id': 14
}
按照这种方式,一条句子若被一个用户提交到区块链上并被区块链成功记录,则表示这条句子被该提交者所拥有。随后如有同样的句子(被其拥有者或其他任何人)提交到区块链上,都会被区块链拒绝。这样就可以保障第一个提交该句子的用户对该句子的版权。
用户张贴的一篇文章,当分解成一条条句子后,就可以按照区块链上的记录,统计所有这些句子的所有权,这篇文章所产生的价值可以按照这些句子的所有权进行分配。