#StackBounty: #web3js #nodejs Is it possible to create a web3 daemon?

Bounty: 50

I am using nodejs to call my smart contract’s functions instead of calling within geth-client. Each time, when I run node call.js, it requires additional time Web3 to connect into local ethereum network. When I make many calls, it consumes a lot of time. Also this daemon may help on during development and testing my contract’s function calls.

Example code: call.js (using Web3js)

var mylib = require(contract.js);

Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

if(!web3.isConnected()){
    console.log("not connected");
    process.exit();
}
var myContractInstance  = web3.eth.contract(mylib.abi).at(mylib.address);
val="input";
myContractInstance.functionCall(val, {from: web3.eth.defaultAccount,gas: 300000 });

Alternative example code: call.py (using Web3py)

#!/usr/bin/env python

from __future__ import print_function
from web3 import Web3
import json
from web3.providers.rpc import HTTPProvider

web3 = Web3(HTTPProvider('http://localhost:8545'))

contractAddress='0x...';
with open('abi.json', 'r') as abi_definition:
    abi = json.load(abi_definition)
myContractInstance = web3.eth.contract(contractAddress, abi=abi);

eBlocBroker.transact().functionCall();

[Q] In order to gain some time (get rid of over and over Web3 connection); it is possible to run a Web3js daemon or Web3py daemon on the background that connects into ethereum network only one time and later, I can use that daemon to make my smart-contract calls or talk with the ethereum network?
If yes, how?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.