Post
Topic
Board Announcements (Altcoins)
Re: [ANN] SOIL - Environmentally Conscious, Community Driven, Provable Transparency
by
altsheets
on 05/01/2016, 16:33:55 UTC

############ update ##########################

This project now lives on github: https://github.com/altsheets/ethjsre

###########################################



########### kept only for historical reasons: ############

############## OLD VERSION ! ###################


JSRE commands "altsheets.js" v02 (12/Feb/2016)

to make my life easier on the commandline (extension to the linux install post, but works on all systems)

Preparations (once):
1) read the following JS code, so that you can trust it
2) save it into "altsheets.js" (*)


(*) into the folder where you usually are when you type "gsoil attach"



Each time you want to use it:

1) gsoil attach
2) loadScript("altsheets.js")
3) help()


This is version v02, save it to "altsheets.js"

Code:

// soil currency JSRE scripts
// for easier use of commandline.
//
// version v02 (c) 2016 AltSheets Dev
//
// gsoil attach
// loadScript("altsheets.js")
// help()

var version="v02",
currency='soil',
fee=0.00105,
altsheets="0x8da4fc05ca343e6a41646194e91931d9f413a40c";


function showAllBalances() {
// goes through all eth.accounts,
// and prints and sums balances
var total=0;
eth.accounts.forEach(function(id){
balance=web3.fromWei(eth.getBalance(id),currency);
console.log(id, balance, currency);
total+=parseFloat(balance);
});
return total
};

var bal=showAllBalances;  // shortcut for the above

function send(addrFrom, addrTo, amount) {
// sends currency from to, already subtracting fee
var result = eth.sendTransaction({
from: addrFrom,
to: addrTo,
value: web3.toWei( amount - fee, currency)
});
return result;
};

function help() {
// shows useful commands

console.log("--- useful built in commands ---");
console.log("eth.accounts");
console.log("admin.nodeInfo");
console.log("net.peerCount");
console.log("admin.peers");
console.log("eth.blockNumber");
console.log("eth.pendingTransactions");
console.log("exit");
console.log("--- extended by my scripts ---");
console.log("showAllBalances()");
console.log("bal()");
console.log("send(addrFrom,addrTo,"+currency+"AmountInclFee)");
console.log("--- version "+version+" --- for new versions of this see "+currency+" thread ---");
return "please reward altsheets: " + altsheets;
}




TL;DR:

I now only have to type     bal()

and I see all the balances on all my addresses, incl. the sum of them all.

 Wink


EDIT: retweet

If you like this, show it:  
[SOIL] 0x8da4fc05ca343e6a41646194e91931d9f413a40c
BTC 1M4EaZVprZEmtrS3G78fMFy8yGVgdUJMXv  Thanks.