Block chain and probability payment-based streaming media platform implementation method

文档序号:1817378 发布日期:2021-11-09 浏览:8次 中文

阅读说明:本技术 一种基于区块链与概率支付的流媒体平台实现方法 (Block chain and probability payment-based streaming media platform implementation method ) 是由 杨安家 李涛 翁健 刘家男 陈小虎 李明 温靖航 于 2021-07-02 设计创作,主要内容包括:本发明公开了一种基于区块链与概率支付的流媒体平台实现方法,包括以下步骤:S1、平台初始化及账户注册阶段,商家和用户调用智能合约进行注册,商家进行流媒体信息的提交,当用户决定消费时,提交押金以及付款;S2、链下彩票游戏协议阶段,当一次交易完成后,用户和商家在链下执行彩票游戏协议,判断用户是否需要付款,根据判断结果在链下记录双方的金额变化;S3、提交链下资金变化阶段,用户或商家想结束消费时,将最新的双方链下金额记录提交到智能合约上,智能合约根据记录进行退款。本发明方法具有更灵活的收费模式与更有效的激励用户参与机制,并且去中心化能避免中心化管理方式所带来的问题。(The invention discloses a method for realizing a streaming media platform based on block chain and probability payment, which comprises the following steps: s1, platform initialization and account registration, in which, merchants and users call intelligent contracts to register, the merchants submit streaming media information, and when the users decide to consume, the merchants submit deposit and payment; s2, in the stage of a chain lottery game agreement, after one transaction is finished, the user and the merchant execute the lottery game agreement under the chain, whether the user needs to pay is judged, and the money changes of the two parties are recorded under the chain according to the judgment result; and S3, submitting the chain fund change stage, and submitting the latest link fund records of the two parties to an intelligent contract when the user or the merchant wants to finish consumption, and refunding the intelligent contract according to the records. The method of the invention has more flexible charging mode and more effective incentive user participation mechanism, and decentralization can avoid the problems caused by a centralized management mode.)

1. A method for realizing a streaming media platform based on block chain and probability payment is characterized in that the streaming media platform comprises a merchant, a user and an intelligent contract, and the method comprises the following steps:

s1, platform initialization and account registration, in which, the merchant and the user call the intelligent contract to register, the merchant submits the stream media information, and when the user determines to consume, the merchant submits the deposit and payment amount;

s2, in the stage of a chain lottery game agreement, after one transaction is finished, the user and the merchant execute the lottery game agreement under the chain, whether the user needs to pay is judged, and the money changes of the two parties are recorded under the chain according to the judgment result;

and S3, submitting the chain fund change stage, and submitting the latest link fund records of the two parties to an intelligent contract when the user or the merchant wants to finish consumption, and refunding the intelligent contract according to the records.

2. The method for implementing a streaming media platform based on block chain and probabilistic payment as claimed in claim 1, wherein step S1 specifically includes:

calling the intelligent contract by the merchant to submit the sold streaming media content information M (name, description, price, r), and showing the information on the blockchain in a transaction form for the users to select;

wherein, name is the name of the content of the stream media, description is the detailed description of the stream media, price is the charging amount of the stream media, r is a binary number with the length of 256, and the value is related to the probability of payment of the user;

after the user decides to consume, the merchant and the user each generate a public and private key Pair (PK) in the blockchain walletM/PKU,SKM/SKU) Then the public key PKM/PKUSubmitting the contract to an intelligent contract; at the same time, the merchant submits deposit dMThe user submits deposit dUAnd amount d for paymentC,dM≥dU>>dC

3. The method for implementing a streaming media platform based on blockchain and probabilistic payment as claimed in claim 2, wherein step S2 specifically includes:

when a transaction is initiated, the merchant creates information XMThe signature is signed and then sent to the user;

wherein txid is the session number of the current transaction, the initial value is 0, Com is the commitment, and a random number r is selected for the merchant1∈{0,1}256A commitment to it is made later, i.e. Com ═ H (r)1) H is a hash function, H: {0,1}*→{0,1}256

After the user transaction is over, information X is createdU=(Tc,r2) Signing the signature and sending the signature to a merchant;

wherein, TcDuration of consumption for user, r2Random number selected for the user, r2∈{0,1}256

The merchant uses the selected r after the user transaction is finished1And r sent by user2Judging a formula:

whether or not toIf true, the merchant will create a chain transaction to record the change of the amount of money and send it to the user, and at the same time, the acceptance Com is released and the sender r1For user verification; non-genuine merchants need not unpack commitments and send r1And waiting for the user to start the next transaction.

4. The method for implementing a streaming media platform based on blockchain and probabilistic payment as claimed in claim 3, wherein in step S2, a transaction includes the following steps:

s21, when a round of transaction under the user chain begins, a 256-bit binary number r is randomly selected by the merchant1∈{0,1}256Encrypting it with hash function H to obtain a commitment Com ═ H (r)1) Then the commitment and the session serial number txid of the current transaction are packaged to obtain the transaction txM1=(txid=txid+1,Com);

The merchant uses its own private key SKMFor transaction txM1Signing to obtainsign is a data signature function, and the merchant will (tx)M1,σM1) Sending the data to a user through a down-link transaction channel;

s22, when the round of transaction under the user chain is finished, the user uses the public key PK of the merchantMInformation (tx) sent to the merchantM1,σM1) Verifying to ensure that the information is sent by the merchant and is correct;

the user selects a random number r2∈{0,1}256The transaction number and the current transaction sequence number and the consumption time length T of the transaction numberCPacking generation information txU=(txid=txid,r2,TC) And use its own private key SKUSign the information to obtainThe last user will (tx)U,σU) Sending the data to a merchant;

s23, when the merchant receives the response from the user, the public key PK of the user is usedUThe transaction sent by the merchant is verified, and after the transaction is confirmed to be error-free, the merchant calculates a formulaIf true, the merchant loses the lottery ticket, the user gets a chance to avoid the lottery ticket, and the user returns to step S21 to conduct a new round of transaction;

otherwise, the merchant wins the user and needs to pay the consumption amountT is the total duration of the current streaming media, and the merchant creates a transaction tx for recording the change of the amount under the linkreM=(txid=txid,CM=CM+c,CU=CU-c);

Wherein, CMAnd CUUnder-chain owned amounts, C, for the merchant and the user, respectivelyMInitial value of 0, CUWith initial value of payment deposit d submitted by the userC

The merchant uses its own private key to pair the transaction txreMAnd random number r selected from the beginning1Signing to obtain sigmareMAnd will be (tx)reM,σreM,r1) Sending the data to a user;

s24, after receiving the information sent by the merchant, the user firstly uses the public key of the merchant to sign sigmareMVerifying and confirming the validity of the product;

calculating a commitment Com ═ H (r)1) And comparing the merchant's acceptance Com confirming them as soon as they have originated to determine that the merchant has not modified r1A value of (d);

user's operation typeAfter the verification is confirmed to be true, the user uses the private key of the user to carry out the transaction tx sent by the merchantreMSigning to obtain sigmareUFinally will (tx)reM,σreU) Sent to the merchant。

5. The method for implementing a streaming media platform based on blockchain and probabilistic payment as claimed in claim 3, wherein step S3 specifically includes:

when any party wants to finish the consumption, an intelligent contract is called to submit the latest down-link transaction, and the intelligent contract submits d to the user according to the content of the down-link transactionCThe distribution is carried out, after the distribution is finished, the deposits of the two parties are locked, the intelligent contract sends an event to inform the other party of the completion of the consumption, and the other party waits for the response of the other party;

if the other party finds that the down-link transaction submitted with the intelligent contract is not the latest, the other party complains and submits the latest down-link transaction to the intelligent contract, and the intelligent contract judges which party is cheating according to txid of the two down-link transactions and punishs the party, namely, the deposit on the intelligent contract is completely deducted and transferred to the other party.

6. The method for implementing streaming media platform based on blockchain and probabilistic payment as claimed in claim 1, further comprising a compensation phase, wherein in step S2, when the user makes two consecutive payments, the compensation phase is entered, a compensation mechanism is invoked, and the user submits relevant offline evidence to request the merchant to return the second payment.

7. The method of claim 6, wherein the compensation stage comprises:

after the user pays twice continuously, the user packs two pieces of offline transaction information continuously sent to the user by the merchant, the information is sent back to the merchant as evidence, and meanwhile, a refund offline transaction is created and sent to the merchant;

after receiving the evidence sent by the user, the merchant detects whether the difference of the txid values of two downlink transactions contained in the evidence is 1; a value of 1 proves that the user did make two consecutive payments and then verifies whether the user created the down-link transaction is legitimate and signs the request to pass the refund if legitimate.

8. The method for implementing a streaming media platform based on blockchain and probabilistic payment as claimed in claim 7, wherein the compensation stage specifically comprises the following steps:

when the user finds that the current transaction is a second payment which is continuous with the user, the user takes the two linked transactions signed by the user and the signature of the merchant on the two linked transactions as evidence, namely, the evidence x ═ tx'reM,txreM,σ′reM,σreM) Then creates a down-link transaction txrefU=(txid=txid+1,CM=CM-C′,CU=CU+ C ') requesting the merchant to refund to itself, where C' is the amount of the second payment by the user;

the user uses the private key of the user to sign the evidence and the down-link transaction to respectively obtain sigmaproAnd σrefUWill (x, σ)pro,σrefU) Sending the data to a merchant;

after receiving the information sent by the user, the merchant verifies the validity of the signature, after the validity is confirmed, the merchant calculates whether the transaction sequence numbers in the evidence sent by the user are different by 1, continuous transactions are ensured, whether the signature in the evidence is correct is verified, and after the verification is passed, if the merchant agrees to refund the money, the merchant uses the private key of the merchant to carry out the transaction txrefUSigning to obtain sigmarefMThen will (tx)refU,σrefM) Sending the data to a user;

if the merchant does not agree with the second payment of the returned user, the user calls an intelligent contract to judge whether the refund is needed or not through the intelligent contract; the user sends evidence information (x, sigma) to the merchantpro,σrefU) Submitting the contract to an intelligent contract;

the smart contract informs the merchant that the user has complained, and the merchant submits the transaction information (x ', sigma ') it received sent by the user 'pro,σ′refU);

The intelligent contract compares whether the two pieces of evidence information are the same or not, so that the evidence of counterfeiting information by the user is prevented; if the evidence is the same, the user cheats, all deposits and deposit of the user are transferred to the merchant, if the evidence is the same, the intelligent contract calculates whether the transaction sequence number difference in the evidence is 1, if so, the merchant cheats, and then the intelligent contract transfers all deposits of the merchant to the user.

Technical Field

The invention belongs to the technical field of network space security, and particularly relates to a streaming media platform implementation method based on block chain and probability payment.

Background

In recent years, a large number of streaming media platforms have appeared, however, the conventional streaming media platforms have various problems, which may reduce the participation of users.

First, many streaming media platforms are inflexible in terms of charging, and specifically, there are two main charging modes, the first is a subscription-based charging mode in which a user must subscribe to a platform service for a certain period of time before using streaming media, and during this period of time, even if the user is not satisfied with the platform content or service, the user cannot refund. The second is a billing mode based on single charge, in which the user only needs to pay for the single or multiple streaming media information consumed by the user when consuming the streaming media content provided by the platform. However, the charging model still does not achieve the desired flexibility, and when the user pays for consumption of the streaming media content, the consumption model also has no way to refund the unconsumed content if he exits in the middle.

Secondly, the incentive mechanisms of the current streaming media platforms are not effective enough, and the most common incentive mechanism for users to participate in the current streaming media platforms is to issue coupons. However, the issue time and the issue number of the mechanism are limited, and the incentive target cannot be well reached.

Finally, the current streaming media platform is a centralized management mode, and has certain problems; for example, user privacy is easily revealed due to lack of supervision, some mechanism flows cannot be disclosed due to a central management mode of the streaming media platform, and the centralized streaming media platform generally uses a single or a small number of servers to provide related services, which easily causes the streaming media platform to be attacked maliciously.

Disclosure of Invention

The invention mainly aims to overcome the defects and shortcomings of the prior art, and provides a streaming media platform implementation method based on block chain and probability payment, which has a more flexible charging mode and a more effective mechanism for stimulating user participation, and can avoid the problems caused by a centralized management mode by decentralization.

In order to achieve the purpose, the invention adopts the following technical scheme:

a method for realizing a streaming media platform based on block chain and probability payment is provided, wherein the streaming media platform comprises a merchant, a user and an intelligent contract, and the method comprises the following steps:

s1, platform initialization and account registration, in which, the merchant and the user call the intelligent contract to register, the merchant submits the stream media information, and when the user determines to consume, the merchant submits the deposit and payment amount;

s2, in the stage of a chain lottery game agreement, after one transaction is finished, the user and the merchant execute the lottery game agreement under the chain, whether the user needs to pay is judged, and the money changes of the two parties are recorded under the chain according to the judgment result;

and S3, submitting the chain fund change stage, and submitting the latest link fund records of the two parties to an intelligent contract when the user or the merchant wants to finish consumption, and refunding the intelligent contract according to the records.

Further, step S1 specifically includes:

calling the intelligent contract by the merchant to submit the sold streaming media content information M (name, description, price, r), and showing the information on the blockchain in a transaction form for the users to select;

wherein, name is the name of the content of the stream media, description is the detailed description of the stream media, price is the charging amount of the stream media, r is a binary number with the length of 256, and the value is related to the probability of payment of the user;

after the user decides to consume, the merchant and the user each generate a public and private key Pair (PK) in the blockchain walletM/PKU,SKM/SKU) Then the public key PKM/PKUSubmitting the contract to an intelligent contract; at the same time, the merchant submits deposit dMThe user submits deposit dUAnd amount d for paymentC,dM≥dU>>dC

Further, step S2 specifically includes:

when a transaction is initiated, the merchant creates information XMThe signature is signed and then sent to the user;

wherein txid is the session number of the current transaction, the initial value is 0, Com is the commitment, and a random number r is selected for the merchant1∈{0,1}256A commitment to it is made later, i.e. Com ═ H (r)1) H is a hash function, H: {0,1}*→{0,1}256

After the user transaction is over, information X is createdU=(Tc,r2) Signing the signature and sending the signature to a merchant;

wherein, TcDuration of consumption for user, r2Random number selected for the user, r2∈{0,1}256

The merchant uses the selected r after the user transaction is finished1And r sent by user2Judging a formula:

if true, the trade company will create the down-link trade recording the change of money amount and send it to the user, at the same time, the acceptance Com is released and the sender r1For user verification; do not really be that the merchant does not need to solveOpening commitment and transmitting r1And waiting for the user to start the next transaction.

Further, in step S2, a transaction includes the following steps:

s21, when a round of transaction under the user chain begins, a 256-bit binary number r is randomly selected by the merchant1∈{0,1}256Encrypting it with hash function H to obtain a commitment Com ═ H (r)1) Then the commitment and the session serial number txid of the current transaction are packaged to obtain the transaction txM1=(txid=txid+1,Com);

The merchant uses its own private key SKMFor transaction txM1Signing to obtainsign is a data signature function, and the merchant will (tx)M1M1) Sending the data to a user through a down-link transaction channel;

s22, when the round of transaction under the user chain is finished, the user uses the public key PK of the merchantMInformation (tx) sent to the merchantM1M1) Verifying to ensure that the information is sent by the merchant and is correct;

the user selects a random number r2∈{0,1}256The transaction number and the current transaction sequence number and the consumption time length T of the transaction numberCPacking generation information txU=(txid=txid,r2,TC) And use its own private key SKUSign the information to obtainThe last user will (tx)UU) Sending the data to a merchant;

s23, when the merchant receives the response from the user, the public key PK of the user is usedUThe transaction sent by the merchant is verified, and after the transaction is confirmed to be error-free, the merchant calculates a formulaIf true, the merchant loses the lottery ticket, and the user obtains the exemption billThe user returns to step S21 to conduct a new round of transaction;

otherwise, the merchant wins the user and needs to pay the consumption amountT is the total duration of the current streaming media, and the merchant creates a transaction tx for recording the change of the amount under the linkreM=(txid=txid,CM=CM+c,CU=CU-c);

Wherein, CMAnd CUUnder-chain owned amounts, C, for the merchant and the user, respectivelyMInitial value of 0, CUWith initial value of payment deposit d submitted by the userC

The merchant uses its own private key to pair the transaction txreMAnd random number r selected from the beginning1Signing to obtain sigmareMAnd will be (tx)reMreM,r1) Sending the data to a user;

s24, after receiving the information sent by the merchant, the user firstly uses the public key of the merchant to sign sigmareMVerifying and confirming the validity of the product;

calculating a commitment Com ═ H (r)1) And comparing the merchant's acceptance Com confirming them as soon as they have originated to determine that the merchant has not modified r1A value of (d);

user's operation typeAfter the verification is confirmed to be true, the user uses the private key of the user to carry out the transaction tx sent by the merchantreMSigning to obtain sigmareUFinally will (tx)reMreU) And sending the data to the merchant.

Further, step S3 specifically includes:

when any party wants to finish the consumption, an intelligent contract is called to submit the latest down-link transaction, and the intelligent contract submits d to the user according to the content of the down-link transactionCThe distribution is carried out, after the distribution is finished, the deposit of the two parties is locked, the intelligent contract sends an event to inform the other party of the consumption resultBundle, wait for the response of the other party;

if the other party finds that the down-link transaction submitted with the intelligent contract is not the latest, the other party complains and submits the latest down-link transaction to the intelligent contract, and the intelligent contract judges which party is cheating according to txid of the two down-link transactions and punishs the party, namely, the deposit on the intelligent contract is completely deducted and transferred to the other party.

Further, a compensation phase is included, and in step S2, when the user enters the compensation phase after two consecutive payments, the compensation mechanism is invoked, and the user submits the relevant down-link evidence to request the merchant to return the second payment.

Further, the compensation phase comprises:

after the user pays twice continuously, the user packs two pieces of offline transaction information continuously sent to the user by the merchant, the information is sent back to the merchant as evidence, and meanwhile, a refund offline transaction is created and sent to the merchant;

after receiving the evidence sent by the user, the merchant detects whether the difference of the txid values of two downlink transactions contained in the evidence is 1; a value of 1 proves that the user did make two consecutive payments and then verifies whether the user created the down-link transaction is legitimate and signs the request to pass the refund if legitimate.

Further, the compensation stage specifically comprises the following steps:

when the user finds that the current transaction is a second payment which is continuous with the user, the user takes the two linked transactions signed by the user and the signature of the merchant on the two linked transactions as evidence, namely, the evidence x ═ tx'reM,txreM,σ′reMreM) Then creates a down-link transaction txrefU=(txid=txid+1,CM=CM-C′,CU=CU+ C ') requesting the merchant to refund to itself, where C' is the amount of the second payment by the user;

the user uses the private key of the user to sign the evidence and the down-link transaction to respectively obtain sigmaproAnd σrefUWill (x, σ)prorefU) Sending the data to a merchant;

when the merchant receivesAfter the information sent by the user, the validity of the signature is verified firstly, after the validity is confirmed, the merchant calculates whether the transaction serial number in the evidence sent by the user is different from 1, so that continuous transaction is ensured, whether the signature in the evidence is correct is verified, and after the verification is passed, if the merchant agrees to refund money, the merchant uses the private key of the merchant to carry out transaction txrefUSigning to obtain sigmarefMThen will (tx)refUrefM) Sending the data to a user;

if the merchant does not agree with the second payment of the returned user, the user calls an intelligent contract to judge whether the refund is needed or not through the intelligent contract; the user sends evidence information (x, sigma) to the merchantprorefU) Submitting the contract to an intelligent contract;

the smart contract informs the merchant that the user has complained, and the merchant submits the transaction information (x ', sigma ') it received sent by the user 'pro,σ′refU);

The intelligent contract compares whether the two pieces of evidence information are the same or not, so that the evidence of counterfeiting information by the user is prevented; if the evidence is the same, the user cheats, all deposits and deposit of the user are transferred to the merchant, if the evidence is the same, the intelligent contract calculates whether the transaction sequence number difference in the evidence is 1, if so, the merchant cheats, and then the intelligent contract transfers all deposits of the merchant to the user.

Compared with the prior art, the invention has the following advantages and beneficial effects:

1. the charging mode adopted by the invention is a pay-as-you-go type charging mode, i.e. the user only needs to pay for part of the content consumed by the user, and the charging mode is more flexible than that of the current streaming media platform.

2. The incentive mechanism of the invention is probability payment and refund of the amount of two continuous payments, namely the user has certain probability to avoid the order in each off-chain transaction, and when the user pays twice continuously, it can refund the amount of the second payment, the incentive mechanism is more effective than the incentive mechanism adopted by the current streaming media platform, because the refund of two continuous payments or the probability payment is added in the normal consumption flow of the user, but not the current consumption volume form needs the user to additionally consume.

3. The invention is built on a block chain, namely the scheme of the streaming media platform is decentralized, compared with the current streaming media platform, the invention can avoid disputes between the platform and users caused by centralization and malicious attacks such as single-point fault attacks and the like caused by centralization.

Drawings

FIG. 1 is a flow chart of a streaming media platform implementation method of the present invention;

fig. 2 is a block diagram of a streaming media platform according to an embodiment of the present invention.

Detailed Description

The present invention will be described in further detail with reference to examples and drawings, but the present invention is not limited thereto.

Examples

The streaming media platform implementation method based on the block chain and the probability payment provides a streaming media platform charging mode which is more flexible and can attract users to participate, and meanwhile, streaming media services are provided in a decentralized mode, so that the centralized management problem of many traditional streaming media platforms is avoided.

Fig. 2 is a schematic structural diagram of the streaming media platform in this embodiment.

The streaming media platform based on the block chain and the payment probability comprises an initialization and account registration phase of the platform, a down-chain lottery game protocol phase, an unnecessary compensation mechanism phase and a submission down-chain fund change phase. The initialization and account registration phases of the platform are to ensure the correctness of the scheme before consumption occurs; the down-chain lottery game stage is a main stage of consumption, and when each transaction is finished, the user and the merchant need to execute the protocol under the chain; the unnecessary compensation phase does not necessarily occur in the consumption, and is only entered when the user pays twice in succession, and the phase is also completed under the chain; the final stage of submitting fund change under the chain is that after the consumption is finished, any party calls the intelligent contract to complete on the chain; as shown in fig. 1, the method for implementing a streaming media platform based on a block chain and a payment probability includes the following steps:

and S1, calling the intelligent contract by the merchant and the user to complete account registration. Then the merchant calls the intelligent contract to submit the streaming media information, when the user decides to consume, the merchant needs to call the intelligent contract to submit the deposit, and the user submits the deposit and the deposit for payment.

In this embodiment, the specific process of step S1 is:

firstly, a merchant calls an intelligent contract to submit the self-sold streaming media content information M ═ name, description, price, r, and the information is disclosed on a blockchain in a transaction form for users to select. Wherein, name refers to the name of the content of the streaming media, description refers to the detailed description of the streaming media, price is the charging amount of the streaming media, and the value of r is a binary number with the length of 256, the value is related to the probability of payment of the user, and the user can know the probability of payment by himself by observing the value and choose whether to consume the streaming media;

after the user decides to consume, the merchant and the user each generate a public and private key Pair (PK) in the blockchain walletM/PKU,SKM/SKU) Then the public key PKM/PKUAnd submitting the contract to an intelligent contract. In addition, the merchant needs to submit a deposit dMThe user also needs to submit deposit dUAnd amount d for paymentC,dM≥dU>>dC

S2, when one transaction in the consumption is finished, the user and the merchant execute a lottery game protocol under the chain, judge whether the user needs to pay or not, and further record the amount change of the two parties under the chain according to the result;

in this embodiment, the steps specifically include:

when both parties complete the registration operation, the user views the streaming media information and selects the target to be consumed in step S1. When the consumption starts, after both parties submit the deposit, both parties open the transaction channel under the chain to carry out one round of transaction in the consumption. Each round of transaction is divided into the following steps:

s21, when a round of transaction under the user chain begins, the merchant will randomly choose a 256-bit binary number r1∈{0,1}256Then, the hash function H is used to encrypt the result to obtain a commitment Com ═ H (r)1) Then the commitment and the session serial number txid of the current transaction are packed together to obtain the transaction txM1=(txid=txid+1,Com);

The merchant uses its own private key SKMFor transaction txM1Signing to obtainsign is a data signature function, and the merchant will (tx)M1M1) Sending the data to a user through a down-link transaction channel;

s22, when the round of transaction under the user chain is finished, the user uses the public key PK of the merchantMInformation (tx) sent to the merchantM1M1) Verifying to ensure that the information is sent by the merchant and is correct;

the user selects a random number r2∈{0,1}256The transaction number and the current transaction sequence number and the consumption time length T of the transaction numberCPacking generation information txU=(txid=txid,r2,TC) And use its own private key SKUSign the information to obtainThe last user will (tx)UU) Sending the data to a merchant;

s23, when the merchant receives the response from the user, the public key PK of the user is usedUThe transaction sent by the merchant is verified, and after the transaction is confirmed to be error-free, the merchant can calculate a formulaIf true, the merchant loses the lottery ticket, the user gets a chance to avoid the lottery ticket, and the user returns to step S21 to conduct a new round of transaction;

otherwise, the merchant wins the user and needs to pay the consumption amountT is the total duration of the current streaming media, and the merchant can create a transaction tx for recording the amount change under the chainreM=(txid=txid,CM=CM+c,CU=CU-c);

Wherein, CMAnd CUUnder-chain owned amounts, C, for the merchant and the user, respectivelyMInitial value of 0, CUWith initial value of payment deposit d submitted by the userC

The merchant uses its own private key to pair the transaction txreMAnd random number r selected from the beginning1Signing to obtain sigmareMAnd will be (tx)reMreM,r1) Sending the data to a user;

s24, after receiving the information sent by the merchant, the user firstly uses the public key of the merchant to sign sigmareMVerifying and confirming the validity of the product;

calculating a commitment Com ═ H (r)1) And comparing the acceptance Com of the merchant's initiation to confirm that they are consistent to determine that the merchant has not modified r1A value of (d);

user's operation typeAfter the verification is confirmed to be true, the user uses the private key of the user to carry out the transaction tx sent by the merchantreMSigning to obtain sigmareUFinally will (tx)reMreU) And sending the data to the merchant.

S3, in this embodiment, when the user enters the compensation stage after two continuous payments, the compensation mechanism can be called to submit the relevant down-link evidence to request the merchant to return the second payment; the compensation phase does not necessarily occur in the consumption, and the compensation phase is entered only when the user makes two consecutive payments, and if the compensation phase is not needed, the step S4 is directly performed; the compensation stage is to avoid that the user loses the lottery game twice in succession with a very low probability and the participation desire of the user is reduced.

In this embodiment, the method specifically includes:

s31, when the user finds that the current transaction is the second payment of his own succession, the user takes the two linked transactions he/she signed and the merchant 'S signature on it as proof, i.e. proof x ═ x'reM,txreM,σ′reM,reM) Then creates a down-link transaction txrefU=(txid=txid+1,CM=CM-C′,U=CU+ C ') requesting the merchant to refund to itself, where C' is the amount of the second payment by the user;

the user uses the private key of the user to sign the evidence and the down-link transaction to respectively obtain sigmaproAnd σrefUWill (x, σ)prorefU) Sending the data to a merchant;

s32, when the merchant receives the information sent by the user, the validity of the signature is verified, after the validity is confirmed, the merchant can calculate whether the transaction serial numbers in the evidence sent by the user are different by 1, continuous transaction is ensured, whether the signature in the evidence is correct is verified, and after the verification is passed, if the merchant agrees to refund the money, the merchant can use the private key of the merchant to perform the transaction txrefUSigning to obtain sigmarefMThen will (tx)refUrefM) Sending the data to a user;

s33, if the merchant doesn't agree with the second payment of the returned user, the user calls the intelligent contract to judge whether the refund is needed or not by the intelligent contract; the user will send evidence information (x, sigma) to the merchant beforeprorefU) Submitting the contract to an intelligent contract;

the smart contract informs the merchant that the user has complained, and the merchant submits the transaction information (x ', sigma ') it received sent by the user 'pro,σ′refU) (ii) a The intelligent contract compares whether the two pieces of evidence information are the same or not, so that the evidence of counterfeiting information by the user is prevented; if the evidence is the same, the user cheats, all deposit and deposit of the user are transferred to the merchant, if the evidence is the same, the intelligent contract determines whether the difference between the transaction sequence numbers in the calculation evidence is 1, if so, the merchant cheats, and then the intelligent contract transfers all the deposit of the merchant to the user.

S4, when any party wants to finish consuming, the latest records of the amounts of both parties linked can be submitted to an intelligent contract, and the intelligent contract refunds money according to the records;

in this embodiment, the following are specifically mentioned:

according to steps S2 and S3, it is known that the user and the merchant will eventually obtain an offline transaction that records the latest balance distribution of both parties, and both parties have their own signature and the other party' S signature. If either party wants to end the current consumption, it can submit the latest transaction and both parties' signatures to the smart contract, wherein the signatures prove that both parties have confirmed and approved the current transaction. However, to prevent a malicious party from committing to an offline transaction that is not the most up-to-date one when it finishes consuming, we also need the other party to confirm.

When the intelligent contract receives the consumption finishing request of one party, the intelligent contract informs the other party of the message and sends the latest transaction formula submitted to the other party for the other party to check. If the other party does not have any response within a period of time, the other party agrees to the transaction as the most recent transaction by default. If the transaction is not the latest transaction, the other party can upload the latest transaction and the signatures of the two parties to the intelligent contract, the intelligent contract can compare transaction serial numbers of the two transactions after verifying the signatures, if the original transaction serial number is smaller than the newly submitted transaction, the fact that the party who initiates and finishes consumption cheats is proved, and all deposits of the original transaction serial number on the intelligent contract are transferred to the other party as a punishment intelligent contract.

In this embodiment, the penalty action performed by the final intelligent contract of step S3 and step S4 is unnecessary.

It should also be noted that in this specification, terms such as "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:数字货币钱包生成方法、数字货币支付方法、装置和系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!