Testing

Now we have the smart contracts ready for conducting atomic swaps between the assets of two different blockchains. Next, let's write some JavaScript code to test the preceding contracts and conduct an atomic exchange. The following code allows you to do this. For testing and simulation purposes, you can run the following code in one single Quorum node with four accounts:

var generateSecret = function () {    return Math.random().toString(36).substr(2, 9);};var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));var RBI_Address = "0x92764a01c43ca175c0d2de145947d6387205c655";var FRS_Address = "0xbc37e7ba9f099ba8c61532c6fce157072798fe77";var BOA_Address = "0x104803ea6d8696afa6e7a284a46a1e71553fcf12";var ICICI_Address ...

Get Blockchain for Enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.