Skip to content

Instantly share code, notes, and snippets.

Nattapon Nimakul totiz

Block or report user

Report or block totiz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Libra query balance return.json
{
"address": "08c7bdf66f0ac29e154e9c05a8c00cc661f35a63a74d6f63dcc290c0d70e18c3",
"balance": "100"
}
View Libra query balance.json
{
"address": "08c7bdf66f0ac29e154e9c05a8c00cc661f35a63a74d6f63dcc290c0d70e18c3"
}
View Libra transfer return api.json
{
"address": "ed024cffdfc97dfd3cac1b68ea140bffcd27268cbc4fef3864f52e7c38a6613a",
"toAddress": "31c7092554bb804a4e25bd24399859428404c28cbc3b44dea5dc2a9f2314144b",
"balance": "",
"amount": "11"
}
View Libra transfer request api.json
{
"fromAddress": "ed024cffdfc97dfd3cac1b68ea140bffcd27268cbc4fef3864f52e7c38a6613a",
"mnemonic": "shoot success friend what custom card chuckle letter fiber artist suspect runway snack cheese soccer latin pull neither obey afraid accident pupil minor define;1",
"toAddress": "31c7092554bb804a4e25bd24399859428404c28cbc3b44dea5dc2a9f2314144b",
"amount": "11"
}
View Libra create wallet return.json
{
"address": "91a6b7e0b194c70df055ee650abf9d3a96aa179ce2bf18ed31a5b1a8878eb865",
"balance": "100",
"mnemonic": "mango region urban belt lonely space grocery enjoy shock mad refuse awful blush shy build observe frozen dinosaur opinion robust frost nose general acoustic;1"
}
View transfer_eth.js
const infura_token = '[[YOUR TOKEN]]' // ขอ infura token ได้ที่ infura.io (สมัครฟรี)
const privateKey = '0cb9dd3708cb7307eb6895183cafc18b13efd85e5f8f522832ce838da00245c3'
const publicKey = '0x19f0685F5FC36cc68328B730c63FD5E81514c704'
const gasPrice = '9' // gwei
const ethToSend = '0.001' // ether
const toAddress = '0x3CC0290E21A1Bf2CD6050a3139D17E6C4EF66416'
async function main() {
// โหลด web3
const Web3 = require('web3')
View transfer_eth_broadcast.js
// Sign ด้วย Private key
const signedTx = await web3.eth.accounts.signTransaction(rawTransaction, privateKey)
console.log('Signed Transaction', signedTx)
const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction)
console.log("Transaction receipt: ", receipt)
View transfer_eth_raw_tx.js
// โหลด web3
const Web3 = require('web3')
// เชื่อมต่อไปยัง infura
const web3 = new Web3(new Web3.providers.HttpProvider(`https://kovan.infura.io/v3/${infura_token}`))
// อ่านค่า nonce ณ ปัจจุบันเพื่อใช้สร้าง raw tx
// ค่า nonce เป็นค่า sequence number ที่จะต้องเรียงต่อกัน ตามจำนวนธุรกรรมของ address ผู้ส่ง
const nonce = await web3.eth.getTransactionCount(publicKey)
console.log('nonce', nonce)
View setup.js
const infura_token = '[[YOUR TOKEN]]' // ขอ infura token ได้ที่ infura.io (สมัครฟรี)
const privateKey = '0cb9dd3708cb7307eb6895183cafc18b13efd85e5f8f522832ce838da00245c3'
const publicKey = '0x19f0685F5FC36cc68328B730c63FD5E81514c704'
const gasPrice = '9' // gwei
const ethToSend = '0.001' // ether
const toAddress = '0x3CC0290E21A1Bf2CD6050a3139D17E6C4EF66416'
@totiz
totiz / Lazy CPU Performance.swift
Last active Sep 12, 2018
Lazy CPU Performance
View Lazy CPU Performance.swift
import UIKit
class ViewController: UIViewController {
// ตัวอย่างข้อมูลแบบ JSON-Style Data
// Count: 50,000
static func fetchDataFromApi() -> [[String: Any]] {
var output = [[String: Any]]()
for _ in 0..<10000 {
You can’t perform that action at this time.