CryptoCoinsInfoClub.com

Ethereumjs-wallet Example

The Future Of Dapps Programming With Lightwallet & Infura

The Future Of Dapps Programming With Lightwallet & Infura

I finally find some time to write an article that, I hope, will help a lot of you guys creating great DApps. So this is a new trend that I personally find pretty cool. The idea is to do 100% of the identity / transaction management in the browser and sending the signed transactions directly. Although in theory this approach is pretty awesome, it is still very cutting edge and the tools are not mature yet to work with them without any issues. This is my experience with doing this. I'm not pretending my approach is the best and actually I would love to hear your feedback. How can I improve that? eth-lightwallet: This is the library I have used to generate the accounts. Right now it was used to generate accounts by using a user generated seed but hopefully in the future it will be able to use other means. ethereumjs-tx: This library is needed to stringify the transaction so you can sign it. hooked-web3-provider: This library is used to add code so you can sign the transactions locally instead of the Ethereum node web3-provider-engine: This is also needed to tweak web3js so that most of the handling is done locally. const Transaction = require('ethereumjs-tx');const ProviderEngine = require("web3-provider-engine");const Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");const Web3 = require("web3");const CacheSubprovider = require('web3-provider-engine/subproviders/cache.js');const FixtureSubprovider = require('web3-provider-engine/subproviders/fixture.js');const FilterSubprovider = require('web3-provider-engine/subproviders/filters.js');const VmSubprovider = require('web3-provider-engine/subproviders/vm.js');const HookedWeb3Provider = require("hooked-web3-provider");const NonceSubprovider = require('web3-provider-engine/subproviders/nonce-tracker.js'); Continue reading >>

Web3.eth.accounts Web3.js 1.0.0 Documentation

Web3.eth.accounts Web3.js 1.0.0 Documentation

tx - Object: The transaction object as follows: nonce - String: (optional) The nonce to use when signing this transaction. Default will use web3.eth.getTransactionCount() . chainId - String: (optional) The chain id to use when signing this transaction. Default will use web3.eth.net.getId() . to - String: (optional) The recevier of the transaction, can be empty when deploying a contract. data - String: (optional) The call data of the transaction, can be empty for simple value transfers. value - String: (optional) The value of the transaction in wei. gas - String: The gas provided by the transaction. gasPrice - String: (optional) The gas price set by this transaction, if empty, it will use web3.eth.gasPrice() privateKey - String: The private key to sign with. callback - Function: (optional) Optional callback, returns an error object as first parameter and the result as second. Promise|Object returning Object: The signed data RLP encoded transaction, or if returnSignature is true the signature values as follows: messageHash - String: The hash of the given message. r - String: First 32 bytes of the signature s - String: Next 32 bytes of the signature rawTransaction - String: The RLP encoded transaction, ready to be send using web3.eth.sendSignedTransaction . Continue reading >>

Bringing The Blockchain To Reactnative

Bringing The Blockchain To Reactnative

developer, musician, hiker, biker and playing futbol for fun. TLDR: Despite the fact of the non existence of an Ethereum Wallet or Browser for React Native to interact with cross platform decentralized mobile apps, its possible bring the blockchain to React Native. Bringing blockchain to cross platform apps by React Native. Credits topixabay. According to the dApps white paper basically a dApp has its backend code running on a decentralized peer-to-peer network. Contrast this with an app in which the backend code is running on centralized servers. The transparent immutable and decentralized nature of the blockchain enables the development of many awesome use cases such as for autonomous organization, sales, social networks, insurance companies and gaming among hundreds of others. This is an example of a proof-of-existence application of blockchains In this blog post I will explain how I made a mobile cross platform dApp aimed at ranking your favorites cryptopunks using React Native. wait why cryptopunks? cryptopunks is an awesome project that works just like a metaphore, for more info look into the following blog post in reddit . Before we get to code, it is important to understand how to break this down. React Native is a framework developed by Facebook that allows you to build native cross platform mobile apps using JavaScript and React. Expo is a set of tools that makes it significantly easier to get started with React Native projects, since it includes a set of native APIs to be used right out of the box, like camera, etc. Web3 is the Ethereum compatible JavaScript API which implements the Generic JSON RPC spec built for node.js and the browser. Truffle is a development environment for Ethereum, that provides a set of tools like ganache-core that simulates an Ether Continue reading >>

Github - Ethereumjs/ethereumjs-wallet: Utilities For Handling Ethereum Keys

Github - Ethereumjs/ethereumjs-wallet: Utilities For Handling Ethereum Keys

A lightweight wallet implementation. At the moment it supports key creation and conversion between various formats. It is complemented by the following packages: ethereumjs-icap to manipulate ICAP addresses use a single, maintained version of crypto library (and that should be in line with ethereumjs-util and ethereumjs-tx) support import/export between various wallet formats managing storage (neither in node.js or the browser) generate([icap]) - create an instance based on a new random key (setting icap to true will generate an address suitable for the ICAP Direct mode) generateVanityAddress(pattern) - create an instance where the address is valid against the supplied pattern (this will be very slow) fromPrivateKey(input) - create an instance based on a raw private key fromExtendedPrivateKey(input) - create an instance based on a BIP32 extended private key (xprv) fromPublicKey(input, [nonStrict]) - create an instance based on a public key (certain methods will not be available) fromExtendedPublicKey(input) - create an instance based on a BIP32 extended public key (xpub) fromV1(input, password) - import a wallet (Version 1 of the Ethereum wallet format) fromV3(input, password, [nonStrict]) - import a wallet (Version 3 of the Ethereum wallet format). Set nonStrict true to accept files with mixed-caps. fromEthSale(input, password) - import an Ethereum Pre Sale wallet For the V1, V3 and EthSale formats the input is a JSON serialized string. All these formats require a password. Note: fromPublicKey() only accepts uncompressed Ethereum-style public keys, unless the nonStrict flag is set to true. getChecksumAddressString() - return the address with checksum getV3Filename([timestamp]) - return the suggested filename for V3 keystores toV3(password, [options]) - return the wall Continue reading >>

How To Deploy An Erc20 Token In 20 Minutes

How To Deploy An Erc20 Token In 20 Minutes

How to deploy an ERC20 token in 20 minutes Ethereum tokens are all the rage these days. These tokens can represent units ofvalue in the real world: Gold , Whoppers , Kittens and even something similar to sharesof acompany .People have raised over $2 billion in token sales thus far. These tokens havebeen standardized in the ERC20 standard so they can be easily traded between wallets. In thistutorial Im going to walk you through deploying your own ERC20 token to thelive Ethereum network. A basic text editor. ( Atom is good. I like Vim ) A basic understanding of the command line and a terminal emulator. The builtin mac app Terminal should be fine. I like iTerm2 A name for your token. Mine is going to be called HamburgerCoin The first thing youll need to do is install MetaMask .Go to the Metamask website and click on Get Chrome Extention. Metamask will allow you to make transactions on Ethereum through Chrome. Theyrely on Infura who run public Ethereum nodes so you donthave to. If youre feeling adventurous you could download and install Mist instead. When you run Mistyoure running your own Ethereum node. If you run your own node youll have tosync the network to your computer which can take a while. Thatstechnically safer because you dont have to trust Infura with yourtransactions. Infura could censor your transactions by just ignoring them but they wouldnt be ableto steal your money. Since installing Metamask is quicker and simpler thanrunning Mist Im going to assume were using Metamask for the rest of thetutorial. Now create a new directory for your new coin, CD into it and initialize yourtruffle project. $ mkdir hamburger-coin$ cd hamburger-coin$ truffle init Congrats your truffle project is now set up! Now lets create our coin. First well need to install the OpenZepplin Continue reading >>

Different Addresses For Same Mnemonic? Metamask Vs Ethereumjs-wallet : Ethdev

Different Addresses For Same Mnemonic? Metamask Vs Ethereumjs-wallet : Ethdev

is it normal that only the first ethereum address matches when recovering addresses using the same mnemonic phrase on Metamask and ethereumjs-wallet? var bip39 = require("bip39");var hdkey = require('ethereumjs-wallet/hdkey');var ProviderEngine = require("web3-provider-engine");var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js'); var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");var Web3 = require("web3");// Get our mnemonic and create an hdwalletvar mnemonic = [deleted]var hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic));// Get the first account using the standard hd path.var wallet_hdpath = "m/44'/60'/0'/0/";var wallet = hdwallet.derivePath(wallet_hdpath + "0").getWallet();console.log(hdwallet.derivePath(wallet_hdpath + "0").getWallet().getAddress().toString("hex"))console.log(hdwallet.derivePath(wallet_hdpath + "1").getWallet().getAddress().toString("hex"))console.log(hdwallet.derivePath(wallet_hdpath + "2").getWallet().getAddress().toString("hex"))console.log(hdwallet.derivePath(wallet_hdpath + "3").getWallet().getAddress().toString("hex"))console.log(hdwallet.derivePath(wallet_hdpath + "4").getWallet().getAddress().toString("hex"))console.log(hdwallet.derivePath(wallet_hdpath + "5").getWallet().getAddress().toString("hex")) Continue reading >>

How To Send Ethereum Transactions With Java

How To Send Ethereum Transactions With Java

After Ive expressed my concerns about the blockchain technology , lets get a bit more practical with the blockchain. In particular, with Ethereum. I needed to send a transaction with Java, so I looked at EthereumJ . You have three options: Full node you enable syncing, which means the whole blockchain gets downloaded. It takes a lot of time, so I abandoned that approach Light node you disable syncing, so you just become part of the network, but dont fetch any parts of the chain. Not entirely sure, but I think this corresponds to the light mode of geth (the ethereum CLI). You are able to send messages (e.g. transaction messages) to other peers to process and store on the blockchain, but you yourself do not have the blockchain. Offline (no node) just create and sign the transaction, compute its raw representation (in the ethereum RLP format) and push it to the blockchain via a centralized API, e.g. the etherscan.io API . Etherscan is itself a node on the network and it can perform all of the operations (so it serves as a proxy) Before going further, maybe its worth pointing out a few general properties of the blockchain (the ethereum one and popular cryptocurrencies at least) it is a distributed database, relying on a peer-to-peer (overlay) network, formed by whoever has a client software running (wallet or otherwise). Transactions are in the form of I (private key owner) want to send this amount to that address. Transactions can have additional data stored inside them, e.g. representing what they are about. Transactions then get verified by peers (currently using a Proof-of-work based consensus) and get stored on the blockchain, which means every connected peer gets the newly created blocks (each block consisting of multiple transactions). Thats the blockchain in short, Continue reading >>

Wallet Management In Decentralized Apps

Wallet Management In Decentralized Apps

Making it easy for clients to get started sending transactions At UbiTok.io, the unstoppable Ethereum exchange, we want to make it as easy as possible for clients to start trading (without compromising on security). Being totally decentralized, UbiTok.io doesnt have any sign-up or verification, so ideally new clients should be able to turn up, deposit and buy in minutes. Instead of sign-up, the most important part for a decentralized app (DApp) like UbiTok.io is how clients can safely let the DApp send Ethereum transactions from their Ethereum address, in our case to buy and sell tokens on the exchange. In an ideal world, everyone would use a nice browser extension like MetaMask, and DApps could just rely on that, but in practice theres at least five different ways clients want to send transactions: Manual Transactions (user copy-and-pastes details into e.g. MEW) Dapp Browser / Local Client (Mist, Parity, Geth) Imported Private Key / Keystore JSON / Mnemonic Right now (Nov 2017) UbiTok.io supports the first three - but wed really like to offer clients the choice of improved security from hardware wallets and the more integrated experience possible with an imported private key. It would be great if there was some sort of magical Javascript library that DApp authors could drop in to provide functionality like: And of course, for MetaMask clients the magical library would let MetaMask handle most of the above, and for Hardware Wallet clients it would talk to the hardware, and for private key clients it would provide its own User Interface for transactions and key management. Naturally, the User Interface would be reskinnable to match the style of the Dapp using it, and all text displayed to clients would be internationalized with high quality translations into many langua Continue reading >>

How To Send Ethereum With Web3.js And Node

How To Send Ethereum With Web3.js And Node

How to Send Ethereum with Web3.js and Node How to Send Ethereum with Web3.js and Node Ethereum took the web and cryptocurrency world by storm in 2017. In the span of one year, the price of 1 Ether skyrocketed from $8.24 USD to $750.00 USD and for good reason. If you need convincing on the nature of decentralization, just watch this video featuring Ethereum founder Vitalik Buterin and AngelList CEO Naval Ravikant and come back in 30 minutes. However, if youve found this article, Im guessing youre already a believer and want to learn more about interacting with the Ethereum main network. In my case, I wanted to find a way to programmatically send amounts of Ether between different addresses based on external factors (think IFTTT for sending cryptocurrency.) Whatever your reasoning, in this article, were going to go over how to use Node.js and the quickly-evolving Web3.js library to submit ETH transactions to the Ethereum network. Well start off with test transactions first to learn the basics and make sure everything is working as expected. Then, once youre comfortable, we can flip the switch and move real ETH around the Ethereum mainnet. Theres a lot to learn here, especially if youre new to this space like I am, so Ill try to break down the terms to the best of my understanding. Lets get started! Were going to get started using some test Ether rather than actual money while were learning about this whole process, so the first thing well need to do is create a new Ethereum wallet address that will be able to hold our test funds. To do this, first visit Next, open up the dropdown at the top right corner and change the Network selection to Rinkeby infura.io. This change will make sure that the new wallet address that we are creating is going to exist on the Ethereum test Continue reading >>

Ethereumjs By Ethereumjs

Ethereumjs By Ethereumjs

browser-builds : browser builds of ethereumjs libraries common : the genesis data for the blockchain ethereumjs-abi : ABI encoding and decoding ethereumjs-account : account schema encoding, decoding and validation ethereumjs-block : block schema encoding, decoding and validation ethereumjs-blockchain : manage a blockchain ethereumjs-codesim : run EVM or Solidity code and examine the output ethereumjs-icap : utilities for handling ICAP (Ethereum in IBAN) encoding ethereumjs-lib : meta package for loading the other ethereumjs- modules ethereumjs-testing : transforms the official test vectors to a format suitable for ethereumjs ethereumjs-tx : transaction creation, manipulation, signing and verification ethereumjs-units : Ethereum unit conversion ethereumjs-util : a collection of frequently used methods by the other libraries ethereumjs-wallet : lightweight toolkit for managing Ethereum keys, including HD wallet support ethereumjs-vm : a complete EVM (Ethereum Virtual Machine) and state processing implementation geth.js : start and stop geth from Node.js helpeth : purists' commandline tool for key and transaction management keythereum : create, import and export Ethereum keys merkle-patricia-tree : This is an implementation of the modified merkle patricia tree as specified in the Ethereum yellow paper node-blockchain-server : aims to provide a full Ethereum node implementation node-devp2p : implementation of the RLPx transport protocol for Ethereum (used between nodes) node-devp2p-dpt : implementation of the RLPx DPT (peer table) protocol for Ethereum node-devp2p-eth : implementation of the Ethereum sub-protocol over RLPx node-devp2p-manager : peer manager for DPT & RLPx Continue reading >>

Integrating Ledger Nanos Into Your Dapp Using Neufunds Js Wallet-provider

Integrating Ledger Nanos Into Your Dapp Using Neufunds Js Wallet-provider

Integrating Ledger Nanos into your DApp using Neufunds JS wallet-provider One way to store funds and crypto assets is using hardware wallets . These wallets usually work by storing all private keys, encrypted in the hardware, which gives an extra layer of protection and encapsulation. For example, the Ledge Nano encrypts and stores all assets offline it is only connected to the network when a transaction needs to be signed or authorized. Due to its design, there is no way of authorizing access or signing transactions without physically pressing a button on the Nano S . Neufund is working on incorporating and integrating Nano S into its platform in the future as a way to handle transactions and assets. It is already used in our ESOP program to provide stock options to our current employees. One of the challenges with integrating Ledger Nanos to DApps is connecting them with an RPC provider that conducts on-chain transactions. This requires developing a mediator library ( Ledger-Wallet-Provider ) that communicates between the Ledger Nano library and an RPC provider that handles communication with the blockchain. For the current tutorial, MetaMask-Provider-Engine is chosen as an RPC provider due to its ability to add custom providers and the design choice of running a client side node that can handle RPC requests locally, which reduces the load on the main node. This post will walk you through the process of how to integrate the Nano-Ledger into your own DApp using Neufunds Ledger-Wallet-Provider . The Ledger Nano is a hierarchical deterministic wallet, which means it has one secret (seed) stored in the Nano that generates a high number of keys as derivatives from the seed. Each key can store value and be considered a separate wallet. In order to access a specific derivat Continue reading >>

Node.js Smart Contract Integration With Truffle-contract And Infura.io

Node.js Smart Contract Integration With Truffle-contract And Infura.io

While running your own Ethereum node with geth by using web3js from node.js (backend) app is a common solution, connecting to a public Ethereum node such as infura.io and using [truffle-contract](gives some benefits: No need to maintain your own Ethereum node (syncing a full node requires huge storage space! (around 40 GB for Ropsten)) Seamlessly integrate your node.js (backend) development workflow with Truffle Framework smart contract development Simpler smart contract API with truffle-contract npm i --save [emailprotected] [emailprotected] asyncawait truffle-contract ethereumjs-wallet asyncawait module provides async / await capabilities to make code much shorter. If you use node.js version with built-in async / await you can ignore this and just remove parentheses after each async / await in the code sample below. Then, in a node.js file, include these dependencies: const async = require('asyncawait/async');const await = require('asyncawait/await');const path = require('path'); const fs = require('fs'); const TruffleContract = require('truffle-contract'); const Web3 = require('web3'); const ethereumjsWallet = require('ethereumjs-wallet'); const ProviderEngine = require('web3-provider-engine'); const WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js'); const Web3Subprovider = require('web3-provider-engine/subproviders/web3.js'); const FilterSubprovider = require('web3-provider-engine/subproviders/filters.js'); const RPC_SERVER = 'const TOKEN_SALE_CONTRACT = path.resolve(__dirname, '..', '..', 'contracts', 'TokenSale.json'); const privateKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; RPC_SERVER contains path to infura.io node (in this case, I choose to connect to Ropsten for testing) and your API token (currently you can obtained for free Continue reading >>

An Introduction To Ethereum Testnets

An Introduction To Ethereum Testnets

Loving Ethereum, Casper, Cryptoeconomics, blockchain, open source, and of course Meditation Understanding how to use testnets is essential for developing smart contracts on Ethereum . Here is a basic introduction to what testnets are and how to use them. Testnets simulate the Ethereum network and EVM . They allow developers to upload and interact with smart contracts without paying the cost of gas. Smart contracts must pay gas for their computations on the Ethereum network. If you rent the Ethereum network to run a contract, you have to pay. However, testnets provide free or unlimited gas. That allows developers to test contracts without having to pay real money for their execution. lightweight Ethereum nodes used for small scale local testnets. Ex: ethereumjs-testrpc - Useful for early stage contract development. This is what you will be using most of the time. Calls to lightweight testnet nodes complete very quickly and provide good error messages. heavyweight Ethereum nodes used for large scale networked testnets. Ex: Geth - Useful for connecting to public networked testnets. The most popular public testnet is called Ropsten which is useful during later stage contract development. Ropsten is essentially the Ethereum network with free ETH and poor secrutiy. Connecting to Ropsten through Geth simulates the real Ethereum network. That makes it appealing for mature contracts that you want to battle test. You can also run your own private testnet cluster with Geth, instead of connecting to the public network Ropsten. Ethereumjs-testrpc is extremely easy to use. To install testrpc just run: and then to start your local Ethereum node run: Available Accounts ==================(0) 0x72cf3d2a2d1bafee28d30a6bd72a6d30b325a7f1(1) 0x5d236d1e2bb5504c935ac69ed58a36947bb76268(2...)P Continue reading >>

Open Sourcing Blooms Phase 1 Contracts

Open Sourcing Blooms Phase 1 Contracts

At the conclusion of our token sale tomorrow, were releasing the Phase 1 main net dApp for Bloom. In celebration of this event, weve published our Phase 1 contracts on GitHub today! Bloom is a community first project. Were thrilled to open source our contracts for public review and discussion. This marks a big milestone on our long term roadmap and were incredibly excited to continue to make progress on defining the future of credit. This post is a technical overview, we have an article on how you can use your BLT tokens which is a non-technical read if youre looking to get started with the token. Weve put together a description of the most important contracts in this post to help guide you through the code and to give you a lower-level overview on interacting with these contracts without a UI in case youre interested in joining Bloom development or experimenting with the system. When the account system is initially launched, only the creator of the contract has an account. An owner of BLT (Alice) can visit Blooms dApp in order to create an account. If Alice successfully requests an account via the dApp, a special invite admin account we own will create an account for her via our AccountRegistry#createAccount function. The user provides the ETH address they would like to associate with their account along with a signature proving they own the address: const signature = web3.personal.sign(web3.toHex("Hello, Bloom!"), address); fetch("{ body: JSON.stringify({ address, signature }) If everything checks out on the backend, the function is called on the contract from the admin account: accountRegistry.createAccount(address, { from: inviteAdmin }); If Alice wants to invite another user (Bob) who doesnt own BLT, she can use the invite system. During the early stages of the pr Continue reading >>

Ethereum/ethereumjs

Ethereum/ethereumjs

the issue above was due to the BYTE issue that has been merged. is there a release planned soon? if not well I don't have so much overview of changes in ethereumjs-vm but is it stable enough to link the github repo direclty? @yann300 I'll try to make a release today or tomorrow. Proposal for deprecating the ethereumjs/common library Hi everyone @/all, I had a closer look at the common library today cause I wanted to add some network specific genesis and fork (block) data for the planned client implementation. The library doesn't really fit todays needs any more cause it's very historically/organically grown. Params are added in a very mixed-up and unstructured way, there are some random fork-specifc constants (homeSteadForkNumber), ... On a second thought I came to the conclusion that the cleanest and easiest way here really would be to just start a fresh ethereumjs-common library and directly start with a more structured version better taking into account the various needs grown over the years. We could have this in an IN DEVELOPMENT state for some time and just use it for the client repository, and deprecate the old library for a timeframe of a year or so. Then people could keep the old version for some time as long as it fit their needs and doesn't risk to break anything and once they are ready can switch over. This would also solve the ethereumjs/common#12 issue along the way. If there is support for this then I will try to prepare and upload something from where we can further work this out. There is of course also the possibility to just make a major break-everything release. I would prefer the solution from above though. On a third thought :smile: an hour later: I think this "new library" solution would also be charming cause then we would really have some free Continue reading >>

More in bitcoin