Byteball.js: The JavaScript library for Byteball is out!

in #utopian-io6 years ago (edited)

Repository

https://github.com/bonuschain/byteball.js

Byteball.js

Today we are proud to bring you the beta release of Byteball.js!

What is it?

Byteball.js is a JavaScript library that allow you to interact with a Byteball node. It was designed to work both in the browser and in Node.js. If you are familiar to Steem.js you will quickly understand how Byteball.js works, both of these libraries serve the same purpose but they are just made for a different chain.

What can you do with it?

Here are some cool things you can do today using Byteball.js:

  • Spend bytes or others Byteball public asset.
  • Create your own token, bind a smart contract on your token.
  • Run an oracle service, post verifiable data on the chain that can be used by smart contracts.
  • Work with attestations, build an attestor service or check attested addresses.
  • Create polls and vote for them.
  • Set your public profile.
  • Post arbitrary data or text on the DAG.

Quick start

Install

To install Byteball.js on Node.js, open your terminal and run:

npm i byteball --save

You can also create an index.html file and include Byteball.js script to use it on your browser like this:

<script src="https://cdn.jsdelivr.net/npm/byteball"></script>

Usage

Here is how to initiate the client:

const byteball = require('byteball');

const client = new byteball.Client(); ​

All API methods follow this pattern:

// If the last argument is a function it is treated as a callback 
client.api.getJoint('oj8yEksX9Ubq7lLc+p6F2uyHUuynugeVq4+ikT67X6E=', function(err, result) {
  console.log(err, result);
}); 

// If a callback is not provided, a Promise is returned 
client.api.getJoint('oj8yEksX9Ubq7lLc+p6F2uyHUuynugeVq4+ikT67X6E=').then(function(result) {
  console.log(result);
});

Transaction

To compose and post unit you need first to create a Byteball wallet and fund it with the native currency ‘bytes’. The generated WIF will be used on Byteball.js. Click on this link to learn more: https://byteballjs.com/utils/generate-wallet

Here is how to make a payment:

const wif = '5JBFvTeSY5...'; // WIF string generated (private key)
const params = {
  outputs: [
    { 
      address: 'NX2BTV43XN6BOTCYZUUFU6TK7DVOC4LU', // The Byteball address of the recipient 
      amount: 1000 // The amount he receives
    } 
  ] 
}; 

client.post.payment(params, wif, function(err, result) {
  console.log(result); // The unit hash is returned
});

Documentation

You can find the current documentation for Byteball.js at https://byteballjs.com

How to contribute?

Byteball.js code is entirely open source with a MIT license. You are welcome to contribute on the project by opening issues and pull requests on the GitHub repo here: https://github.com/bonuschain/byteball.js

Roadmap

In the next few months we are going to implement new features on Byteball.js like these:

  • Ability to broadcast smart contract
  • Ability to verify attested private profile
  • Ability to send private messages
  • Ability to send private payment

Join the discussion

Got some ideas, questions or feedbacks you want talk about? We would love to hear from you, join the discussion here or on Byteball Slack channel #byteball-js. Click here to get invited: https://slack.byteball.org.

Final words

We would like to thank Byteball trustees who voted to fund this project and also Utopian for helping open source projects like Byteball.js.

GitHub Account

https://github.com/bonuschain

Sort:  

Cool stuff.

This reminded me that I should complete the python version. :)

Are you working on a python library for Byteball? This would be great!

Yes, I have started a couple of months ago, but couldnt touch it lately. :)

There would seem to be quite a few possibilities for you on this ;-)
Write a grant proposal like Fabien did
Join the Use-a-Thon for a shot at the 22 GB prize pool
Post it as a valid contribution to be rewarded by Utopian

Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem].

great job. thank you for opening new door to many front-end developers. it helps to make more powerful byteball ecosystem

Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem]. Steem transfer error: [invalid trans: 6789], [report lost steem].

Great, this will encourage more adoption with the platform

Hmm this makes me wonder what's the benefit of developing on byteball? What kind of project on steem can we link to byteball?

With the extensive APIs for Steem, I'd be amazed if someone didn't create an oracle to pick up stuff on Steem to resolve conditions on smart contracts. It would allow two Steem users to make a bet how many votes a given post would get in 30 minutes. After 30 minutes, the oracle posts the data from the API to the Byteball DAG, thereby allowing the conditions of the smart contract to determine which of the two parties can withdraw the funds that both users deposited on it for the bet.

Stuff like that :)

A STEEMbet bot is quite a thought! Vote A or B, in time we'll see! Your wheels are always turning. Fantastic ideas. Love it!

There can be a lot of use case for Steem app using Byteball. The first thing that come in my mind is ICO. Byteball make it easy to create your asset and run an ICO similar than ERC20 token for Ethereum it could be used for app willing to launch a SMT see more detail here: https://bitcointalk.org/index.php?topic=4934262.0 . You can also leverage Byteball protocol for manage attestations or create smart contracts.

Nice work :) @fabien sais-tu si il existe un benchmark de comparaison avec les autres types (blockchain, DAG version IOTA) quelque part (ai pas trouvé) et si tu avais un article de départ à conseiller au sujet de Byteball et de ce qu'il est possible de faire avec quel serait-il (français ou anglais peu d'importance)?

Merci pour tous ces liens, c'est sympa!

Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately]. Steem transfer error: [invalid trans: 1059], [report lost steem immediately].

Good news will try to impliment

Posted using Partiko Android

Good to hear!

I am really support this project man! Great work for you and team!

Interesting, I might have to try this out.

I'm liking Byteball so far, been "mining" with World Community Grid. Sports betting is very well done too.

Good to see you're involved on that chain too.

It's a great job

Thank you for sharing...