This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = require('web3'); | |
const web3js = new Web3('https://testnet.tomochain.com'); | |
const Tx = require('ethereumjs-tx').Transaction; | |
count = c; | |
hexamount = web3js.utils.toHex(amount * 1e5); | |
var rawTransaction = {"from":walletFromAdresse, "gasPrice":web3js.utils.toHex(20* 1e9),"gasLimit":web3js.utils.toHex(50000000),"to":token.adresse,"value":"0x0","data":tokenContract.methods.transfer(walletTo.publicAdresse, hexamount).encodeABI(),"nonce":web3js.utils.toHex(count)} | |
var transaction = new Tx(rawTransaction); | |
transaction.sign(walletFromprivateKey); | |
console.log(transaction); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abi = [ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "name", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "string" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = require('web3'); | |
const web3js = new Web3(Web3.givenProvider || 'https://ropsten.infura.io/VOTRE_ACCES_INFURA', null, {}); | |
const Tx = require('ethereumjs-tx'); | |
const express = require('express'); | |
const router = express.Router(); | |
const BigNumber = require('bignumber.js'); | |
var contractABI = CODE_ABI_DE_VOTRE_TOKEN | |
contractAddress = "ADRESSE_DU_CONTRAT_DE_VOTRE_TOKEN"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var userAddress = document.getElementById("address"); | |
userAddress.value = "MonAdresse"; | |
var form = document.querySelector("form"); | |
form.addEventListener("submit", function (e) { | |
const req = new XMLHttpRequest(); | |
const amount = 50; | |
req.open('POST', 'http://localhost:3000/transactions/sendtx', false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Faucet</title> | |
</head> | |
<body> | |
<form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId) | |
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId); | |
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); | |
#Ces événements permettent d’afficher des informations lors de modifications, transfert de token par exemple. | |
function balanceOf(address _owner) external view returns (uint256); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
totalSupply() public view returns (uint256 totalSupply) | |
#Fonction permettant d'obtenir le nombre de tokens existants. | |
balanceOf(address _owner) public view returns (uint256 balance) | |
#Fonction retournant le nombre de tokens qu'une adresse possède. | |
transfer(address _to, uint256 _value) public returns (bool success) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import Button from 'react-bootstrap/Button'; | |
class HelloWorld extends React.Component { | |
state = { sentence: null, newSentence: "", stackId: null }; | |
changeSentence = e => { | |
this.setState({newSentence: e.target.value}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
class HelloWorld extends React.Component { | |
state = { sentence: null }; | |
componentDidMount() { | |
const { drizzle, drizzleState } = this.props; | |
const helloWorld = drizzle.contracts.HelloWorld; | |
const sentence = helloWorld.methods["saySomething"].cacheCall({ from: drizzleState.accounts[0], gas:3000000}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import HelloWorld from "./HelloWorld"; | |
class App extends Component { | |
state = { loading: true, drizzleState: null }; | |
componentDidMount() { | |
const { drizzle } = this.props; |
NewerOlder