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.

Greetings! Thanks for the post. Reesteem

Hi @fabien! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. Starting from the witnesses, UA propagates from user to user based on its followers until equilibirum is reached. We are currently in test modus upvoting quality contributions with a high UA value (UA_author + UA_post)! Your UA_post value is 7.803.

Thank you for sharing...

It's a great job

Hi @fabien,

I made @sisilafamille follow me :)

https://busy.org/@sisilafamille/blockchainstudio-the-creator-of-gomdory

Thanks a lot for your work on busy and steemconnect. Please give me a fullvote by @busy.pay haha :)

Ho i see well done! I was wondering what this was about lol. Where did you got @sisilafamille key by the way?

Thanks for your reply! I don't have a key for @sisilafamille. Probably only you know it :) As you know (probably you may have forgotten cause it might be too old days), @sisilafamille has multisig (2 of any @guest123, @hellosteem, and of course you :) and keys for @guest123 and @hellosteem are open in the examples, e.g., steem-js and such. Actually there is a multisig test code using that combination (but not for following function. following is a little bit more trickly since it requires custom_json)

Since it's open in github source, I think it can be used for some testing by anybody, right? Actually many already did. But @sisilafamille's following was the first :)

This is the posting about it. Show me your full vote :) I'm kidding but it'd be good to have your voting. of course need not be a full vote. https://busy.org/@blockchainstudio/multisig-sisilafamille-followee
Sorry it's mainly in Korean. I told people that I'll give some steem if they also make @sisilafamille follow them. One guy already made it :)

You're working in busy, especially on steemconnect, right? I worked at Facebook headquarter before, and that's one reason why I'm more interested in Steemit. Now I'm in academia as an economist. But I was also a SWE before, so these days I'm doing some programming on the steem blockchain as a hobby. @gomdory (it means "bear" in Korean) is such a thing. It's a bot (in kr community) that gives a free vote on comments that would be lost otherwise (i.e., < $0.02) As you know kr is a big community on steemit. but many left (probably due to steem/sbd price). @gomdory is to support people write interesting comments on neighbor's posts. (he only votes when some minimum is already voted and there are many exclusion rules to avoid abusing)

Ho yes, i completely forgot that i've setup multisig on @sisilafamille some time ago. Well done being through multisig signature. And no i'm not working on Busy anymore but still on SteemConnect :).

Thanks a lot for your voting and following :) Sorry for my late reply due to RC shortage after HF20 :( As you may know, @temp is another very interesting account that has no key. So it needs 0 signature :) https://busy.org/@temp/test-by-bcs (my test posting)

I knew @temp was a special account due to my old posting (virtually my only posting in eng) https://busy.org/@blockchainstudio/real-one-millionth-steemit-user-and-hidden-very-first-user
But it was very interesting to know that I can actually use it :)

Hope RC system will be stablized soon. These days comments are much more valuable resource than votings :)

Another interesting thing that I've found (maybe this isn't new though) https://steemit.com/kr-steemit/@blockchainstudio/hangeul-tag

Just see the tags :) I'm actually worried buffer overflow attack, but maybe it's prevented by the block-size limit.