git clone https://github.com/creativechain/trantor-lib-nodejs.git
cd trantor-lib-nodejs
npm install
Maybe npm install
will fail installing sqlite3,
if so check this issue to see if it fixes your error
You need to have creativechain core running to use this library. You can download the binaries for your platform from here
You need to create a creativecoin.conf in creativecoins core datadir, and add:
rpcuser=creativecoin
rpcpassword=creativecoin
Then run the core with the datadir specified.
-
node ./lib/trantor-lib.js <command> [args]
-
Commands
explore
: explore creativechain blockchain and indexes transactions and content.- Quite slow
getData <txid>
#works: returns data from transactiongetTx <txid>
#works: returns transaction informationlistUnspent <address>
#works: returns list of unspent transactions for specified addressnewWallet
#works: creates a new address with private keygetWallets
#works: return all wallets savedsend <target_address> <amount> <fee>
: creates and sends amount to target_addresssaveData <amount> <fee> '<json_string>'
: saves json data in blockchain
- Require trantor into your project.
const trantor = require('./trantor-lib-nodejs/lib/trantor-lib');
- Methods
trantor.newWallet(cback)
#works: creates a new address with private key- cback(newWallet) newWallet = { wif: "wif", address: "address" }
trantor.getWallets(cback)
#works: returns all wallets saved- cback(addresses) addresses = [ { wif: "wif", address: "address" }, ... ]
trantor.explore(cback)
#works: explore creativechain blockchain and indexes transactions and content.- cback() will be called when explore finishes
- Quite slow
trantor.listUnspent(addr, cback)
#works: returns list of unspent transactions for specified addresstrantor.findWord(word, page, cback)
: returns references for transactions containing a wordtrantor.smartdeal(datos)
: not testedtrantor.creadeal(data, datos, cback)
: not testedtrantor.findaddr(addr)
: #not tested - finds entries for address in dbtrantor.getcontracts(type, ref, cback)
: gets contracts for type and reference
trantor.pushTx(rawtx, cback)
#works: pushes rawtx to creativechain blockchaintrantor.decodeRawTransaction(rawtx, cback)
: returns decoded transaction from raw transactiontrantor.getDecodedTransaction(txid, cback)
: returns return transaction informationtrantor.send(addr, amount, fee, cback)
: creates a raw transaction and sends itaddr
string: the address to send toamount
number: the amount to sendfee
number: the fee of the txcback
function: called when tx has been sent, and its called with the transaction id
trantor.saveData(amount, fee, data, cback)
: creates a raw transaction and sends itamount
number: the amount to sendfee
number: the fee of the txdata
json string: the data to save in blockchaincback
function: called when tx has been sent, and its called with the new transaction id
trantor.getData(txid, cback)
#works: returns data from transaction
Vicent Nos Ripolles, Manolo Edge