March 12, 2026

Capitalizations Index – B ∞/21M

Building with Kyber Network – QuikNode –

Building with Kyber Network – QuikNode –

Now we will set up Kyber network contracts.

We will use a predefined mnemonic, so we don’t need to configure addresses for the contract and for our wallet. Run this command to start Ganache:

Before starting, we need to deploy all of our contracts. For that we need to run the migration:

We are using a predefined mnemonic, so you will get the same addresses defined below:

Running Truffle example:

Let’s run an example from truffle directory.

truffle exec examples/truffle/getExpectedRate.js

This will give us the exchange rates but with different configured tokens.

Running Web3 example:

Let’s get the exchange rate again — but this time, we will use NodeJs.

cd examples/web3
node getExpectedRate.js

Using solidity contract for swapping token:

Now let’s swap tokens by interacting with Kyber network contracts.

We will swap KNC (Kyber Network Token) with OMG (OmiseGO Token).

Remember, you can do the same with using Web3 and Truffle examples, but running the test with Truffle console is a lot easier and interactive. So let’s get truffle console:

truffle console

Our user address is 0x47a793D7D0AA5727095c3Fe132a6c1A46804c8D2 — this we will use again, so let’s assign it to a variable:

let userWallet = '0x47a793D7D0AA5727095c3Fe132a6c1A46804c8D2'

We have a Trade.sol in our Solidity folder, which we help us in swapping the token. You can check out the code for the contract: examples > solidity > Trade.sol.

Now, we need to get an instance for that Contract:

let tradeInstance = await Trade.at(Trade.address)

Next, as we are going to swap KNC with OMG, let’s get the Instance for both contracts. You can find these token contract undercontracts → mockTokens . These are mock ERC20 tokens. In production, you will need actual contract address for these tokens on ETH MainNet.

let kncInstance = await KyberNetworkCrystal.at(KyberNetworkCrystal.address)
let omgInstance = await OmiseGo.at(OmiseGo.address)

Now, let’s get our balance for each token:

let kycBalance1 = (await kncInstance.balanceOf(userWallet)).toString()
let omgBalance1 = (await omgInstance.balanceOf(userWallet)).toString()

You can check these balance by running:

kycBalance1
omgBalance1

Now, we need to give Trade contract approval to withdraw tokens from our contract:

await kncInstance.approve(tradeInstance.address , web3.utils.toWei('100000'), )

We can now swap tokens! Let’s look at the Trade.sol method, which we will use to swap the tokens:

function execSwap( ERC20 srcToken, uint srcQty, ERC20 destToken, address destAddress, uint maxDestAmount)

Here,

srcToken — source token contract address

srcQty — amount of source tokens

destToken — destination token contract address

destAddress — address to send swapped tokens to

maxDestAmount — address to send swapped tokens to

So let’s call the method accordingly:

tradeInstance.execSwap(kncInstance.address, web3.utils.toWei("100") , omgInstance.address,userWallet, web3.utils.toWei("1000000"), )

If you have followed the tutorial ‘till now, you have successfully swapped two tokens using Kyber Network protocol!

Let’s verify our token balance again:

let kycBalance2 = (await kncInstance.balanceOf(userWallet)).toString()
let omgBalance2 = (await omgInstance.balanceOf(userWallet)).toString()
kycBalance2
omgBalance2

You will see the change in balance.

Conclusion

If you faced any problem you can check here or ask questions in Kyber’s network telegram group. Kyber also has good documentation. So, what are you waiting for? Integrate your Dapp with Kyber network!

Let us know what you want to learn about in the comment section.👇

About QuikNode

QuikNode is building infrastructure to support the future of Web3. Since 2017, we’ve worked with hundreds of developers & companies, helping scale dApps and providing high-performance Ethereum nodes. We’re working on something interesting from the past few months and will be launching soon, so subscribe our newsletter for more updates!! 😃

Published at Thu, 23 May 2019 07:04:04 +0000

Previous Article

Crypto Market Wrap: $14 Billion Blitzed as Bitcoin Beats a Retreat

Next Article

BTC Price Swings above $7600

You might be interested in …

ICOs Withdraw $17 Million in ETH During November

Live bitcoin News ICOs Withdraw $17 Million in ETH During November As the crypto market has cratered over the last month, ICOs responded by withdrawing 170,000 Ethereum from their coffers. To say that 2018 has […]

Cardano Blockchain's First Use Case: Proof of University Diplomas in Greece

cardano use case

Greek graduates may soon be able to prove their qualifications by way of a blockchain.

GRNET, the national research and education network of Greece, is working on a pilot project with blockchain research and development company IOHK to verify student diplomas on Cardano, a blockchain that launched in September.

The project is notable because it is the first official use case of Cardano, a proof-of-stake-based cryptocurrency and soon-to-be smart contract platform currently under development by IOHK.

The GRNET app will be built on Enterprise Cardano, a private or permissioned ledger version of Cardano. Unlike a public blockchain, where anyone can join in and participate, a private blockchain allows only a restricted set of users to validate block transactions.

So far, three Greek universities are participating in the project. While IOHK is providing the decentralized database, GRNET is providing the web front end and support and will bring together other universities participating beyond the pilot.

Funding for the project comes in part from Horizon 2020, a European program for research and innovation. Development of the prototype is already under way, Aggelos Kiayias, IOHK’s chief scientist, told bitcoin Magazine.    

Why Diplomas?

Given IOHK’s deep ties with academia, it is no surprise to find the company working on a project that involves universities. But why diplomas?

Putting diplomas on a blockchain takes the paperwork out of the process and makes it easy and simple to check if someone holds a degree.

Typically, when a student graduates, they receive a paper copy of a diploma signed by the dean and co-signed the university’s registrar. All of the students’ transcripts and records are stored in the university’s centralized database.

To confirm that a graduate has the degree they claim to have, an employer has to check the official diploma or call the university. The labor-intensive process makes it too easy for unqualified applicants to slip under the radar.

Putting documents and records on the blockchain eliminates opportunity for fraud in that it allows graduates and universities to “issue a proof that a qualification exists that is undeniable,” said Kiayias. “This is a point of reference that can be agreed [on] by everyone.”

Cryptographic Proof

But to protect student privacy, instead of putting an entire diploma on the blockchain, GRNET plans to put only a cryptographic hash of a diploma on the blockchain.

Digital documents are easy to alter in ways that are undetectable to the human eye. But as long as the digital version shown to an employer hashes to the same output as what is stored on the blockchain, that proves the document is the original, unaltered version.

“We cannot put any plaintext on the blockchain, as diplomas and transcripts are personal information. We only put hashes; we may put entire diplomas and transcripts, but they will always be encrypted,” Panos Louridas, GRNET consultant and associate professor at Athens University of Economics and Business, explained to bitcoin Magazine in an email.

This is not the first effort to store diplomas on the blockchain. In October, MIT announced its own pilot project to verify digital diplomas using the blockchain.   

But Louridas claims the GRNET pilot is different from prior projects in that it stores the entire chain of verification steps on the blockchain. Each step would be recorded as its own immutable transaction on a separate block in the blockchain.  

“You don’t really need a blockchain to store diplomas: a simple system with some digital signatures by the host institution would do,” he said. “We want to be able to record that somebody has asked for proof of a degree, that the proof has been granted, that the proof has been forwarded to a verifier, and that the verifier can verify that the degree is valid, and nobody can dispute any of the above steps.”

The three Greek universities taking part in the pilot include Aristotle University of Thessaloniki, Democritus University of Thrace and Athens University of Economics and Business.


The post Cardano Blockchain's First Use Case: Proof of University Diplomas in Greece appeared first on Bitcoin Magazine.