Skip to content

Instantly share code, notes, and snippets.

HAOYUatHZ HAOYUatHZ

View GitHub Profile
View tx count
mysql> SELECT COUNT(*) FROM blockcenter.address_transactions where address_id = 3;
+----------+
| COUNT(*) |
+----------+
| 38283 |
+----------+
1 row in set (0.02 sec)
@HAOYUatHZ
HAOYUatHZ / main.go
Created Jan 15, 2019
test gorm association
View main.go
package main
import (
"fmt"
// "github.com/jinzhu/gorm"
log "github.com/sirupsen/logrus"
"github.com/blockcenter/config"
"github.com/blockcenter/database"
View settle_hatminer.py
# grep -o -E 'MinerName=.* +diff=[0-9]+' copy.log > all_stats.log
filename = "all_stats.log"
all_earn = 453.259264136
from collections import defaultdict
d = {}
d = defaultdict(lambda: 0, d)
View run_hatminer.sh
#!/bin/bash
ps -ef | grep 'sipe' | grep -v 'grep' | grep -v 'restart_sipe'
if [ $? -eq 0 ];then
kill -9 `ps -ef | grep 'sipe' | grep -v 'grep'| grep -v 'kill' | awk '{print $2}'`
else
echo 'Fail to find sipe process'
fi
mkdir -p $HOME/log/sipe/
current=`date +%Y%m%d%H%M%S`
View hash_rate.md
targetHex := job.Target
decoded, _ := hex.DecodeString(targetHex)
decoded = reverse(decoded)
target_int := new(big.Int).SetBytes(padded)
max_bits_int := 1*(2^55-1)*256^((2^8-1)-3)
View 链式交易.md

链式交易

比原最近的 PR #1356 新增了链式交易功能。 可以将多笔 utxo 合并成链并立即直接使用。

注意:目前只支持 spend btm 资产

重点代码在 account/builder.go

//流程: 
View build.md

http://127.0.0.1:9888/build-transaction

{
    "base_transaction": null,
    "actions": [
        {
            "amount": 410,
            "asset_id": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
            "address": "sm1qr5n3ps9ydgvzs0q0y80qpe77m26a3f2gyp4n4e",
View GetBalances
SELECT address.wallet_id, address.id, balance.asset, balance.balance, balance.total_received, balance.total_sent FROM balance INNER JOIN address ON balance.address_id=address.id WHERE address.wallet_id="b1e0575e-0e92-4774-ac5f-fd6091738ad6";
INSERT INTO balance(address_id,asset) VALUES(3,"0xfffe");
View tensority.md

Tensority

  • tensority 算法
    • input: block_header_hash & seed
      • block_header_hash
      • seed
        • seed 生成矩阵需要花费一定时间,seed 256个区块改变一次,故 seed 生成的矩阵数组可以做个 cache 以复用
    • output: tensority_hash
  • 代码实现
View update_bytomd.sh
#!/bin/bash
ps -ef | grep bytomd | grep -v grep | grep -v update_bytomd
if [ $? -eq 0 ]; then
kill -9 `ps -ef | grep bytomd | grep -v grep | grep -v update_bytomd | grep -v kill | awk '{print $2}'`
else
echo 'No Found Process'
fi
export PATH=$PATH:$HOME/go/bin
export GOPATH=$HOME/work/
You can’t perform that action at this time.