Skip to content

Instantly share code, notes, and snippets.

View nakajo2011's full-sized avatar

Yukishige Nakajo nakajo2011

View GitHub Profile
@nakajo2011
nakajo2011 / web3.eth.filter.watch_sources.js
Last active February 26, 2018 14:05
web3.eth.filter.watch該当ソースコード
// see https://github.com/ethereum/web3.js/blob/develop/lib/web3/filter.js#L191-L200
Filter.prototype.watch = function (callback) {
this.callbacks.push(callback);
if(this.filterId) {
getLogsAtStart(this, callback);
pollFilter(this);
}
return this;

Keybase proof

I hereby claim:

  • I am nakajo2011 on github.
  • I am y_nakajo (https://keybase.io/y_nakajo) on keybase.
  • I have a public key ASDVHdcqYNHUJmuB-C_nfytsir7fRHTPyn5zrtAJkjKwIgo

To claim this, I am signing this object:

@nakajo2011
nakajo2011 / index.html
Last active May 11, 2018 17:48
uPort Simple Application
<!doctype html>
<html>
<head>
<title>uPort Sample App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>
<script src="https://unpkg.com/uport-connect/dist/uport-connect.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
main { padding: 10px 30px; }
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@nakajo2011
nakajo2011 / broadcast_lines_in_tx_pool.go
Last active February 5, 2019 15:43
20190206_blog_parts_rev_27ce4eb78bdf5d9b742ed05babe9b86a434733a1_tx_pool
if list := pool.pending[from]; list != nil && list.Overlaps(tx) {
// Nonce already pending, check if required price bump is met
inserted, old := list.Add(tx, pool.config.PriceBump)
if !inserted {
pendingDiscardCounter.Inc(1)
return false, ErrReplaceUnderpriced
}
// New transaction is better, replace old one
if old != nil {
pool.all.Remove(old.Hash())
@nakajo2011
nakajo2011 / AddRemote_in_tx_pool.go
Last active February 5, 2019 16:02
20190206 blog parts2 reference from rev:27ce4eb78bdf5d9b742ed05babe9b86a434733a1
L798-L803
// AddRemote enqueues a single transaction into the pool if it is valid. If the
// sender is not among the locally tracked ones, full pricing constraints will
// apply.
func (pool *TxPool) AddRemote(tx *types.Transaction) error {
return pool.addTx(tx, false)
}
...
L631-L641
@nakajo2011
nakajo2011 / sample.js
Created June 3, 2019 07:53
dydxsample
const Web3 = require('web3')
const {Solo, BigNumber} = require('./dist/js/src/index.js')
const {AmountReference, AmountDenomination, ConfirmationType} = require('./dist/js/src/types.js')
process.on('unhandledRejection', console.dir)
const WETH_Market_ID = new BigNumber('0')
const DAI_Market_ID = new BigNumber('1')
const USDC_Market_ID = new BigNumber('2')
/**
@nakajo2011
nakajo2011 / keybase.md
Created September 5, 2019 09:27
keybase proof

Keybase proof

I hereby claim:

  • I am nakajo2011 on github.
  • I am y_nakajo (https://keybase.io/y_nakajo) on keybase.
  • I have a public key ASDVHdcqYNHUJmuB-C_nfytsir7fRHTPyn5zrtAJkjKwIgo

To claim this, I am signing this object:

@nakajo2011
nakajo2011 / daveauction.vy
Created October 9, 2019 14:30
Devcon5 Day2 hands-on
# Devcon 5 Auction
# Masked Reveal Auction
#*******************************
#Every user has a bid amount, hash (bidamount,pass), sent masked amount
struct Data:
bidval: wei_value
hashval: bytes32
sentval: wei_value