consensus and smart contract development

Ultrain Launches Enterprise Mainnet Monitoring & Round Two of Testnet Participant Selection
R

Dear Ultrain community members,

We are excited to announce the launch of Ultrain’s mainnet monitoring page! Click the following link to see the operational status of our permitted mainnet including mining profitability, real-time consensus visualization, and existing mainnet users: https://www.ultrain.io/miner-registration

The addition of this visibility feature will further explain Ultrain’s consensus procedure and business model. Please visit the Mainnet Monitoring service (link provided above) and read the supporting article at https://medium.com/ultrain-chain/introduction-to-ultrains-economic-model-74920e1c687f. These resources assist us to comprehend Ultrain’s token economic system, and understand how Ultrain’s model is based on a notion of servicing and empowering the fundamentals of the real economy.

Ultrain business development model is dependable and scalable; as the demand for blockchain services increases, Ultrain’s economic system will grow accordingly to meet the interests of early adopters, as well as ensure the healthy development of the entire business ecosystem.

Since the call went out for Ultrain’s second round of testnet miner recruitment, we received many applications from all over the world. Thank you all once again for the great interest!
The following is the list of successful applicants – welcome to the Ultrain testnet family and enjoy your preview of Ultrain’s technology.

1、[email protected]
2、[email protected]
3、[email protected]
4、[email protected]
5、[email protected]
6、[email protected]
7、[email protected]
8、[email protected]
9、[email protected]
10、[email protected]
11、[email protected]
12、[email protected]

(The list below represents the selected miners since December 26 2018 to January 13,2019)

Ultrain encourages everyone to continue submitting testnet applications, and stay tuned for more updates from the team!

Thank you all for your continued support of Ultrain.

Ultrain Team
2019. January 25th

read more

hacker marathon and regular meetup or online game

Ultrain is Offering One Million RMB (150,000 USD) to Dapp Developers Through the Hypernova Dapp Competition
R

We are introducing the Hypernova Dapp Competition to encourage developers to build a series of innovative and robust Dapps operating on Ultrain.

Hypernova is a series of competitions for DApp developers. We are offering one million RMB for the first competition happening at the end of June 2019. We’ve invited top-notch developers, company executives, VC investors, and blockchain experts globally to join our DApp committee. The committee will examine the developer teams in terms of technology, products, and business use case.

As a leader of blockchain development focused on building the infrastructure for trusted computing, Ultrain is committed to cultivating a comprehensive ecosystem and providing trusted, secure, efficient, and cost-effective distributed computing services to both businesses and individuals.

The Hypernova initiative is dedicated to building DApps with the highest quality by connecting top-notch developers, company executives, and VC investors.

Timeline for Hypernova Dapp Initiative:

• [June] Summer Camp: One Million RMB award for 30 teams

• [Aug] Fall Camp: Awards will be allocated to winning teams

• [Oct] Winter Camp: Awards will be allocated to winning teams

• [Dec] The Hypernova Ceremony: Connecting the Top 3 DApp team with top investors

At the end of the year 2019, Ultrain will connect the most talented developer teams to top investors in both China and overseas.

*Please note that DApp team that did not receive a reward from Summer Camp are eligible for Fall and Winter camps.

• Step1: Participant submits their DApp through Ultrain official website Participants in the Hypernova initiative can submit their DApp through Ultrain official website. The Hypernova page will soon be released.

• Step2: Ultrain DApp team’s execute initial evaluation: The developers from Ultrain will exam the completeness and functionality of the DApp and test if it runs smoothly on Ultrain, as well as following up with further updates from the project.

• Step3: Ultrain DApp Committee evaluates winning DApp Projects: The Investment Committee is consisting of the world’s top VC investors and blockchain experts, they will help Ultrain to select the winning teams based on technology, products design, and business use case.

• Step4: Ceremony: The awards will be given to all winning teams in a ceremony.

BEST Part — Awards!

Based on the Ultrain’s existing business model, 10% of the enterprise service revenue will be used for DApp development, and effectively be the financial source for the rewards presented in the Hypernova Initiative.

• The Hypernova Award: 300,000 RMB for the ultimate winning team

• First Tire Award: 70,000 RMB for each of the winning team (5 Teams)

• Second Tire Award: 40,000 RMB for each of the winning team ( 5 Teams)

• Third Tire Award: 20,000 RMB for each of the winning team ( 5 Teams)

• Outstanding Participants Award: Airdrop to 15 DApp teams that develops quality DApps.

Please note that each participant will have free access to Ultrain’s trust computing service (worth 500,000 RMB) when they choose to enter the Hypernova Initiative.

For more detail, please stay tuned for Ultrain’s upcoming official website update. Which will include detailed guidance on Hypernova. Visit out webpage at https://ultrain.io.

read more

Industry dynamics and latest news about blockchain and currency

World’s Number One Commercial Public Chain Relys on This Secret Weapon
B

Now, it is finally the time for us to reveal the mysterious “secret weapon”of Ultrain and familiarize ourselves with the secret weapon they have been hiding under their sleeves – the zero-knowledge proof. The article below "How to use zero-knowledge proof to protect personal and business data" written by the Ultrain’s tech team, explains the zero-knowledge proof and privacy protection for the public chain to build a comprehensive business ecosystem and meet the needs of different application scenarios.

How to use zero-knowledge proof to protect personal and business data

It can be said that if there is no zero-knowledge proof, it is difficult to achieve privacy protection. The open and transparent nature of the blockchain cannot be applied to many industries where data privacy protections are needed. With the existence of such technology, Ultrain can realize the end goal of empowering real economy. Ultrain has completed the application of privacy protection solution and has been implemented in multiple scenarios. In this article. some uses cases are introduced to explain the principle how to use zero-knowledge proof to protect personal and business data.

During the information age, the protection of commercial data and personal privacy is very important. For individuals, information such as identity, consumption records, and health record will be part of a personal portrait. Once compromised, it can result in advertising harassment and even personal threats. For corporate business data, such as transaction flow, frequency, and business objects are confidential information of companies. Once those secretes are leaked to competitors, they are a huge threat to the company.

Whether it is a public chain or a permissioned chain, commercial data is synchronized between different nodes of the blockchain, if the data is not encrypted on desensitization platform, there are risk of being exposed and results in security problems.

Zero knowledge proof

Zero-knowledge proof is a method by which one party A can prove to the other party B that A knows a certain confidential information of x (such as age), and that a statement about the secret (such as being older than 18 years old) is correct, but do not disclose any information other than the statement.

Ultrain uses a zero-knowledge proof system based on zksnark. Compared to zero-knowledge proof systems such as zkSTARK or Legro, zksnark's proof is significantly smaller and has least impact on system performance. The proof and verification process are more efficient and has minimal loads on the nodes. In terms of theoretical security, zksnark is also more secure than other systems.

Through the support of zero-knowledge proof, we have naturally supported verifiable calculations, which we will not go in-depth here. The analysis described later can explain the relevant applications of verifiable calculations.

Example

We all know that if an Internet company sells patient data, it can cause great concern to patients, and will have seriously affects the credibility of hospitals and platforms. Through zero-knowledge proof, we can make data collection legal, open and transparent.

User sharing information

The user generates proof that the user utilizes his or her personal information, combines the proof key, generates evidence, indicates that he or she meets the criteria, and then submits it to the blockchain. In addition, the patient's data will be partially stored in the hospital and stored in the blockchain by the hospital. The patient can allow the hospital to transfer part of the data to the data requester in an authorized manner. The hospital encrypts the data and uploads it.

Business model turn into codes

As demonstrated on the above graph. The data requested by the data analysis company, will select data based on certain criteria. Those data will form a certain logic, generating a pair of proof keys and verification key. The verification key will be sent to smart contract, and those who submit data that meets the criteria will receive a reward

User sharing information

The user generates proof that they are using his or her personal information, combines the proof key to generates evidence that indicates that he or she meets the criteria, and then submits it to the blockchain. In addition, the patient's data will be partially stored in the hospital and stored in the blockchain hosted by hospital. The patient can allow the hospital to transfer part of the data to the party that’s authorized to receive such data. The hospital then encrypts the data and uploads it.

Automatic awards

The smart contract accepts the evidence submitted by the user and verifies if it meets the criteria, after passing the verification process, the user is authorized to issue incentives for the patients for their contribution. The data analysis company decrypts the corresponding encrypted data from the hospital and then analyzes the data.

In conclusion:

By sharing the private data of users and rewarding them in a specific manner, not only the data ownership, but associates it with actual application. This secret weapon allows the data to be more legally regulated, and sustainable a healthier data ecosystem.

read more

Dapp develop tools and high-quality application recommendations

How to build an end-to-end DApp on Ultrain - 2
R

Step2:Write DApp

There are two Dapps to be written, one is MiningDapp, the other is UDapp. We use the Javascript SDK U3.js to write the DApps. To be simple, we create the two DApps in one project.

Written by DApp

In WebStorm, create a new project -> Node.js Express App-> Template select Pug (Jade); modify the project name to CarbonDApp;

Click ‘Create’ to create a project

Import project dependent class library

Copy all the directories in node_modules in CarbonProject to the node_modules directory of CarbonDApp, and repeat the directory skipping without copying;
Copy the CarbonDApp/node_modules/u3.js/dist/u3.js file to the CarbonDApp/public/javascripts directory.

Modify the DApp server port

Since the default 3000 port is already occupied, you need to modify the server port of the DApp.

Open the bin/www file and find var port = normalizePort(process.env.PORT || '3000'); change 3000 to 3001

Create an account information browsing page

Create an index.html page in the public directory and add the following code to the page:

<html> <head> <meta charset="UTF-8"> <title>test</title> <link rel="stylesheet" href="/stylesheets/style.css"> <script src="./javascripts/u3.js"></script> <script> let u3 = U3.createU3({ httpEndpoint: 'http://127.0.0.1:8888', httpEndpoint_history: 'http://127.0.0.1:3000', broadcast: true, debug: false, sign: true, logger: { log: console.log, error: console.error, debug: console.log }, chainId:'2616bfbc21e11d60d10cb798f00893c2befba10e2338b7277bb3865d2e658f58', symbol: 'UGAS' }); async function getBalanceInfo() { let SYMBOL = 'CARB'; let account = 'ben'; const ben_balance = await u3.getCurrencyBalance({ code:'ben', symbol: SYMBOL, account: account }); document.getElementById("carbon_balance").innerHTML = '账户余额:'+ben_balance; const bob_balance = await u3.getCurrencyBalance({ code:'ben', symbol: SYMBOL, account: 'bob' }); document.getElementById("bob_balance").innerHTML = '账户余额:'+ bob_balance; const tom_balance = await u3.getCurrencyBalance({ code:'ben', symbol: SYMBOL, account: 'tom' }); document.getElementById("tom_balance").innerHTML = '账户余额:'+tom_balance; const tony_balance = await u3.getCurrencyBalance({ code:'ben', symbol: SYMBOL, account: 'tony' }); document.getElementById("tony_balance").innerHTML = '账户余额:'+tom_balance; const jerry_balance = await u3.getCurrencyBalance({ code:'ben', symbol: SYMBOL, account: 'jerry' }); document.getElementById("jerry_balance").innerHTML = '账户余额:'+tom_balance; const jack_balance = await u3.getCurrencyBalance({ code:'ben', symbol: SYMBOL, account: 'jack' }); document.getElementById("jack_balance").innerHTML = '账户余额:'+tom_balance; } getBalanceInfo(); //transfer(); </script> </head> <body> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>CarbonCoin发行方</h1> <p>账户:ben</p> <p>描述:进行CarbonCoin发行的发行方,持有所有未分配的CarbonCoin</p> <p id="carbon_balance"></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>节能设备1</h1> <p>账户:bob</p> <p>描述:通过节能产生CarbonCoin的节能设备1</p> <p id="bob_balance"></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>节能设备2</h1> <p>账户:tom</p> <p>描述:通过节能产生CarbonCoin的节能设备2</p> <p id="tom_balance"></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>航空公司C</h1> <p>账户:tony</p> <p>描述:大型航空公司,化石能源使用大户</p> <p id="tony_balance"></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>汽车制造商D</h1> <p>账户:jerry</p> <p>描述:大型汽车制造商,化石能源使用大户</p> <p id="jerry_balance"></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>CarbonCoin销毁账户</h1> <p>账户:jack</p> <p>描述:用于CarbonCoin销毁的账户,持有所有销毁的CarbonCoin</p> <p id="jack_balance"></p> </div> </body> </html> Start the DApp service, test the page
In the npm interface, double click the start button

After the server is successfully started, visit http://127.0.0.1:3001/index.html and the following page appears:

It can be seen that the issuer ben account holds 10 million of all CARB Tokens issued; other accounts have not yet held CARB Token;

Create a mining.html page

Mining.html page, energy-saving device 1 and energy-saving device 2 send the calorie value generated in the first 30 seconds to the energy smart contract every 30 seconds, and redeem CarbonCoin;

Create a mining.html page in the public directory, enter the following code:

<html> <head> <meta charset="UTF-8"> <title>test</title> <link rel="stylesheet" href="/stylesheets/style.css"> <script src="./javascripts/u3.js"></script> <script> let u3_bob = U3.createU3({ httpEndpoint: 'http://127.0.0.1:8888', httpEndpoint_history: 'http://127.0.0.1:3000', broadcast: true, debug: false, sign: true, logger: { log: console.log, error: console.error, debug: console.log }, chainId:'2616bfbc21e11d60d10cb798f00893c2befba10e2338b7277bb3865d2e658f58', keyProvider: '5JoQtsKQuH8hC9MyvfJAqo6qmKLm8ePYNucs7tPu2YxG12trzBt',//bob's private_key symbol: 'CARB' }); let u3_tom = U3.createU3({ httpEndpoint: 'http://127.0.0.1:8888', httpEndpoint_history: 'http://127.0.0.1:3000', broadcast: true, debug: false, sign: true, logger: { log: console.log, error: console.error, debug: console.log }, chainId:'2616bfbc21e11d60d10cb798f00893c2befba10e2338b7277bb3865d2e658f58', keyProvider: '5KXYYEWSFRWfNVrMPaVcxiRTjD9PzHjBSzxhA9MeQKHPMxWP8kU',//tom's private_key symbol: 'CARB' }); function wait(ms = 0) { return new Promise(res => setTimeout(res, ms)); } function randomFrom(lowerValue,upperValue) { return Math.floor(Math.random() * (upperValue - lowerValue + 1) + lowerValue); } async function mining() { let owner_account = 'ben'; const tr_bob = await u3_bob.contract(owner_account); const tr_tom = await u3_tom.contract(owner_account); // let amount = U3.format.UDecimalPad(2000,4); let heat_bob = randomFrom(15000,20000); let heat_tom = randomFrom(15000,20000); await tr_bob.recordHeat(heat_bob,{ authorization: [`[email protected]`] }); await tr_tom.recordHeat(heat_tom,{ authorization: [`[email protected]`] }); var d=new Date(); var t=d.toLocaleTimeString(); document.getElementById("bob_log").innerHTML = 'time :'+t+', heat value :'+ heat_bob; document.getElementById("tom_log").innerHTML = 'time :'+t+', heat value :'+ heat_tom; } mining(); var int=self.setInterval("mining()",30*1000); </script> </head> <body> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>节能设备1</h1> <p>账户:bob</p> <p>描述:通过节能产生CarbonCoin的节能设备1</p> <p id="bob_log"></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>节能设备2</h1> <p>账户:tom</p> <p>描述:通过节能产生CarbonCoin的节能设备2</p> <p id="tom_log"></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <button onclick="int=window.clearInterval(int)">stop</button> </div> </body> </html>

Go to http://127.0.0.1:3001/mining.html and the following page appears:

There are two things to note here.

When sending data to the energy smart contract, you need to hold the private key of the account before you can sign and send it. In order to simplify the programming, the private key is directly written to the webpage. In the actual program, the private key needs to be protected and hidden.

To simplify the writing, the Bob and tom DApp programs are written directly to a page. Actually, they should be two DApp program instances, which are running on two devices respectively.

Now our energy-saving equipment can already send data to the smart contract, and after the energy smart contract receives the data, it will pass the data to the operator server, and the operator server will call the energy smart contract again to exchange carboncoin. So we need to establish EnergyServer;

Step3: EnergyServer

Establish event monitor and handle events

In this section, we will deal with the above calorific value data upload event.

1.1 Establish listener event server code

In the bin directory of the CarbonDApp project, create a new file msgBroker.js and enter the following code.

const { createU3 , format} = require('u3.js/src'); const http = require('http'); const port = 3002; let u3 = createU3({ httpEndpoint: 'http://127.0.0.1:8888', httpEndpoint_history: 'http://127.0.0.1:3000', broadcast: true, debug: false, sign: true, logger: { log: console.log, error: console.error, debug: console.log }, chainId:'2616bfbc21e11d60d10cb798f00893c2befba10e2338b7277bb3865d2e658f58', keyProvider:'5JbedY3jGfNK7HcLXcqGqSYrmX2n8wQWqZAuq6K7Gcf4Dj62UfL',//ben's private key symbol: 'UGAS' }); let server = http.createServer((request, response) => { const { headers, method, url } = request; console.log(method); console.log(url); let body = []; request.on('error', (err) => { console.error(err); }).on('data', (chunk) => { body.push(chunk); }).on('end', () => { body = Buffer.concat(body).toString(); console.log("received msg:", body); if (body != null && body.trim()!="") { var obj = JSON.parse(body); let heatValue = JSON.parse(obj[1]).heat.split(",")[0]; let account = JSON.parse(obj[1]).heat.split(",")[1]; exchangeCarbonCoin(account,heatValue); } response.on('error', (err) => { console.error(err); }); response.statusCode = 200; response.setHeader('Content-Type', 'application/json'); response.write("ok"); response.end(); }); }); server.keepAliveTimeout = 0; server.timeout = 0; server.listen(port, function () { console.log((new Date()) + " Server is listening on port " + port); }); function wait(ms = 0) { return new Promise(res => setTimeout(res, ms)); } async function exchangeCarbonCoin(account,heat) { let SYMBOL = 'CARB'; let code = 'ben'; const tr = await u3.contract(code); let heatValue = format.DecimalPad(heat,4); const result = await tr.exchangeCarbonCoin('ben', account, heatValue+' ' + SYMBOL, 'test', { authorization: [`[email protected]`] }); let tx = await u3.getTxByTxId(result.transaction_id); while (!tx.irreversible) { await wait(1000); tx = await u3.getTxByTxId(result.transaction_id); if (tx.irreversible) { console.log(tx); break; } } }

The code establishes a service on port 3002. After the energy-saving device uploads its calorific value, the smart contract will send the energy-saving device to the service to upload the calorific value data. The service calls the exchangeCarbonCoin method of the energy smart contract to exchange the CarbonCoin.

1.2 Establish a listener event server startup script

Open the CarbonDApp/package.json file and add the following code to the scripts property: "event": "node ./bin/msgBroker"

1.3 Start the listening server

Refresh the npm window with the ‘event’ option

Double-click event to complete server startup

1.4 Register event monitoring mechanism on the chain

Query the internal network address of the machine through the ifconfig command, for example: 10.20.8.32

In the CarbonProject/test directory, create the registerEvent.js file; enter the following code in the file

const U3Utils = require('u3-utils/dist/es5'); const { createU3, format, listener } = require('u3.js/src'); const config = require('../config'); const chai = require('chai'); require('chai') .use(require('chai-as-promised')) .should(); const should = chai.should(); const expect = chai.expect; const assert = chai.assert; describe('Test cases', function() { it('event register', async () => { let account = 'ben'; const u3 = createU3(config); await u3.registerEvent(account, 'http:// 10.20.8.32:3002'); U3Utils.wait(1000); }); it('event unregister', async () => { let account = 'ben'; const u3 = createU3(config); await u3.unregisterEvent(account, ' http:// 10.20.8.32:3002'); U3Utils.wait(1000); }); });

Note that the registered address is modified to be the internal network address of the machine, and 127.0.0.1 cannot be used.
Run the event register test case to complete the event registration;

1.5 Test calorie value for CarbonCoin function

Visit http://127.0.0.1:3001/mining.html page, every 30 seconds, both bob and tom will randomly send a random value between 15000 and 20000 as the calorific value to convert the smart contract to CarbonCoin;
Visit and refresh the http://127.0.0.1:3001/index.html page, you can find that the CarbonCoin account of bob and tom is increasing every 30 seconds;

Step4:Improve DApp functionality

Add transfer function

After the energy-saving equipment acquires CarbonCoin, it can sell CarbonCoin to the enterprise, such as airlines, etc. The simple embodiment is that the equipment account can be transferred to the corporate company account;

Open the /CarbonDApp/index.html page and add the code

1.1 U3 object used when establishing the transfer

let u3_bob = U3.createU3({ keyProvider:'5JoQtsKQuH8hC9MyvfJAqo6qmKLm8ePYNucs7tPu2YxG12trzBt',//bob's private key }) let u3_tom = U3.createU3({ keyProvider:'5KXYYEWSFRWfNVrMPaVcxiRTjD9PzHjBSzxhA9MeQKHPMxWP8kU',//tom's private key })

1.2 Add the js code of the transfer to call the corresponding smart contract method

async function sendCoin(from,to){ let SYMBOL = 'CARB'; let code = 'ben'; let coins = U3.format.DecimalPad(this.randomFrom(100,500),4); if (from == 'bob'){ const tr = await u3_bob.contract(code); const result = await tr.transfer(from, to, coins + ' ' + SYMBOL, 'sendCoin', { authorization: [`[email protected]`] }); let tx = await u3_bob.getTxByTxId(result.transaction_id); while (!tx.irreversible) { await wait(1000); tx = await u3_bob.getTxByTxId(result.transaction_id); if (tx.irreversible) { alert("bob send coin success:"+ coins); break; } } } else if (from == 'tom'){ const tr = await u3_tom.contract(code); const result = await tr.transfer(from, to, coins + ' ' + SYMBOL, 'sendCoin', { authorization: [`[email protected]`] }); let tx = await u3_tom.getTxByTxId(result.transaction_id); while (!tx.irreversible) { await wait(1000); tx = await u3_tom.getTxByTxId(result.transaction_id); if (tx.irreversible) { alert("tom send coin success:"+ coins); break; } } } }

1.3 Add a call to the sendcoin() method on the page, update the following code

<div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>节能设备1</h1> <p>账户:bob</p> <p>描述:通过节能产生CarbonCoin的节能设备1</p> <p id="bob_balance"></p> <p><a href="#" OnClick="sendCoin('bob','tony')">给航空公司C转账</a></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>节能设备2</h1> <p>账户:tom</p> <p>描述:通过节能产生CarbonCoin的节能设备2</p> <p id="tom_balance"></p> <p><a href="#" OnClick="sendCoin('tom','jerry')">给汽车制造商D转账</a></p> </div>

1.4 Access the page and test the function

Visit: http://127.0.0.1:3001/index.html, click the "Transfer to the airline C" button, wait for a period of time (up to about 10 seconds, confirm the time for the Ultrain transaction), the following prompt appears, indicating the transfer success.

Add a company to convert CarbonCoin to a charity point function

By converting CarbonCoin into charitable points, the company makes its own contribution to reducing carbon emissions and enhances its reputation:

Open the /CarbonDApp/index.html page and add the code

2.1 U3 object used when establishing point redemption

let u3_tony = U3.createU3({ keyProvider:'5KbHvFfDXovPvo2ACNd23yAE9kJF7Mxaws7srp6VapjMr7TrHZB',//tony's private key }) let u3_jerry = U3.createU3({ keyProvider:'5JFz7EbcsCNHrDLuf9VpHtnLdepL4CcAEXu7AtSUYfcoiszursr',//jerry's private key })

2.2 Add the redeemed js code to call the corresponding smart contract method

async function exchangeScore(account){ let SYMBOL = 'CARB'; let code = 'ben'; let to = 'jack'; let coins = U3.format.DecimalPad(this.randomFrom(10,50),4); if (account == 'tony'){ const tr = await u3_tony.contract(code); const result = await tr.exchangeScore(account, to, coins + ' ' + SYMBOL, 'sendCoin', { authorization: [`[email protected]`] }); let tx = await u3_tony.getTxByTxId(result.transaction_id); while (!tx.irreversible) { await wait(1000); tx = await u3_tony.getTxByTxId(result.transaction_id); if (tx.irreversible) { alert("tony buy score success:"+ coins); break; } } } else if (account == 'jerry'){ const tr = await u3_jerry.contract(code); const result = await tr.exchangeScore(account, to, coins + ' ' + SYMBOL, 'sendCoin', { authorization: [`[email protected]`] }); let tx = await u3_jerry.getTxByTxId(result.transaction_id); while (!tx.irreversible) { await wait(1000); tx = await u3_jerry.getTxByTxId(result.transaction_id); if (tx.irreversible) { alert("jerry buy score success:"+ coins); break; } } } }

2.3 Add a call to the exchangeScore() method on the page, update the following code

<div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>航空公司C</h1> <p>账户:tony</p> <p>描述:大型航空公司,化石能源使用大户</p> <p id="tony_balance"></p> <p><a href="#" OnClick="exchangeScore('tony');return false;">购买公益积分</a></p> </div> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>汽车制造商D</h1> <p>账户:jerry</p> <p>描述:大型汽车制造商,化石能源使用大户</p> <p id="jerry_balance"></p> <p><a href="#" OnClick="exchangeScore('jerry');return false;">购买公益积分</a></p> </div>

2.4 Access the page and test the function

Visit: http://127.0.0.1:3001/index.html, click the "Buy Charity Points" button, wait for a period of time (up to about 10 seconds, confirm the time for the Ultrain transaction), the following prompt appears, indicating that the points are successfully redeemed. At the same time, you can see the number of CarbonCoins destroyed in the CarbonCoin destruction account at the bottom of the page.

Query the public welfare points exchange history

By enquiring the redemption history of charity points, we can establish a ranking of corporate charity points.

3.1 Creating a page

In the CarbonDApp/public/ directory, create a new leaderboard.html and enter the following code:

<html> <head> <meta charset="UTF-8"> <title>leaderboard</title> <link rel="stylesheet" href="/stylesheets/style.css"> <script src="./javascripts/u3.js"></script> <script> let u3 = U3.createU3({ httpEndpoint: 'http://127.0.0.1:8888', httpEndpoint_history: 'http://127.0.0.1:3000', broadcast: true, debug: false, sign: true, logger: { log: console.log, error: console.error, debug: console.log }, chainId:'2616bfbc21e11d60d10cb798f00893c2befba10e2338b7277bb3865d2e658f58', symbol: 'UGAS' }); function wait(ms = 0) { return new Promise(res => setTimeout(res, ms)); } async function getLeaderboard() { let owner_account = 'ben'; const tr = await u3.contract(owner_account); const result = await u3.getAllTxs(1,10000000,{"actions.name":"exchangeScore"},{_id:-1}); //console.log(result); let content = ''; for ( let i = 0 ;i< result.results.length;i++){ content = content + '<tr><td>'+ result.results[i].actions[0].data.from+":"+result.results[i].actions[0].data.quantity +'</td></tr>'; } document.getElementById("leaderboard").innerHTML = content; } getLeaderboard(); </script> </head> <body> <div style="padding:8px;border:1px solid #96c2f1;background:#eff7ff"> <h1>leaderboard</h1> <table id="leaderboard"> </table> </div> </body> </html>

We use the u3.getAllTxs(1,10000000,{"actions.name":"exchangeScore"},{_id:-1}); method to query all redemption transactions and print their specific data to the page.

3.2 Run page

Visit http://127.0.0.1:3001/leaderboard.html and you can see the following page:

Here is a history of all points redemption.

Summary

This tutorial system describes how to write an end-to-end web version of the DApp application. Although it has been simplified in the process of writing, it generally describes the overall picture of DApp application development, developers can do the basis of this framework. Enrich and improve your DApp application.

About developing DApp on iOS and Android, you can integrate u3.js into the corresponding hybrid Native development framework, and the principle is the same as the web version DApp.

read more

讨论共识算法、经济模型以及智能合约的开发

实现全球第一商业公链,要靠这个终极秘密武器
B

初识Ultrain项目的人们,总会对其综合优势和团队的光环倍感震撼。很多人对高大儒雅的郭睿和时尚国际范儿的Emma女神倍感熟悉。然而目标宏大到:“构建可编程商业社会“、 ”打造全球第一公链信任计算平台的”的超脑链,除了其拥有强大的研发工程能力,于2019年4月15日领跑世界打造出了全球第一款落地好用的公链3.0产品,国际顶尖的商业资源之外,原来还有一个秘密武器没有告诉大家。

今天让我们初步揭开超脑秘密武器的神秘面纱,认识一下超脑的密码学团队所带来的优于市面其他方案的可个的性化零知识证明解决方案。在此将超脑技术团队撰写的《如何利用零知识证明保护个人和商业数据》一文分享如下,为大家解读零知识证明和隐私保护对于公链构建真正商业生态,满足商业场景需求举足轻重的作用。

全文内容

《如何使用零知识证明保护个人和商业数据》

作者:Ultrain超脑链

可以说,倘若没有零知识证明,就很难达到所谓的隐私保护,区块链公开透明的特性也就无法适用于众多存在数据隐私保护需求的领域;而它的存在,才方能真正让Ultrain全面赋能实体经济的那一天早日到来。Ultrain今天已完成可直接应用的隐私保护方案,并已和多个场景的应用在深入落地执行当中,今天我们先抛砖引玉的通过一些案例和大家简要阐述一下如何使用零知识证明保护个人和商业数据的原理。

在信息时代,商业数据和个人隐私的保护非常重要。对于个人,身份特征、消费记录、健康等信息都会成为个人画像的一部分,一旦被泄露,会导致广告骚扰甚至人身威胁。对于公司,商业数据,如交易流水、频率、业务对象,是公司的核心机密,一旦让竞争对手知道,更是对公司的巨大威胁。

无论是公链还是联盟链,商业数据都是在区块链的不同节点之间同步的,所以在没有进行加密或者脱敏处理的情况下,区块链的使用者在区块链上的信息将会暴露,引发安全问题。

零知识证明

零知识证明:一种方法,通过该方法,一方A可以向另外一方B证明A知道一个秘密x(比如年龄),并且关于秘密的某项陈述(比如年龄大于18岁)是正确的,但是又不透露除了该陈述的任何信息。

Ultrain采用基于zksnark的零知识证明系统,相对zkSTARK或者Legro等零知识证明系统,zksnark的证明显著更小,对系统性能影响最低。证明和验证过程都更高效,对节点负载最小。在理论安全性上,zksnark也比其他系统经过更多学术研究,更加安全。

通过对零知识证明的支持,我们已经自然而然支持了可验证计算,此处不再赘述,后述分析可具体解释可验证计算的相关应用。

举例

我们都知道假如某互联网公司通过销售病人数据,可以给病人造成很大的骚扰和健康损失,同时也严重影响了医院和平台的公信力。通过零知识证明的方式,我们可以让数据的采集合法合规,公开透明。

比如一家医疗数据分析公司希望能够获取年龄大于40周岁,患糖尿病人的医疗数据(比如血液,体重等)。公司希望能够给提供这些数据的人一些奖励,比如现金或者积分奖励,同时又只是定向采集有用的数据,而不侵犯病人的隐私,比如姓名、电话号码等。

![替代文字]( 图片地址)

业务模型转为代码

如图所示,数据需求方,即数据分析公司,将筛选标准(比如年龄大于40周岁,患糖尿病)固化为代码逻辑,生成一对证明钥匙和验证钥匙。验证钥匙发送给区块链合约。提交符合满足条件的数据的人,将获得相应奖励。

用户自主分享信息

用户生成证明用户利用自己的个人信息,结合证明钥匙,生成证据,表明自己符合标准,然后提交到区块链上。此外,病人的数据还会部分存放在医院里,并被医院存证在区块链上。病人可以通过授权的方式,允许医院将部分数据传输给数据需求方。医院将数据加密后上传。

自动发放奖励

智能合约接受用户提交的证据并验证,通过后,则认可用户为需要的病人人群,发放激励。数据分析公司对医院传来的相应加密数据解密,然后进行数据分析。

总结

通过合法合规的用户自主控制的隐私数据分享和奖励,不仅激活了数据拥有和应用两端,而且做到了合乎法律监管,健康良性,可持续的大数据生态。

read more

黑客马拉松与经常性的线下见面会或在线趣味游戏

共庆微软乔迁: 超脑受邀闭门交流企业解决方案
B

今日,微软于上海举办新址落成仪式,在庆贺乔迁之喜的同时,为更好地助力本地企业实现数字化转型战略计划、赋能上海科创转型新生态,微软也携众多合作资源,举办了创新解决方案企业客户对接会。

本次,共有来自工业互联网、工业物联网、人工智能、区块链、增强现实、智能家居、大数据、智能零售等众多行业领域的10家合作伙伴亮相,与在场众人深入探讨最新行业技术解决方案。

Ultrain作为微软深度合作伙伴,再次荣幸应邀参加了本次活动!作为区块链行业的唯一代表,我们与来宾共话转型商机,助力本地企业踏上新里程。

Ultrain生态副总裁Samuel肖颖浩代表Ultrain,向在座各位详细介绍了Ultrain的技术优势、商业生态发展情况,并面对面深度探讨了各行业解决方案,获得了现场来宾们的热烈反响!

我们相信,在微软、亚马逊等等各互联网巨头的大力支持之下,Ultrain定将赢得更多的主流影响力,走进大众的视野,在实现可编程商业社会的道路上再进一程!

read more

关于区块链与币市的行业动态与最新消息

猪年最萌,地表最强的区块链第一表情包来了!
B

号外!号外!
区块链界绝无仅有的猪年定制表情包——
Ultrain小象表情II今日上线微信表情商店!

经过长时间的精心设计、层层过审,让大家翘首以盼的 Ultrain 超新星小象猪年定制版表情终于在今天上线啦!

众所周知,Supernova 超新星小象是我们 Ultrain 备受欢迎的吉祥物,它来源于我们联合创始人 Emma 女神的创意。此前,Ultrain 就曾发布过第一版小象表情,并深受大众喜爱。除配套表情包外,团队还发布了公仔、T恤等周边产品,并制作了如世界杯特别系列等纪念版为社区朋友带来惊喜。

小象是 Ultrain 精神理念的化身。大象是丛林之神,既聪明,又踏实,并且非常具有家庭团队精神,充分体现出Ultrain的团队的特质。与此同时,小象头顶的Ultrain logo也体现出了天线宝宝一样既可爱又科幻的感觉。

活动中随处可见Ultrain小象身影

Ultrain 作为一个区块链技术公司,Emma作为唯一的女性联合创始人,希望把极客深奥的前沿科技,不但通过深入浅出的语言让更多人容易理解,也希望引入各种多元周边更加贴近大众,把超脑的品牌定位和团队精神更好地传播出去,与大众产生连接。

感兴趣的社区朋友们,欢迎打开微信表情商店,搜索“ Ultrain 小象表情”,解锁这套分分钟把你萌化的猪年定制表情!还没有下载过Ultrain第一版表情的朋友们,也可搜索“ Ultrain 超新星小象”,把这两套表情包——共计 32 个可爱又实用的表情统统收入囊中!

read more

链上分布式应用的开发工具以及高质量的应用推荐

新版Ultrain浏览器上线,终于可以查Token啦!
I

Ultrain测试网上线后,很多开发者尝试写了合约,并用Ultrain浏览器进行了合约的部署操作。其中最热门的就是发Token合约,大家也想亲身体验发Token的快感!连Ultrain团队的的好几个程序员都迫不及待地进行创建账户、申请资源、写合约、部署合约、调用合约等一系列流程,尝试发Token。

可是操作完,大家向产品经理抱怨:通过「超脑浏览器」对Token合约部署、调用操作之后,在浏览器找不到自己的Token信息。于是产品经理第一时间拉着视觉、开发们,完成了测试网超脑浏览器的Token查询的设计,同时新版的Ultrain浏览器也在很多方面做了优化,继续往下看吧!

1、新增首页数据
打开新版Ultrain浏览器,首页除了全新的视觉设计,一眼就能看到块高、交易数、账户数、合约数、Token数的信息,帮助用户直观地了解超脑链最新数据。

2、Token查询
部署完Token合约,直接在超脑浏览器就可以查询到Token信息,超方便啦!

3、查看账户内Token信息
除了Token列表,在自己的账户内也可以查看账户拥有的Token信息啦。不用手动搜索,浏览器自动同步账户内Token信息,很贴心了哦~

4、无线端兼容
新版的整体视觉做了优化,包括列表页、详情页、创建账户流程、合约部署和调用流程等,同时也特别对无线端做了兼容处理,让用户在手机上操作时更舒服。

5、其他
开发还在性能上、缓存策略上进行了优化,使页面加载速度有了明显提升。

Ultrain浏览器的地址(https://explorer.ultrain.io/),你也来试一试吧!有问题的话,可以到开发者门户-论坛(https://bbs.ultrain.io/)给我们留言哦!

read more