Skip to content

marcosmmb/Raiek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raiek

Raiek is an open source Nano wallet API, designed to be fast and feeless.


How does a wallet works?

There are few things that aren't that clear when you try to create your own wallet software. The most confusing is how a wallet is designed.

First of all, we need to establish 6 main structures that are important to understand the real design of a wallet:

  1. WALLET
  2. SEED
  3. ACCOUNT NUMBER
  4. PRIVATE KEY
  5. PUBLIC KEY
  6. ACCOUNT SET

Structure

The WALLET is a local storage of what I like to call ACCOUNT SET, an ACCOUNT SET contains the ACCOUNT NUMBER, the PRIVATE KEY and the PUBLIC KEY. Each account set is unique, it means that an ACCOUNT NUMBER is always together with its PRIVATE KEY and its PUBLIC KEY, and those can never be with another ACCOUNT NUMBER. This is guaranteed by a deterministic algorithm.

The SEED generates deterministically a huge amount of ACCOUNT SETS, the SEED will always generate the same array of ACCOUNT SETS, it just depends on the index.

For instance, when you generate an ACCOUNT SET using your SEED with index 0, this will generate the ACCOUNT SET "x". When you generate a new one with the index 1, the ACCOUNT SET "y" is generated. If you generate again using index 0, the ACCOUNT SET "x" will reappear. So the SEED can be thought as a big list of ACCOUNT SETS.

Since the WALLET is a local storage of ACCOUNT SETS, when you generate a new ACCOUNT SET using your SEED, you must add this ACCOUNT SET to your local WALLET. Note that you can add more than one ACCOUNT SET into a single WALLET, even if those are from different SEEDS.

The ACCOUNT NUMBER is that "xrb_" address that we usually use to receive or transfer coins from a person to another, or between wallets. The ACCOUNT NUMBER pretty much makes the PUBLIC KEY sort of useless, so we don't need to worry about it.

Finally, the PRIVATE KEY is, just like in Bitcoin system, used to sign transactions. Also, when we have to add an ACCOUNT SET into a WALLET, we don't need to insert every piece of the ACCOUNT SET, we just need to insert the PRIVATE KEY.


Setting up:

First of all, you must clone the project in your computer or server:

$ git clone https://github.com/marcosmmb/Raiek.git
$ cd Raiek

In order to use the API functions you must setup some configurations. Edit the /RaiekProject/config.ini file:

[rai_node]
uri = http://127.0.0.1:7076

The "uri" field is the default IP that you should change if you want to run it in a separated node or to connect to a third party node (the port 7076 is default for rai_node).

If you don't have a node yet, you can check how to setup your own node here and launch it as a service here.

To run the service locally, you must run the following command inside the main folder:

$ cd RaiekProject && python3 api.py

Python:

The API is made using python 3 and flask, so you must have both installed on your computer or in your web service server. Also, you have to install some python packages to run the code. The easiest way to do that is via pip commands.

These are the packages that you need to install before running the application:

$ python3 -m pip install update
$ python3 -m pip install requests configparser flask flask_restful flask_jsonpify pyblake2

API:

These are the endpoints and the keys that you must use in your POST request form:

Note: the http://127.0.0.1:5000/ default url may be changed depending on where your node is running (this is default for a local node).

Used for generate a new seed, this is the only function that doesn't connect to the blockchain. Instead, it uses an algorithm to generate a 64 characters hexa string.


Just like the /get_new_seed endpoint, this one generates a new wallet number to locally store account sets. This one connects to the blockchain though.


Returns the total counted and unchecked blocks on node.


Returns node versions.


Using the seed and the index, it generates the account set and then stores it in the local wallet.


Similar to above, usually used to create a new account for a existing user, since it doesn't returns the seed nor the wallet number.


Locally stores an account set into a wallet.


Usually used to receive every pending block. You must want to create a routine to use this one.


Sets a send block.


Get the current representative of a wallet. Note that the representative is set per wallet, not per account. It means that the blockchain will count only the last defined representative of an account (through its wallet).


Sets a new representative to the wallet, every account in it will be affected.


Checks an account balance. Doesn't need any permission.


Gets the balances of every wallet accounts.


Translates Mrai from raw.


Translates Mrai to raw.


Translates Krai from raw.


Translates Krai to raw.


Translates Rai from raw.


Translates Rai to raw.


Sets a send block with precomputed PoW.


Returns the account history.


Returns the account information.


Returns the value of the work for the hash.


Returns the value of the work for the hash using multiples threads.


Validates the work for the hash


Returns a list of online representatives


If you want to donate, please send any amount of XRB to this account: xrb_39pushkegc4951a4gynaoq786epnf4spwcb66tq5fcopzou8fexp3zixjtun

About

A Nano open source fast and feeless wallet API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages