Bytecoin: Under the Hood

Discussion of code updates and pull requests proposed by the community across all CryptoNote currencies.

Bytecoin: Under the Hood

Postby ullo » Mon Apr 06, 2015 7:06 pm

A lot of work has been done on refactoring Bytecoin Core’s source code. This process started with the version 0.8.11, which had Bytecoin high-level API interface declared for the first time. The newly released Bytecoin Reference Client v.1.0.3 is the next significant updated for the Bytecoin Core.

Here I will explain what has been happening under the Bytecoin's hood and what our technology vision is. This description is crucial to understand Bytecoin’s roadmap and the necessity to pursue its vector.

The v.1.0.3 release notes focus on the following updates:

    In-process INode implementation for applications
    Low-level ITransaction API interface for ordinary and multisig transactions
    Simplewallet migration to high-level API (namely, INode plus IWallet)
    Instant transaction notifications for in-process INode


Purpose of this update

V.1.0.3 is an important milestone on the way to standardize various components' access to Bytecoin network. It is also a requirement for Bytecoin GUI Wallet, which is coming out later this week.

We are currently getting Bytecoin Wallet ready for the release, and have already rolled out the new version of simplewallet. These wallets are very different, as simplewallet doesn't provide real-time interaction and shows only a tiny part of the information that Bytecoin Wallet has. However, both wallets are powered by exactly the same two high-level API interfaces: INode and IWallet. This allows us to greatly unify Bytecoin source code and improve development process efficiency.

What is even more important, the newly updated high-level API gives 3rd party developers the native access to all Bytecoin features. As of now, any developer wishing to create his own native Bytecoin wallet has all the tools available.

We firmly believe that for the vast majority of cases 3rd party developers should operate on the business logics level, not going into technological hardcore. Our high-level API (namely, INode and IWallet interfaces) serves that very purpose. It is much easier to operate with from inside a C++ application than the classical bytecoind and simplewallet REST API. It gives access to all main Bytecoin features in a convenient and comprehensible way. For example, you don't need to take care of an instance of simplewallet running in the background to power your GUI wallet. Business can focus on the user experience and let IWallet work out-of-box! And in case you need to have a higher level of control over CryptoNote protocol, utilize low-level ITransaction interface instead of high-level IWallet.

By introducing such a level of abstraction, we greatly simplify the experience of applications developers that work with Bytecoin. Our high-level API is a single point of responsibility. In case you need a method that is not yet provided, you may contact Bytecoin Support and have it implemented in the upcoming releases.

INode

Bytecoin network basics

Bytecoin depends on its peer-to-peer network, basic unit of which is a node. The most common node that you may find in the network is Bytecoin Reference Client daemon (bytecoind).

There are two general types of nodes:

    Seed is a node that allows inbound connections.
    Peer is a node that doesn't allow inbound connections (e.g. if its user chooses so or due to firewall network rules). Since all the nodes are frequently asking other seed nodes if anything new has happened in the network (a new block mainly), peers are still perfectly synced.

INode and Bytecoin network node

Currently there are two implementations of Bytecoin nodes available:

    Standard bytecoind console daemon which is capable of using Bytecoin p2p protocol and providing RPC interface for external access.
    INode, which is an API library that allows any C++ application to participate in Bytecoin p2p network on the blocks level. Any application that uses INode API library is indistinguishable from other network nodes.

Bytecoin’s daemon refactoring announced in Bytecoin roadmap implies, among other improvements, daemon migration to INode library. We are doing to this to unify Bytecoin technology core and allow any 3rd party developers to easily access all Bytecoin network features. The resulting application, whatever purpose it may have, will be a full-fledged Bytecoin node. Moreover, INode library is more efficient than the legacy bytecoind source code.

INode is one interface that has two implementations: proxying INode and in-process INode.

    Proxying INode re-routes all the requests to another node (e.g. your localhost bytecoind or some other remote daemon).
    In-process INode is a standalone network node that is capable of exactly everything the ordinary daemon can do. It is called "in-process" since it runs inside another application that requires Bytecoin network access.

Prior to Bytecoin v.1.0.3 only the proxying INode implementation was available. With an advent of in-process one, INode becomes much more flexible. For instance, if you have a local daemon running, the application that utilizes INode will choose its proxying implementation and connect to local bytecoind instead of launching a new in-process instance.


Bytecoin IWallet and ITransaction

While INode is capable of relaying and processing blocks, it cannot access any information regarding user funds or create transactions. However, there are certain applications (e.g. wallets) that require such methods.

Bytecoin team wanted to give a varying level of access to CryptoNote transactions core with two API interfaces:

    IWallet operates on the business logics level. It is useful if you simply need to receive and send transactions, without going into CryptoNote protocol details. Should you require to transfer money with IWallet, you just need to indicate the receiver's address, the amount, and the mixing level. IWallet will do the hard work for you, as it will select the inputs, and then create, validate, sign, and broadcast the transaction.
    ITransaction is a low-level interface that gives full access to CryptoNote transactions engine. It is designed for those applications that require strict control of transaction creation process. For instance, ITransaction allows you to select specific inputs, and has separate methods for signing and broadcasting a transaction. It also provides access to multisig functionality.

Both API interfaces are capable of doing exactly the same, but with varying level of detalization. That is why IWallet belongs to Bytecoin high-level API, while ITransaction is low-level.

Both new simplewallet and the upcoming Bytecoin Wallet have IWallet in their core. Just like INode interface can boast with better performance than legacy bytecoind, IWallet is a faster version of legacy simplewallet source code. As of version 1.0.3 simplewallet has migrated to this interface, which reduced the time required to process a single block by 15%.

To be precise, new Bytecoin simplewallet is a basic console program that uses IWallet and proxying INode. On the other hand, Bytecoin GUI Wallet utilizes IWallet and in-process INode (which automatically runs as proxying in case you already have an instance of bytecoind launched).

We expect the vast majority of applications to choose IWallet, while ITransaction is for those who require CryptoNote transactions fine-tuning. For instance, this level of access may be required by such services as payment processors. These applications often have their own custom logic of transaction creation and various complicated modules. ITransaction allows to split the transfer process according to the architecture needs.

Moreover, ITransaction also gives access to multisignature API that is capable of powering on-blockchain escrow services and foundation wallets. Bytecoin multisig belongs to M-of-N scheme. We will be covering multisignature in details in one of the next blog posts, but here you may find its description in laymen terms.


Conclusions

Said APIs are important to those businesses that want to operate with cryptocurrency easily, without sophisticated development and core’s explorations. These businesses can focus on marketing of their products; all the hard work of integration with our financial system is done by our reliable interfaces.


More details on v.1.0.3 Reference Client release

Image

In-process INode implementation for applications

INode is the high-level API interface that allows any application to utilize core features of Bytecoin p2p network. Its new implementation provides a full-fledged network node inside any C++ application. It also largely standardizes codebase and powers Bytecoin GUI Wallet, which is coming out later this week.

Low-level ITransaction API interface for ordinary and multisig transactions

Bytecoin low-level API interface provides 3rd party developers with a flexible access to CryptoNote transactions engine. It gives access to core functions that allow to create, validate, sign, and broadcast a transaction. It also provides multisig access.

This update is aimed for wallet and multisig applications developers. Bytecoin low-level API provides full control of CryptoNote transactions technology allowing you to select specific inputs of a transaction. It also gives tools to utilize multi-signature protocol and create such products as native escrow and M-of-N board wallets.

Instant transactions notification

With this feature Bytecoin transactions become real-time. When Alice broadcasts her newly created Bytecoin transaction to Bob, his wallet will immediately recognize it and update Bob's balance before the transaction is included in the blockchain. This is achieved through IWallet API interface that subscribes to all the transactions of the node it is connected to and instantly recognizes the transactions sent to you.

Simplewallet migration to high-level API

Legacy simplewallet code has been migrated to the new high-level API libraries. Even though simplewallet remains the same from the user perspective, everything under its hood is completely redesigned. This update is the showcase and reference implementation of Bytecoin high-level IWallet interface. Simplewallet operates through proxying INode interface only, so it still requires a running daemon.


Further reading

Bytecoin roadmap (discussion)
INode on Bytecoin wiki
IWallet on Bytecoin wiki
ITransaction on Bytecoin wiki

Bitcointalk Discussion
Bytecoin BCN Developer
User avatar
ullo
 
Posts: 19
Joined: Wed Mar 26, 2014 3:48 pm

Return to Features & code updates discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron