Este mini-guia compreende as ferramentas necessárias para executar contratos com o Mist e desenvolver Dapps utilizando uma rede local privada.
- Instalar Mist
/** | |
* Some cool JavaScript prototypes. | |
* Author: Everton Fraga <everton{shift+2}kindaconnected.com> | |
* | |
*/ | |
/* | |
* Number.times:Array | |
* Param: int n |
pragma solidity ^0.4.5; | |
/* | |
Ether Splitter é um simples contrato que divide o | |
ether enviado entre dois endereços. | |
*/ | |
contract EtherSplitter { | |
// Definição de evento. |
pragma solidity ^0.4.5; | |
/* | |
Cadastrando itens em um struct | |
*/ | |
contract VipClub { | |
// Estrutura de dados Member, que possui os atributos `name` e `email` | |
struct Member { | |
string name; |
{ | |
"address": "84491dabc6366120bca1801b3223cc60b693e999", | |
"crypto": { | |
"cipher": "aes-128-ctr", | |
"ciphertext": "b2499f41a70f9792cf6444e150d256c8ad41ee009b5a54bf6e50c073630f06e4", | |
"cipherparams": { | |
"iv": "690c2b57b2f7389aae8f452ce0b2fc2c" | |
}, | |
"kdf": "scrypt", | |
"kdfparams": { |
pragma solidity ^0.4.5; | |
contract MyToken { | |
/* | |
Variáveis públicas do token. | |
Elas conformam com o padrão de moedas na rede ethereum, este padrão permite integração | |
com as Wallets e interoperabilidade com outros contratos. | |
Standard ERC 20: https://github.com/ethereum/EIPs/issues/20 | |
*/ | |
string public standard = 'Token 0.1'; |
0xAB3a5216307C0eBAdad8D70900aa7dB20dcE1EDe |
// https://etherscan.io/address/0xa4e23286c06208645f52c57a6ef5a510e87a6d76 | |
const Web3 = require('web3'); | |
// const web3 = new Web3(Web3.providers.HttpProvider('https://mainnet.infura.io/bnr6Lt3Xle02EzHa3Bf5 ')); | |
const web3 = new Web3(Web3.providers.HttpProvider('http://localhost:8545 ')); | |
var txs = []; | |
var cb = function(err, hash) { txs.push(hash); console.log(err, 'https://etherscan.io/tx/'+hash) }; | |
var myAccount = '0xa4E23286C06208645f52c57A6eF5a510e87A6d76'; |
[{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] |
/** | |
This code snippet aims to show how to prevent library methods from being executed directly. | |
That's achieved by baking in the address of the library before it's deployed, then comparing `address(this)` against the saved address within a modifier. | |
A contract/library address is deterministic, so one could inject that in: keccak256(creator_address, nonceValue). | |
Thanks to @pirapira, @chriseth and @arachnid for the idea. | |
*/ |