Is there any API for send and receive Ethers? If not, i am trying to use web3.js
in my own server;
- What are the technical implications?
- Major security concerns?
- Can I use the same API for creating address for public?
- Are there any trust issues?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityweb3.eth.sendTransaction
is the API for transferring ether, the transactionObject has a value
parameter which you can set: you have to specify the number of wei, and 1 Ether is 10**18 wei.No, you cant do this with web3.js
as of now.
You can use LightWallet by ConsenSys to create an account. Sample code will be
// generate a new BIP32 12-word seed
var secretSeed = lightwallet.keystore.generateRandomSeed();
// the seed is stored encrypted by a user-defined password
var password = prompt('Enter password for encryption', 'password');
lightwallet.keystore.deriveKeyFromPassword(password, function (err, pwDerivedKey) {
var ks = new lightwallet.keystore(secretSeed, pwDerivedKey);
// generate five new address/private key pairs
// the corresponding private keys are also encrypted
ks.generateNewAddress(pwDerivedKey, 5);
var addr = ks.getAddresses();
// Create a custom passwordProvider to prompt the user to enter their
// password whenever the hooked web3 provider issues a sendTransaction
// call.
ks.passwordProvider = function (callback) {
var pw = prompt("Please enter password", "Password");
callback(null, pw);
};
// Now set ks as transaction_signer in the hooked web3 provider
// and you can start using web3 using the keys/addresses in ks!
});
Is there any API's for sending ethereum tokens(like: EOS, TRON, OmiseGO etc...) from one address to another
If you wish to accomplish this in web3.js, you will simply need to obtain the contract address of the ERC20 token, as well as the ABI of that contract. Using those two details, we can create an instance of the token contract in our dApp by using:
//we need to obtain the eos token contract abi and address
const eosToken = new web3.eth.Contract(eosABI, eosAddress)
Once we do this, we can use ERC20 functions transfer()
and transferFrom()
to send tokens to another address.