Skip to content

Java implementation of the Polkadot Host

License

Notifications You must be signed in to change notification settings

LimeChain/Fruzhin-Web

 
 

Repository files navigation

Fruzhin-Cover-Black

What is Fruzhin?

Fruzhin is a Java implementation of the Polkadot Host. With the help of TeaVM it is now available as a JS based light client in web environments. It makes use of other full nodes to provide RPC server like behaviour.

It's been funded by Polkadot Pioneers Prize.

Warning Fruzhin is in pre-production state

Example

Starting Fruzhin

In order to use Fruzhin in your webpage you have to import the appropriate JS files from UNKPG. Then you can call the fruzhin.main() method with a string array parameter that takes one entry. The parameter can be one of the following:

  • Well known chain name (polkadot, westend, kusama)
  • A chain spec string
<!DOCTYPE html>
<html>
<head>
    <title>Fruzhin</title>
    <script type="module" src="https://unpkg.com/fruzhin/dist/js/fruzhin-lib.js"></script>
</head>
<body>
<script type="module">
    fruzhin.main(['polkadot']);
</script>
</body>
</html>

Making RPC calls

Once Fruzhin is started an RPC client is exported under a wsRpc object. Making a call is easy.

wsRpc.send('{"jsonrpc":"2.0","id":1,"method":"system_name","params":[]}')

Then the response can be retrieved by calling wsRpc.nextResponse().

NOTE wsRpc.nextResponse() returns null if no response is present in the queue.

About

Java implementation of the Polkadot Host

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.2%
  • Other 0.8%