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
pragma solidity ^0.5.0; | |
/* | |
* @dev Provides information about the current execution context, including the | |
* sender of the transaction and its data. While these are generally available | |
* via msg.sender and msg.data, they should not be accessed in such a direct | |
* manner, since when dealing with GSN meta-transactions the account sending and | |
* paying for execution may not be the actual sender (as far as an application | |
* is concerned). | |
* |
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
window.addEventListener("load", function() { | |
if (window.ethereum) { | |
// use MetaMask's provider | |
App.web3 = new Web3(window.ethereum); | |
window.ethereum.enable(); // get permission to access accounts | |
// detect Metamask account change | |
window.ethereum.on('accountsChanged', function (accounts) { | |
console.log('accountsChanges',accounts); |
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
pragma solidity ^0.5.0; | |
// METADATA 是每一個token 都有不同的metadata | |
// import "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol"; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/drafts/Counters.sol"; | |
// ERC721Full | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC721/ERC721.sol"; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC721/ERC721Enumerable.sol"; |
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 { Text } from 'react-native'; | |
import { DrawerNavigator } from 'react-navigation'; | |
const ContentScreen = ({ navigation }) => ( | |
<Text>Content Hello World</Text> | |
); | |
const LeftDrawerScreen = ({ navigation }) => ( | |
<Text>Left Drawer</Text> |
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 fs = require("fs") | |
let BITBOX = require('bitbox-sdk').BITBOX; | |
let bitbox = new BITBOX(); | |
var mnemonic = bitbox.Mnemonic.generate() | |
const NETWORK = `mainnet`; | |
const filetime = new Date().getTime(); | |
console.log("mnemonic",mnemonic); |
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
using System; | |
using System.Text; | |
using Nethereum.Hex.HexConvertors.Extensions; | |
using Nethereum.Signer; | |
using Nethereum.Util; | |
using Nethereum.Signer.Crypto; | |
class ECDSASecp256k1Example | |
{ | |
static void Main() |
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 Web3 from 'web3'; | |
if (window.ethereum) { | |
window.web3 = new Web3(ethereum); | |
try { | |
// Request account access if needed | |
ethereum.enable(); | |
} catch (error) { | |
// User denied account access... | |
} |
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 Web3 = require('web3'); | |
var web3 = new Web3(); | |
var message = "Hello, I am Kenneth!"; | |
console.log("version :", web3.version); | |
var signature = web3.eth.accounts.sign(message, '0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7'); | |
console.log("signature :", signature); |
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 ethUtil = require('ethereumjs-util'); | |
var data = 'Login'; | |
var message = ethUtil.toBuffer(data); | |
var msgHash = ethUtil.hashPersonalMessage(message); | |
var privateKey = new Buffer('62debf78d596673bce224a85a90da5aecf6e781d9aadcaedd4f65586cfe670d2', "hex") | |
var sig = ethUtil.ecsign(msgHash, privateKey); | |
var signature = ethUtil.toBuffer(sig) |
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 sigUtil = require('eth-sig-util'); | |
var messageHashx = new Buffer(delegationHash) | |
const msgParams = { data: messageHashx } | |
const _signature = sigUtil.personalSign(new Buffer(tokenholder.pk, "hex"),msgParams); | |
console.log("_signature", _signature); | |
msgParams.sig = _signature | |
console.log("recovered address ",sigUtil.recoverPersonalSignature(msgParams)); | |
delegatedTransferOperator.methods.recover(delegationHash, _signature).call((error, result) => { |