GithubHelp home page GithubHelp logo

available-xlm's Introduction

available-xlm

This repository is intended to test and understand the Minimum Balance needed for an account to be able to perform transactions in the Stellar Network, specifically when setting trustlines and making payments.

For more information on this see the Stellar Docs: https://developers.stellar.org/docs/learn/fundamentals/lumens#minimum-balance

How to use this repository

This repository contains a series of independant scripts that set up a certain situation in the Stellar Network and then perform a transaction. The scripts are written in Javascript and use the stellar-sdk library to interact with the network.

Before beginning, you will need to run the docker container:

bash docker/run.sh

And then intall the dependencies:

yarn install

The scripts and their respective conclusions are the following:

1. transferAllXlm.js:

yarn transferAll

Description: Fund account with 10000 XLM and attempt to transfer all to another account.
Result: Transaction fails and only 0.00001 XLM is used (as base fee).

2. transferMaxAmount.js:

yarn transferAllMinus2

Description: Here we try to find the max amount that can be transfered. First we try to transfer the total balance, minus 1.00001 XLM (1 as base reserve + 0.00001 as transaction fee). Then we attempt to do it again, with just 0.000001 XLM more.
Result: First ransaction succeeds and second fails. This shows that there is a minimum of 1 XLM + transaction fee that needs to be kept in the account in order to be able to transfer.

3. setTrustlines.js:

yarn setTrustlines

Description: Sender issues a new asset, then sets a trustline for the receiver, and finally attempts to send the maximum amount of XLM to the receiver.
Result: Transaction works when a base reserve (1 XLM), plus the trustline reserve (0.5 XLM), plus the transaction fee (0.00001 XLM in this case) is kept blocked in the sender's account. This shows that for a transaction to work, there must be an aditional 1 XLM + 0.5 XLM for each trustline + the respective amount of transaction fee in the sender's account.

available-xlm's People

Contributors

benjaguiloff avatar

Stargazers

TB avatar

Watchers

Esteban Iglesias avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.