Skip to content

Instantly share code, notes, and snippets.

View itoonx's full-sized avatar
👻
Deep

Makkhawan Voraboot itoonx

👻
Deep
View GitHub Profile
@itoonx
itoonx / command
Created October 23, 2019 17:37
Basic AT Commands for SIM900A GSM/GPRS Module
TO CHECK THE MODEM:
AT
OK
TO CHANGE SMS SENDING MODE:
AT+CMGF=1
/**
*Submitted for verification at Etherscan.io on 2019-07-29
*/
pragma solidity ^0.4.24;
contract UtilFairWin {
function getRecommendScaleBylevelandTim(uint level,uint times) public view returns(uint);
function compareStr (string _str,string str) public view returns(bool);
function getLineLevel(uint value) public view returns(uint);
@itoonx
itoonx / segwit.md
Last active March 4, 2019 20:21
Bitcoin Segwit
@itoonx
itoonx / Bitcoin_MultiSig_Wallet.js
Created March 2, 2019 21:26
Bitcoin_MultiSig_Wallet.js
const crypto = require('crypto');
const bitcoinjs = require('bitcoinjs-lib');
module.exports = (user_id, currency_type) => {
// Generate a P2SH, pay-to-multisig (3-of-4) address
// แปลง user_id ให้เป็น string ก่อน
let shash = String(user_id);
@itoonx
itoonx / RatchadaToken.json
Created August 30, 2018 00:41
Ratchada Token Base on ERC20
{
"tokenName": "Ratchada Token",
"symbol": "SEX",
"contractAddress": "0x4751bb9185ae336ff615740f752e79dbd1125e10",
"decimals": 18,
"transferEvent": "Transfer(address,address,uint256)",
"enable": true,
"network": "ropsten",
"contractABI": [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function
@itoonx
itoonx / rpcclient.py
Created August 24, 2018 03:13
OMNI RPC Client Module
import requests, getpass
import time, json
class RPCHost():
def __init__(self):
USER=getpass.getuser()
self._session = requests.Session()
try:
with open('/home/'+USER+'/.bitcoin/bitcoin.conf') as fp:
RPCPORT="8332"
@itoonx
itoonx / gist:f212ca48026c4d97a6b743168816b1ea
Created August 24, 2018 03:11
Ubuntu VM and just installing C Lightning Node
docker run --rm --name lightning --network container:bitcoind_mainnet -v /scratch/bitcoin/mainnet/bitcoind:/root/.bitcoin -v /scratch/bitcoin/mainnet/clightning:/root/.lightning --entrypoint /usr/bin/lightningd cdecker/lightningd:master --network=bitcoin --log-level=debug --alias=[YOUR NAME HERE] --rgb=[YOUR COLOR HERE]
### Keybase proof
I hereby claim:
* I am itoonx on github.
* I am itoonx (https://keybase.io/itoonx) on keybase.
* I have a public key ASAlFuih3VbTCmM3EPJZe3vdDjBPA9e78yS1a5KBLOm4Uwo
To claim this, I am signing this object:
A nonce is just a sequential number tied to every transaction that represents the number of transactions the sender account has made on the network. You can think of it the same way as the auto-incrementing id field in a SQL database. It's a mechanism to ensure that the same transaction isn't submitted twice.
Example: You create a brand new Ethereum account. Your friend Alex sends you 5 ETH. This doesn't effect your account's nonce because you weren't the sender account. You then send 1 ETH to your friend John. The transaction that sends that 1 ETH needs to have the nonce of 0, because it's the first transaction your account is sending. Later that day, you send 2 ETH to your friend Bradley. That transaction will need to have a nonce of 1.
If you're going to set the nonce programmatically in a Dapp you can do it with web3 like this web3.eth.getTransactionCount(acct) because the number of transactions that an account has sent, will be the next nonce that it needs to use.
To proactively answer your next quest
@itoonx
itoonx / gist:5acc05505d9f5115b3da6cb98b3fc41c
Created March 25, 2018 17:40
Ethereum Bytecode and OPCODE
76
down vote
accepted
All of the opcodes and their complete descriptions are available in the Ethereum Yellow paper. For convenience, though, I've made a handy reference list of them all:
0s: Stop and Arithmetic Operations
0x00 STOP Halts execution
0x01 ADD Addition operation