Moeing chain is an EVM&Web3 compatible sidechain for Bitcoin Cash

Overview

Full node client of smartBCH

This repository contains the code of the full node client of smartBCH, an EVM&Web3 compatible sidechain for Bitcoin Cash.

You can get more information at smartbch.org.

We are actively developing smartBCH and a testnet will launch soon. Before that, you can download the source code and start a private single node testnet to test your DApp.

Docker

To run smartBCH via docker-compose you can execute the commands below! Note, the first time you run docker-compose it will take a while, as it will need to build the docker image.

# Generate a set of 10 test keys.
docker-compose run smartbch gen-test-keys -n 10

# Init the node, include the keys from the last step as a comma separated list.
docker-compose run smartbch init mynode --chain-id 0x1 --init-balance=10000000000000000000 --test-keys="KEY1,KEY2,KEY3,ETC"

# Start it up, you are all set!
docker-compose up
Comments
  • Questions about SEP102: Adjustment of Used Gas

    Questions about SEP102: Adjustment of Used Gas

    gas_used = gas_limit - gas_remained
    if gas_used * 4 < gas_limit then /*the estimated gas consumption is more than four times of real gas consumption*/
        gas_used = gas_limit /* no gas fee will be returned*/
    else if gas_used * 2 < gas_limit then /*the estimated gas consumption is more than two times of real gas consumption*/
        gas_used = (gas_used + gas_limit) / 2
    else then /*the estimated gas consumption is no larger than two times of real gas consumption*/
        /* return the gas fee just as ethereum*/
    endif
    returned_gas_fee = (gas_limit - gas_used) * gas_price
    

    This penalty can be bypassed with a small piece of code, which doesn't really make much sense. And hope to improve the accuracy of the estimated gas.

    uint gasLimit = gasleft() + 21200;
    ...
    while (true) {
        if ((gasleft() * 100) / gasLimit < 50) break;
    }
    
    opened by llwslc 15
  • wrong Block.Header.AppHash

    wrong Block.Header.AppHash

    Can't sync my node - tried even from scratch and getting the same issue:

    panic: Failed to process committed block (4569914:EF1C38EA0BDDB760B74C7514B31593330E7B1B251EFD5E00422F3899AA4D3E57): wrong Block.Header.AppHash. Expected 7DC33C437275A4BA3F5990138BDE16F98897CC9B86CF3E40A326B8FD13884401, got A191E3558F4715AD8265887B19861DACD5A4595E6A163FF46B79097FCF6533C9

    It's running with the latest code, any ideas?

    opened by AdJones 11
  • docker commands fail

    docker commands fail

    In the docs for how to set up a local test environment with docker:

    https://github.com/smartbch/smartbch/blame/main/README.md#L16

    The command: docker run c07742d4134c init mynode --chain-id 0x1 --init-balance=10000000000000000000 --test-keys=key1,key2,etc

    Doesn't work. It gives an error: ERROR: genesis.json file already exists: /root/.smartbchd/config/genesis.json

    opened by allenday 8
  • The SmartScan is too simple, is there a plan to improve?

    The SmartScan is too simple, is there a plan to improve?

    The features provided by the SmartScan is too simple, is there any plan to improve it, or is there any official plan to provide a better scanner?

    It would be better to buy etherscan's service directly.

    opened by llwslc 6
  • I can't synchronize with 0.3.3 or the latest code

    I can't synchronize with 0.3.3 or the latest code

    Can the binary file be given directly?

    I can't synchronize with 0.3.3 or the latest code

    I[2021-09-09|12:58:06.396] Added peer module=p2p peer="Peer{MConn{18.138.237.114:26656} 9942597c62826d0c25b65203cde1574470653e6e out}" I[2021-09-09|12:58:06.796] executed block module=state height=1 num_valid_txs=0 num_invalid_txs=0 I[2021-09-09|12:58:06.829] committed state module=state height=1 num_txs=0 app_hash=2A9219CB627D6D183F8066113DB39ACD81B25A39C3EB023CA4EE1B171511E35F I[2021-09-09|12:58:06.830] indexed block module=txindex height=1 panic: Failed to process committed block (2:B165783F1AD6352F66144533478C17206F7C0F516D1CBB67713848C04448D6CF): wrong Block.Header.AppHash. Expected 2A9219CB627D6D183F8066113DB39ACD81B25A39C3EB023CA4EE1B171511E35F, got B899D1FB272F0ECBEA60B645D7E4C363ECE9889CF25743BAE14B4D3EB08BABBC

    goroutine 3947140 [running]: github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).poolRoutine(0xc01506f340, 0x0) /root/godata/pkg/mod/github.com/tendermint/[email protected]/blockchain/v0/reactor.go:401 +0x15bf created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart /root/godata/pkg/mod/github.com/tendermint/[email protected]/blockchain/v0/reactor.go:110 +0x8c

    opened by JHong111 6
  • Cannot build `smartbchd`

    Cannot build `smartbchd`

    My node has been offline for nearly a month now and every effort that I've made to get it back online has failed.

    NOTE: I'd rather not use the Docker image, as I'd like to create a pure node (especially for educational purposes).

    This is the last command that I execute from the build instructions:

    go build -tags cppbtree github.com/smartbch/smartbch/cmd/smartbchd

    and here is the output from that execution:

    [email protected]:~/smart_bch/smartbch# go build -tags cppbtree github.com/smartbch/smartbch/cmd/smartbchd
    go: downloading github.com/ethereum/go-ethereum v1.10.7
    go: downloading github.com/holiman/uint256 v1.2.0
    go: downloading github.com/pelletier/go-toml v1.9.0
    go: downloading github.com/spf13/cobra v1.1.3
    go: downloading github.com/spf13/viper v1.7.1
    go: downloading github.com/tendermint/tendermint v0.34.10
    go: downloading golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b
    go: downloading github.com/smartbch/moeingevm v0.4.2
    go: downloading github.com/smartbch/moeingads v0.4.2
    go: downloading github.com/smartbch/moeingdb v0.4.2
    go: downloading github.com/rs/cors v1.7.0
    go: downloading github.com/tinylib/msgp v1.1.6
    go: downloading github.com/spf13/pflag v1.0.5
    go: downloading github.com/fsnotify/fsnotify v1.4.9
    go: downloading github.com/hashicorp/hcl v1.0.0
    go: downloading github.com/magiconair/properties v1.8.5
    go: downloading github.com/mitchellh/mapstructure v1.4.1
    go: downloading github.com/spf13/afero v1.6.0
    go: downloading github.com/spf13/cast v1.3.1
    go: downloading github.com/spf13/jwalterweatherman v1.1.0
    go: downloading github.com/subosito/gotenv v1.2.0
    go: downloading gopkg.in/ini.v1 v1.62.0
    go: downloading gopkg.in/yaml.v2 v2.4.0
    go: downloading github.com/gogo/protobuf v1.3.2
    go: downloading golang.org/x/net v0.0.0-20210421230115-4e50805a0758
    go: downloading google.golang.org/grpc v1.37.0
    go: downloading github.com/tendermint/tm-db v0.6.4
    go: downloading github.com/go-kit/kit v0.10.0
    go: downloading github.com/go-logfmt/logfmt v0.5.0
    go: downloading github.com/pkg/errors v0.9.1
    go: downloading github.com/prometheus/client_golang v1.10.0
    go: downloading github.com/gorilla/websocket v1.4.2
    go: downloading github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
    go: downloading github.com/deckarep/golang-set v1.7.1
    go: downloading github.com/minio/sha256-simd v1.0.0
    go: downloading github.com/dterei/gotsc v0.0.0-20160722215413-e78f872945c6
    go: downloading github.com/cespare/xxhash v1.1.0
    go: downloading github.com/btcsuite/btcd v0.22.0-beta
    go: downloading github.com/seehuhn/mt19937 v1.0.0
    go: downloading github.com/vechain/go-ecvrf v0.0.0-20200326080414-5b7e9ee61906
    go: downloading github.com/golang/protobuf v1.5.2
    go: downloading github.com/mackerelio/go-osstat v0.2.1
    go: downloading golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7
    go: downloading golang.org/x/text v0.3.6
    go: downloading github.com/philhofer/fwd v1.1.1
    go: downloading google.golang.org/genproto v0.0.0-20210422153429-2279cbceda62
    go: downloading github.com/google/btree v1.0.1
    go: downloading github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954
    go: downloading github.com/prometheus/client_model v0.2.0
    go: downloading github.com/prometheus/common v0.21.0
    go: downloading github.com/Workiva/go-datastructures v1.0.53
    go: downloading github.com/beorn7/perks v1.0.1
    go: downloading github.com/cespare/xxhash/v2 v2.1.1
    go: downloading github.com/prometheus/procfs v0.6.0
    go: downloading github.com/minio/highwayhash v1.0.2
    go: downloading github.com/google/orderedcode v0.0.1
    go: downloading github.com/gtank/merlin v0.1.1
    go: downloading github.com/libp2p/go-buffer-pool v0.0.2
    go: downloading github.com/golang/snappy v0.0.3
    go: downloading github.com/olekukonko/tablewriter v0.0.5
    go: downloading github.com/prometheus/tsdb v0.10.0
    go: downloading github.com/VictoriaMetrics/fastcache v1.6.0
    go: downloading github.com/holiman/bloomfilter/v2 v2.0.3
    go: downloading github.com/go-stack/stack v1.8.0
    go: downloading github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible
    go: downloading github.com/mmcloughlin/meow v0.0.0-20200201185800-3501c7c05d21
    go: downloading github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c
    go: downloading github.com/klauspost/cpuid/v2 v2.0.8
    go: downloading google.golang.org/protobuf v1.26.0
    go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
    go: downloading github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643
    go: downloading github.com/mattn/go-runewidth v0.0.12
    go: downloading github.com/tklauser/go-sysconf v0.3.5
    go: downloading github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
    go: downloading github.com/rivo/uniseg v0.2.0
    go: downloading github.com/tklauser/numcpus v0.2.2
    # github.com/smartbch/moeingdb/indexer
    In file included from cpp-btree-1.0.1/btree_map.h:31,
                     from bigmap.h:5,
                     from indexer.cpp:3:
    cpp-btree-1.0.1/btree.h: In instantiation of ‘btree::btree_node<Params>::reference btree::btree_node<Params>::value(int) [with Params = btree::btree_map_params<long unsigned int, std::vector<bits_n<3> >*, std::less<long unsigned int>, std::allocator<std::pair<const long unsigned int, std::vector<bits_n<3> >*> >, 256>; btree::btree_node<Params>::reference = std::pair<const long unsigned int, std::vector<bits_n<3> >*>&]’:
    cpp-btree-1.0.1/btree.h:809:12:   required from ‘btree::btree_iterator<Node, Reference, Pointer>::pointer btree::btree_iterator<Node, Reference, Pointer>::operator->() const [with Node = btree::btree_node<btree::btree_map_params<long unsigned int, std::vector<bits_n<3> >*, std::less<long unsigned int>, std::allocator<std::pair<const long unsigned int, std::vector<bits_n<3> >*> >, 256> >; Reference = std::pair<const long unsigned int, std::vector<bits_n<3> >*>&; Pointer = std::pair<const long unsigned int, std::vector<bits_n<3> >*>*; btree::btree_iterator<Node, Reference, Pointer>::pointer = std::pair<const long unsigned int, std::vector<bits_n<3> >*>*]’
    indexer.cpp:279:13:   required from here
    cpp-btree-1.0.1/btree.h:557:54: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      557 |     return reinterpret_cast<reference>(fields_.values[i]);
          |                                        ~~~~~~~~~~~~~~^
    cpp-btree-1.0.1/btree.h: In instantiation of ‘btree::btree_node<Params>::reference btree::btree_node<Params>::value(int) [with Params = btree::btree_map_params<long unsigned int, long unsigned int, std::less<long unsigned int>, std::allocator<std::pair<const long unsigned int, long unsigned int> >, 256>; btree::btree_node<Params>::reference = std::pair<const long unsigned int, long unsigned int>&]’:
    cpp-btree-1.0.1/btree.h:809:12:   required from ‘btree::btree_iterator<Node, Reference, Pointer>::pointer btree::btree_iterator<Node, Reference, Pointer>::operator->() const [with Node = btree::btree_node<btree::btree_map_params<long unsigned int, long unsigned int, std::less<long unsigned int>, std::allocator<std::pair<const long unsigned int, long unsigned int> >, 256> >; Reference = std::pair<const long unsigned int, long unsigned int>&; Pointer = std::pair<const long unsigned int, long unsigned int>*; btree::btree_iterator<Node, Reference, Pointer>::pointer = std::pair<const long unsigned int, long unsigned int>*]’
    bigmap.h:235:11:   required from ‘value_type bigmap<slot_count, key_type, value_type>::iterator::value() [with int slot_count = 65536; key_type = long unsigned int; value_type = long unsigned int]’
    indexer.cpp:157:33:   required from here
    cpp-btree-1.0.1/btree.h:557:54: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    cpp-btree-1.0.1/btree.h: In instantiation of ‘btree::btree_node<Params>::reference btree::btree_node<Params>::value(int) [with Params = btree::btree_map_params<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, unsigned int> >, 256>; btree::btree_node<Params>::reference = std::pair<const unsigned int, unsigned int>&]’:
    cpp-btree-1.0.1/btree.h:809:12:   required from ‘btree::btree_iterator<Node, Reference, Pointer>::pointer btree::btree_iterator<Node, Reference, Pointer>::operator->() const [with Node = btree::btree_node<btree::btree_map_params<unsigned int, unsigned int, std::less<unsigned int>, std::allocator<std::pair<const unsigned int, unsigned int> >, 256> >; Reference = std::pair<const unsigned int, unsigned int>&; Pointer = std::pair<const unsigned int, unsigned int>*; btree::btree_iterator<Node, Reference, Pointer>::pointer = std::pair<const unsigned int, unsigned int>*]’
    bigmultimap.h:51:7:   required from ‘void bigmultimap<slot_count, key_type, value_type>::erase(uint64_t, key_type, value_type) [with int slot_count = 65536; key_type = unsigned int; value_type = unsigned int; uint64_t = long unsigned int]’
    indexer.cpp:304:60:   required from here
    cpp-btree-1.0.1/btree.h:557:54: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
    # github.com/tecbot/gorocksdb
    /usr/bin/ld: /root/build/rocksdb-5.18.4/librocksdb.a(format.o): in function `rocksdb::Zlib_Uncompress(rocksdb::UncompressionContext const&, char const*, unsigned long, int*, unsigned int, rocksdb::MemoryAllocator*, int)':
    /root/build/rocksdb-5.18.4/./util/compression.h:527: undefined reference to `inflateInit2_'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:552: undefined reference to `inflate'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:584: undefined reference to `inflateEnd'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:534: undefined reference to `inflateSetDictionary'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:576: undefined reference to `inflateEnd'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/librocksdb.a(block_based_table_builder.o): in function `rocksdb::Zlib_Compress(rocksdb::CompressionContext const&, unsigned int, char const*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
    /root/build/rocksdb-5.18.4/./util/compression.h:447: undefined reference to `deflateInit2_'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:473: undefined reference to `deflate'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:459: undefined reference to `deflateEnd'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:482: undefined reference to `deflateEnd'
    /usr/bin/ld: /root/build/rocksdb-5.18.4/./util/compression.h:455: undefined reference to `deflateSetDictionary'
    collect2: error: ld returned 1 exit status
    

    without ~/smart_bch/smartbch/smartbchd I cannot proceed to syncing my node

    My system info

    OS: 20.04.4 LTS (Focal Fossa)

    Linux version 5.4.0-109-generic ([email protected]) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022

    Architecture:                    x86_64
    CPU op-mode(s):                  32-bit, 64-bit
    Byte Order:                      Little Endian
    Address sizes:                   40 bits physical, 48 bits virtual
    CPU(s):                          2
    On-line CPU(s) list:             0,1
    Thread(s) per core:              2
    Core(s) per socket:              1
    Socket(s):                       1
    NUMA node(s):                    1
    Vendor ID:                       AuthenticAMD
    CPU family:                      23
    Model:                           49
    Model name:                      AMD EPYC-Rome Processor
    Stepping:                        0
    CPU MHz:                         1996.244
    BogoMIPS:                        3992.48
    Hypervisor vendor:               KVM
    Virtualization type:             full
    L1d cache:                       32 KiB
    L1i cache:                       32 KiB
    L2 cache:                        512 KiB
    L3 cache:                        16 MiB
    NUMA node0 CPU(s):               0,1
    Vulnerability Itlb multihit:     Not affected
    Vulnerability L1tf:              Not affected
    Vulnerability Mds:               Not affected
    Vulnerability Meltdown:          Not affected
    Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
    Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
    Vulnerability Spectre v2:        Mitigation; LFENCE, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling
    Vulnerability Srbds:             Not affected
    Vulnerability Tsx async abort:   Not affected
    Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mm
                                     x fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpui
                                     d extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic mov
                                     be popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm s
                                     se4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb stibp vmmc
                                     all fsgsbase bmi1 avx2 smep bmi2 clflushopt clwb sha_ni xsaveopt xsaves clzero xsa
                                     veerptr wbnoinvd arat umip rdpid
    

    Any help is much appreciated 🙏

    edit: here is some memory info as well

    MiB Mem :   3931.7 total,    890.7 free,    172.8 used,   2868.2 buff/cache
    MiB Swap:   2400.0 total,   2400.0 free,      0.0 used.   3466.9 avail Mem 
    
    opened by modenero 5
  • block.AppHash does not match AppHash after replay

    block.AppHash does not match AppHash after replay

    Hello, I'm having this issue after trying to start my smartbch node after upgrading to master:

    ScanEntriesLite 0.65 1087526264/1673116800
    ScanEntriesLite 0.70 1171183032/1673116800
    ScanEntriesLite 0.75 1254839000/1673116800
    ScanEntriesLite 0.80 1338494120/1673116800
    ScanEntriesLite 0.85 1422149688/1673116800
    ScanEntriesLite 0.90 1505806024/1673116800
    ScanEntriesLite 0.95 1589462360/1673116800
    pre fetch bch blocks: #708584 ~ #708593, latest: #708701
    pre fetch bch blocks: #708595 ~ #708604, latest: #708701
    pre fetch bch blocks: #708606 ~ #708615, latest: #708701
    pre fetch bch blocks: #708617 ~ #708626, latest: #708701
    pre fetch bch blocks: #708628 ~ #708637, latest: #708701
    pre fetch bch blocks: #708639 ~ #708648, latest: #708701
    pre fetch bch blocks: #708650 ~ #708659, latest: #708701
    pre fetch bch blocks: #708661 ~ #708670, latest: #708701
    pre fetch bch blocks: #708672 ~ #708681, latest: #708701
    This Node ID: 525de84eb8ed4575b57d6a6eccd723dbd9ce4cf8
    I[2021-10-08|14:03:03.197] Starting multiAppConn service                module=proxy impl=multiAppConn
    I[2021-10-08|14:03:03.197] Starting localClient service                 module=abci-client connection=query impl=localClient
    I[2021-10-08|14:03:03.198] Starting localClient service                 module=abci-client connection=snapshot impl=localClient
    I[2021-10-08|14:03:03.198] Starting localClient service                 module=abci-client connection=mempool impl=localClient
    I[2021-10-08|14:03:03.198] Starting localClient service                 module=abci-client connection=consensus impl=localClient
    I[2021-10-08|14:03:03.199] Starting EventBus service                    module=events impl=EventBus
    I[2021-10-08|14:03:03.199] Starting PubSub service                      module=pubsub impl=PubSub
    I[2021-10-08|14:03:03.200] Starting IndexerService service              module=txindex impl=IndexerService
    I[2021-10-08|14:03:03.201] ABCI Handshake App Info                      module=consensus height=1073103 hash=5C93D29D4749065FB92B8D47642DF0CC87FC9123FDEF2568DA6726E1FF942AE5 software-version= protocol-version=0
    I[2021-10-08|14:03:03.202] ABCI Replay Blocks                           module=consensus appHeight=1073103 storeHeight=1073574 stateHeight=1073574
    I[2021-10-08|14:03:03.202] Applying block                               module=consensus height=1073104
    I[2021-10-08|14:03:03.217] executed block                               module=consensus height=1073104 num_valid_txs=0 num_invalid_txs=0
    I[2021-10-08|14:03:03.274] Applying block                               module=consensus height=1073105
    panic: block.AppHash does not match AppHash after replay. Got 26CFEC21DEDC5E99E91691F170714B41C797B86C462F1F37D21A3B24610CF678, expected 670B45DF7A05BAB79E3DC38436213BB11385471FAD22CF80E2995977631CDB6F.
    
    Block: Block{
      Header{
        Version:        {11 0}
        ChainID:        0x2710
        Height:         1073105
        Time:           2021-10-08 13:04:44.186642446 +0000 UTC
        LastBlockID:    28647082CB54E6F93A6DC83FF4D414FEEF759CFB9E6760ACEC8DEC78BB2E2E53:1:857D56FF9983
        LastCommit:     B6DD5A8882DCB11E9000494903D28461E6E73E8931DFA0AB72009965D9D9D461
        Data:           831B084AA1E87DBF15879B6E854437F0A21B473B32BD0C19BC934FAE6DEE27FE
        Validators:     04A699211A4ED90334B20CD106CDD5A9C7E43DBF54833A78C3EEF9F980DF4496
        NextValidators: 04A699211A4ED90334B20CD106CDD5A9C7E43DBF54833A78C3EEF9F980DF4496
        App:            670B45DF7A05BAB79E3DC38436213BB11385471FAD22CF80E2995977631CDB6F
        Consensus:      DB82A3E5EC7A0994F3B78B258907CFF68320368782642AA9255985A28C938678
        Results:        E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855
        Evidence:       E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855
        Proposer:       8A3B04DB500735E05A1CD05ED9E00176954D8438
      }#EDE0A46D4DC456EEA82AE5869995D3A5A51472BC07F1ACC886B36C4C14507393
      Data{
        0BF13E9796D149BFA403A7B9228820DBA8C16EC937F362A5AA42097281EC63E3 (369 bytes)
        75A1F8A9B2A7AF5503A5339F686318A067A5B6295B87707CABF8F660F2A0FFEC (369 bytes)
        FAE839D33738E4C0CB34F58A4407EEF39E87F735C9BFF2FD648EBFE8244AC781 (369 bytes)
        A03C4891D3B54FADF1EE92570E04832178FDA7661D9E2583171FA4D31E37EB14 (528 bytes)
        EAD678EF037F7173B7AAD1890000A4EA3305165B3DAE6343D2CBA9FDF6A2AF75 (369 bytes)
        47BD977B957619C2B4D084BB897312032D611DD22882B15A1FBDD610C466FDB4 (369 bytes)
        026F1E862BAAAE7585558D5179985FDABDCD5CEDFE8036764BA745B0D0B186F4 (369 bytes)
        85FA51B979BE4147518A753ACF6FABA31A6C1411225069204AA9B903894B1F8A (369 bytes)
        BAE86BC946EE1FB35110C37FE43D3A7D9619C87290124DF53CDD4D59BF1FBC9C (369 bytes)
        18487F70A5AE6C87858988D244CCE3F64711360CFDD366DC198EF74F151CDCB8 (369 bytes)
        8F6181B46D13D7EBAD565F9B2B2608ECE2BA172AE3A16C385B41E390E58FE1E5 (369 bytes)
        40C2399D5D3EAEC641635CE43997B298FB7F95FA044B372785B777F9188130FA (528 bytes)
        1C8725A9498F95D5149152F98371058C166AE92089728AFA82BA83A755EEBB95 (369 bytes)
        2344A27A4D984A02809A3888637D3C0B1EFD34613DD9D7B143C2F31FFAA08004 (369 bytes)
        8A10F298F50A1C8A1056834DD157A4FC0079BEA49E8F94EE171E5B2329A014BC (369 bytes)
        FAAFB5E1D5FE68539C6DE03757DD04B032472248EE9EB19A4DCF33F4604BE145 (529 bytes)
        FF22E9D0B0503562F9A174D36E4865C46E9A743A54CE812FE53FDD2A9686A876 (528 bytes)
        FB22021FF6FC5F97629FCE7883E5BB488799D8A5B0ADA53810004DA3688034A8 (529 bytes)
      }#831B084AA1E87DBF15879B6E854437F0A21B473B32BD0C19BC934FAE6DEE27FE
      EvidenceData{
    
      }#E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855
      Commit{
        Height:     1073104
        Round:      0
        BlockID:    28647082CB54E6F93A6DC83FF4D414FEEF759CFB9E6760ACEC8DEC78BB2E2E53:1:857D56FF9983
        Signatures:
          CommitSig{B11FC0442A43 by 4BC2DBE39A96 on 2 @ 2021-10-08T13:04:44.211856929Z}
          CommitSig{6334FD7BB9C9 by 8A3B04DB5007 on 2 @ 2021-10-08T13:04:44.186375962Z}
          CommitSig{B0420EC9BCB6 by 8BD806107E29 on 2 @ 2021-10-08T13:04:44.197290102Z}
          CommitSig{DCBDD0023E25 by 930C23CE7536 on 2 @ 2021-10-08T13:04:44.186642446Z}
      }#B6DD5A8882DCB11E9000494903D28461E6E73E8931DFA0AB72009965D9D9D461
    }#EDE0A46D4DC456EEA82AE5869995D3A5A51472BC07F1ACC886B36C4C14507393
    
    
    goroutine 1 [running]:
    github.com/tendermint/tendermint/consensus.assertAppHashEqualsOneFromBlock(0xc0116b1420, 0x20, 0x20, 0xc01a0a8780)
            /home/user/godata/pkg/mod/github.com/tendermint/[email protected]/consensus/replay.go:515 +0x18c
    github.com/tendermint/tendermint/consensus.(*Handshaker).replayBlocks(0xc01a0b8d58, 0xb, 0x0, 0x0, 0x0, 0xc01e8b2798, 0x6, 0x1, 0x1061a6, 0xc01167ebc0, ...)
            /home/user/godata/pkg/mod/github.com/tendermint/[email protected]/consensus/replay.go:468 +0x2ed
    github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc01a0b8d58, 0xb, 0x0, 0x0, 0x0, 0xc01e8b2798, 0x6, 0x1, 0x1061a6, 0xc01167ebc0, ...)
            /home/user/godata/pkg/mod/github.com/tendermint/[email protected]/consensus/replay.go:393 +0x8f0
    github.com/tendermint/tendermint/consensus.(*Handshaker).Handshake(0xc01a0b8d58, 0x1649858, 0xc01e30dad0, 0xc0000f81a0, 0xc01e87fb30)
            /home/user/godata/pkg/mod/github.com/tendermint/[email protected]/consensus/replay.go:268 +0x458
    github.com/tendermint/tendermint/node.doHandshake(0x1646c28, 0xc01e8b4580, 0xb, 0x0, 0x0, 0x0, 0xc01e8b2798, 0x6, 0x1, 0x1061a6, ...)
            /home/user/godata/pkg/mod/github.com/tendermint/[email protected]/node/node.go:308 +0x1d8
    github.com/tendermint/tendermint/node.NewNode(0xc000b50140, 0x16340a8, 0xc01e27f720, 0xc01e5d70f0, 0x161ab20, 0xc01e64d188, 0xc01e5d72a0, 0x14f5840, 0xc01e5d72b0, 0x163a7a8, ...)
            /home/user/godata/pkg/mod/github.com/tendermint/[email protected]/node/node.go:715 +0x2025
    main.startTmNode(0xc000b50140, 0xc01e5d70f0, 0x1648aa0, 0xc0000a9600, 0x163a7a8, 0xc01daf7d00, 0x1, 0x37, 0x0)
            /home/user/smart_bch/smartbch/cmd/smartbchd/start.go:176 +0x296
    main.startInProcess(0xc00000f4e8, 0x14f7178, 0x27, 0x0, 0x0)
            /home/user/smart_bch/smartbch/cmd/smartbchd/start.go:114 +0x34b
    main.StartCmd.func1(0xc0003c2c80, 0xc0003d86c0, 0x0, 0x3, 0x0, 0x0)
            /home/user/smart_bch/smartbch/cmd/smartbchd/start.go:59 +0x85
    github.com/spf13/cobra.(*Command).execute(0xc0003c2c80, 0xc0003d8660, 0x3, 0x3, 0xc0003c2c80, 0xc0003d8660)
            /home/user/godata/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x472
    github.com/spf13/cobra.(*Command).ExecuteC(0xc0003c2500, 0x1225ee0, 0xc00016fec0, 0xc0000c9f30)
            /home/user/godata/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x375
    github.com/spf13/cobra.(*Command).Execute(...) 
            /home/user/godata/pkg/mod/github.com/spf13/[email protected]/command.go:897
    github.com/tendermint/tendermint/libs/cli.Executor.Execute(0xc0003c2500, 0x14f75e0, 0x2, 0xc0003ba6d8)
            /home/user/godata/pkg/mod/github.com/tendermint/[email protected]/libs/cli/setup.go:89 +0x4a
    main.main()
            /home/user/smart_bch/smartbch/cmd/smartbchd/main.go:20 +0x70
    $
    
    opened by damascene 4
  • v0.4.0 Fail to Sync mainnet

    v0.4.0 Fail to Sync mainnet

    mainnet: https://github.com/gcash/bchd

    My mainnet rpc should be fine, because in version 0.3.5 it can get the mainnet block height.

    What's wrong with my environment?

    curl --user 'user:pass' --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;'  https://localhost:8334
    {"jsonrpc":"1.0","result":724572,"error":null,"id":"curltest"}
    

    v0.4.0

    ScanEntriesLite 0.95 140112/147456
    ScanEntriesLite 0.95 140184/147528
    D[2022-01-27|03:59:43.805] New watcher: mainnet url(https://localhost:8334), epochNum(0), lastEpochEndHeight(698502), speedUp(false)
     module=app
    get bch block hash
    panic: runtime error: index out of range [0] with length 0
    
    goroutine 1 [running]:
    github.com/smartbch/smartbch/watcher.(*RpcClient).getBCHBlock(0x1466b40, {0xc00004cf00, 0x11bc8c3})
    	/smart/smartbch/smartbch/watcher/rpcclient.go:155 +0x3f4
    github.com/smartbch/smartbch/watcher.(*RpcClient).GetBlockByHeight(0xc0119d6de0, 0x0, 0x0)
    	/smart/smartbch/smartbch/watcher/rpcclient.go:86 +0x23d
    github.com/smartbch/smartbch/watcher.(*Watcher).CheckSanity(0xc00016a270, 0xf0)
    	/smart/smartbch/smartbch/watcher/watcher.go:318 +0x54
    github.com/smartbch/smartbch/app.NewApp(0xc000574d00, 0xc000f94780, 0xaa886, 0x1e, {0x1487e30, 0xc000f81f60}, 0x40)
    	/smart/smartbch/smartbch/app/app.go:198 +0xf65
    main.newApp({0x1487e30, 0xc000f81f60}, 0x11abcf0, 0xc000f946c0)
    	/smart/smartbch/smartbch/cmd/smartbchd/main.go:53 +0xad
    main.startInProcess(0xc000218ab0, 0x133f538)
    	/smart/smartbch/smartbch/cmd/smartbchd/start.go:114 +0xd4
    main.StartCmd.func1(0xc000294000, {0xc0001294c0, 0x0, 0x4})
    	/smart/smartbch/smartbch/cmd/smartbchd/start.go:64 +0x57
    github.com/spf13/cobra.(*Command).execute(0xc000294000, {0xc000129480, 0x4, 0x4})
    	/root/godata/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x60e
    github.com/spf13/cobra.(*Command).ExecuteC(0xc000159680)
    	/root/godata/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x3ad
    github.com/spf13/cobra.(*Command).Execute(...)
    	/root/godata/pkg/mod/github.com/spf13/[email protected]/command.go:897
    github.com/tendermint/tendermint/libs/cli.Executor.Execute({0xc000159680, 0x133f7e8})
    	/root/godata/pkg/mod/github.com/tendermint/[email protected]/libs/cli/setup.go:89 +0x4a
    main.main()
    	/smart/smartbch/smartbch/cmd/smartbchd/main.go:20 +0x3d
    

    v0.3.5

    ScanEntriesLite 0.75 110664/147528
    ScanEntriesLite 0.80 118080/147528
    ScanEntriesLite 0.85 125424/147528
    ScanEntriesLite 0.90 132768/147528
    ScanEntriesLite 0.95 140184/147528
    D[2022-01-27|03:56:39.442] New watcher: mainnet url(https://localhost:8334), epochNum(0), lastEpochEndHeight(698502), speedUp(false)
     module=app
    pre fetch bch blocks: #698504 ~ #698513, latest: #724571
    D[2022-01-27|03:56:39.504] getBCHBlock failed                           module=watcher invalidcharacter'T'aftertop-levelvalue=(MISSING)
    D[2022-01-27|03:56:39.516] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.518] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.548] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.557] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.587] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.588] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.601] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.624] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.643] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:39.665] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    D[2022-01-27|03:56:41.639] getBCHBlock failed                           module=watcher getTxerror,code:-8,msg:Failedtoparserequest:wrongnumberofparams(expectedbetween1and2,received3)=(MISSING)
    
    opened by llwslc 3
  • Dockerfile: change base os image, remove ulimit setting and other minor fixes

    Dockerfile: change base os image, remove ulimit setting and other minor fixes

    1. Reduce image size from ~140MB to ~50MB by changing base OS image from ubuntu:20.04 to alpine:latest Inspired by https://github.com/ethereum/go-ethereum/blob/f94e23ca66eef8fdac2473ce99ca6ad57324aaa2/Dockerfile#L15-L18

    2. Remove file limit setting in Dockerfile https://github.com/smartbch/smartbch/blob/a857e5fa397d377074b2ac6adc61679b317cbfae/Dockerfile.optimized#L84-L85 Unfortunately this way of setting ulimit for docker containers is not effective at all. a) Ubuntu docker host:

    ❯ sudo docker run -it --entrypoint /bin/bash smartbch/smartbchd:v0.4.4
    [email protected]:~# ulimit -Hn
    1048576
    [email protected]:~# ulimit -Sn
    1048576
    

    b) WSL2 docker host:

    ❯ sudo docker run -it --entrypoint /bin/bash smartbch/smartbchd:v0.4.4
    [email protected]:~# ulimit -Hn
    4096
    [email protected]:~# ulimit -Sn
    1024
    

    To fix this: one safe way(as in running docker container without extra privileges(--privileged)) (related doc) is like this: docker run -it --ulimit nofile=65535:65535 --entrypoint /bin/bash smartbch/smartbchd:v0.4.4

    ❯ sudo docker run -it --ulimit nofile=65535:65535 --entrypoint /bin/bash smartbch/smartbchd:v0.4.4
    [email protected]:~# ulimit -Hn
    65535
    [email protected]:~# ulimit -Sn
    65535 
    

    And related PR for smartbch/docs is put up here : https://github.com/smartbch/docs/pull/65

    1. Make archive downloading and extraction non-verbose to reduce visual noise in output. Also explicitly naming downloaded archives to improve code clarity
    2. Remove extraneous LDFLAGS="-static" on compiling rocksdb
    opened by agilewalker 1
  • Update config versions for docker build

    Update config versions for docker build

    Update config version in docker build to be consistent with compile locally instruction. (v0.0.6 for Mainnet and v0.0.5 for Amber testnet).

    Docs PR: https://github.com/smartbch/docs/pull/61

    opened by tleekkul 1
  • Fail to Sync mainnet

    Fail to Sync mainnet

    This Node ID: 92bd56d28faf8cfc68a5ba5829931e67e9d1f2da I[2021-12-01|12:43:17.693] Starting multiAppConn service module=proxy impl=multiAppConn I[2021-12-01|12:43:17.693] Starting localClient service module=abci-client connection=query impl=localClient I[2021-12-01|12:43:17.693] Starting localClient service module=abci-client connection=snapshot impl=localClient I[2021-12-01|12:43:17.693] Starting localClient service module=abci-client connection=mempool impl=localClient I[2021-12-01|12:43:17.693] Starting localClient service module=abci-client connection=consensus impl=localClient I[2021-12-01|12:43:17.693] Starting EventBus service module=events impl=EventBus I[2021-12-01|12:43:17.693] Starting PubSub service module=pubsub impl=PubSub I[2021-12-01|12:43:17.693] Starting IndexerService service module=txindex impl=IndexerService I[2021-12-01|12:43:17.693] ABCI Handshake App Info module=consensus height=1293590 hash=35DB7710CE4214FF1DE6FFDEECA031512F1532EF98D87F748AA59C634E0E4010 software-version= protocol-version=0 I[2021-12-01|12:43:17.693] ABCI Replay Blocks module=consensus appHeight=1293590 storeHeight=1293591 stateHeight=1293590 I[2021-12-01|12:43:17.693] Replay last block using real app module=consensus ERROR: error during handshake: error on replay: wrong Block.Header.AppHash. Expected 35DB7710CE4214FF1DE6FFDEECA031512F1532EF98D87F748AA59C634E0E4010, got 623D5993E63633A25928B4803A3C7C0FC040B2CFC267D6639BE292E4981C6BFA

    opened by miaorao 1
  • PROPOSAL: Smart Bitcoin Exchange (SBX) — A

    PROPOSAL: Smart Bitcoin Exchange (SBX) — A "Smart" Bailout Plan

    PROPOSAL: Smart Bitcoin Exchange (SBX) — A "Smart" Bailout Plan

    Author(s): Shomari (nyusternie) • (join us)
    Source: https://gitlab.com/bchplease/sbx/-/blob/master/PROPOSAL.md
    Last updated: Thursday, July 7th 2022

    ↳ https://sbx.cash

    Introducing a distributed Proof-of-Stake (dPOS) network of SmartBCH stakeholders tasked with effectively managing the SmartBCH bridge using a suite of trustless, Free and Open Source Software (FOSS) smart contracts. This Federation of XHedge Validators will voluntarily run the newly developed SBX Manager on their respective network of nodes, offering a wide selection of decentralized Bitcoin Cash & SmartBCH services, namely:

    1. Cross-chain coin transfers — eg. $BCH to $SBCH to $WETH to $WAVAX
    2. Cross-chain NFT minting & burning — eg. BAYC, CryptoPunks, Clementine's, etc.
    3. Gas Stations — ie. gas-free SEP-20 & SEP-721 (meta) transactions
    4. Price Oracles
    5. Token Mining
    6. and more...

    A "Smart" Bailout Plan

    ↳ https://docs.sbx.cash/bailout

    This is an emergency proposal to mint a NEW $SBX token to fully "socialize" the outstanding debt of the ~101K $BCH (valued at ~$10M) currently "locked" and made unavailable by the "original" SmartBCH Treasury's custodian.

    $SBX (Bailout) holders will receive a share of ALL exchange fees (0.1%),
    PAID OUT DAILY, until the (Bailout) contract expires.

    SBX Featured Resource Links

    ↳ https://docs.sbx.cash (documentation)

    ↳ https://canvas.sbx.cash (lean canvas)

    ↳ https://plan.sbx.cash (business plan)

    ↳ https://flipstarter.sbx.cash (mvp + bootstrapping campaign)

    ↳ https://gitlab.com/bchplease/sbx (open-source code)

    Disclaimer

    This alpha project is very early in its lifecycle. It will evolve rapidly over the coming weeks and months. Until we achieve our first mature release, we are not committed to preserving backwards compatibility. Buttons may be moved or removed in future versions.

    Please take note! — We wanted to get this software in your hands as quickly as possible, so it's releasing before it's "complete". Bug reports and feedback on future directions are appreciated and encouraged! That said, we have LOTS planned and many new features are on the way.

    SBX Logo

    Introduction

    THE PROBLEM

    Since its inception, the trust & security of the SmartBCH sidechain has laid in the hands of a single, for-profit company. Not only does that violate the very fabric of a decentralized network, it diminishes the confidence of the Builders who need to invest their time, money and talent into this nascent network during its incubation period.

    Did you know? — There are currently ~101K $BCH being held by the "original" custodian of the SmartBCH treasury. In simple terms, $10M would be the total "Bailout" required to restore the SmartBCH sidechain 100% back to whole.

    THE SOLUTION

    The SmartBCH developers have brilliantly (pun intended) built-in a trustless Proof-of-Stake network of XHedge Validators directly into the protocol. These Validators have the most incentive and technical capability of managing the responsibility of custody for the network's assets; until a permanent solution is ready to be deployed on Mainnet.


    TL;DR — The goal of this initiative is to create a Federation of XHedge Validators (scalable to at least 100+ participating nodes) connected over a low-latency, decentralized, P2P communications network with the responsibility of managing the SmartBCH Cross-chain Asset Bridge.


    This proposal aims to accomplish ALL of the following:

    1. Organize a working group of developers to build a Smart Bitcoin Exchange (SBX).
    2. Coordinate with active Validators to safely deploy the all-NEW SBX Manager.
    3. Coordinate with the current $SBCH Treasury custodian to safely transfer the "escrowed" $BCH into the Exchange's treasury.
    4. Work with current DEXs (and other service providers) to integrate with the new network for decentralized $BCH <=> $SBCH asset exchanges.

    Smart Bitcoin Exchange Banner

    Smart Bitcoin Exchange (SBX)

    !! WARNING !! WARNING !! WARNING !!
    This project is still under active development and MUST be regarded as ALPHA software. It will evolve rapidly over the coming weeks and months. However, until we achieve our first "beta" release, we are not committed to preserving backwards compatibility. Buttons may be moved or removed in future versions.
    !! USE AT YOUR OWN RISK !!

    SmartBCH currently utilizes a network of Validators to vote on each block in the network. As this network of Validators currently holds 50% of the voting power (the other 50% is held by miners), they are the MOST incentivized and technically capable group to engage in this scheme.

    A suite of smart contracts will be deployed to manage the Exchange:

    SHA_Matrix_Exchange.cash (CashScript)
    SHA_Matrix_Exchange.sol (Solidity)
    SHA_Matrix_Treasury.sol (Solidity)
    SHA_Matrix_Gov.sol (Solidity)
    SBX.sol (Solidity)
    Bailout.sol (Solidity)

    Did you know? — The Bailout contract will be active during the daily ~$10M debt repayments. The contract will automatically expire after the full debt is repaid and/or ALL "escrowed" $BCH are released from the former SmartBCH Treasury custodian and deposited into the SBX Treasury.

    SHA-Matrix Exchange ($BCH)

    This is a CashScript contract to "lock" the $BCH that has been minted as $SBCH within the SmartBCH sidechain.

    SHA-Matrix Exchange ($SBCH)

    This is a Solidity contract that effectively manages the network of trustees overseeing the Exchange.

    SHA-Matrix Treasury

    This is a Solidity contract that serves as a Multi-tenant Secure Assets Vault for the Exchange's (Solidity) contracts. By separating the Treasury, it allows the Exchange's contracts to be upgraded with bug fixes and new features, while guaranteeing that assets ALWAYS remain SAFU!

    SHA-Matrix Gov

    [ see the documentation ]

    $SBX

    [ see the documentation ]

    Bailout

    This is a Solidity contract that manages the Treasury for the (Bailout) funds. This includes both the funds recovered from currently "locked" $BCH, plus the revenue generated from fees paid to the Exchange.

    Did you know? — The Owner of each of these (Solidity) contracts will be a Covenant of the TOP 15 Validators (by rating). The Owner of the CashScript contract will be a Covenant of the TOP 9 Validators (by rating). Rankings are updated each epoch (2016 blocks).

    Part I: Exchange Overview

    The Smart Bitcoin Exchange (SBX) provides a (temporary) decentralized solution for the resposiblity of managing the sidechain's treasury. Eventaually, the SHA-Gate contract will be deployed to Mainnet and perform the task of bridging $BCH <=> $SBCH.

    To establish trust in the network, participants will be limited to the active pool of XHedge Validators. These Validators possess the MOST incentive to secure the financial safety of the sidechain.

    Treasury

    The exchange's Treasury is a smart contract (SHA_Matrix_Treasury.sol) that manages vaults for ANY form of crypto asset:

    • SEP-20
    • SEP-721
    • SEP-1155
    • and more..

    Validators

    The active XHedge Validators provide the highest level of trust & security for the exchange.

    Part II: SHA-Matrix

    As an alternative to the SHA-Gate v2 contract provided from the SmartBCH team, the SHA-Matrix is a community-run network of "trusted" individuals & teams with the technical capabilities to manage the responsibilities of the Exchange.

    Part III: Discussion of Exchange Design

    The ideal goal of the SBX would be to serve as central Clearing House and a point of "trust" for the many independently run Services in the Bitcoin Cash and SmartBCH communities.

    Communications

    We propose that "on-chain" is always the preferred means of trustless & transparency. We propose an "on-chain" protocol to manage the transparent (at times encrypted) communications of the Validators participating in the exchange.

    OrbitDB will also be used as a low-latency, peer-to-peer channel for specific tasks.

    SBX Manager

    A new Free and Open Source Software (FOSS) Manager will be developed to be run by the participating Validators.

    Demo Video

    Safety & Security

    One of the main goals of the SHA-Matrix is to dramatically increase the number of participants involved in the protection of the SmartBCH sidechain.

    Validators will be weighted and scored based on their:

    1. Number of votes
    2. Up-time reliability
    3. Peer ranking

    Number of votes

    This number will be retrieved from the XHedge contract.

    Up-time reliability

    Validators will be penalized during any server downtime.

    Peer ranking

    Validators will rank each other, based on "off-chain" assessments determined by each time. Low-ranked Validators will be subject to additional (authoritative) restrictions by the network.

    Miner Participation

    This exchange is based on Proof-of-Stake (POS) and therefore is independent of the Proof-of-Work (POW) network of miners currently securing Bitcoin Cash.

    Exchange Integration

    SmartBCH already has several mature Decentralized Exchanges (DEXs) running on Mainnet. We aim to work with their teams to offer "native" integration to the SBX, with the help of:

    1. REST-based API services
    2. Custom software implementations
    3. Governance planning & design

    3rd-parties Using the Exchange

    SBX is an open protocol that is available to be used by anyone without permission.

    Fees

    [ see the documentation ]

    Free and Open Source Software (FOSS)

    In the spirit of full transparency, it's critical that the source code protecting the network be available to anyone and everyone who partipates in the network.

    License

    MIT

    opened by modenero 3
  • zksync support

    zksync support

    I suppose you guys already have your hands full, anyway I think this project is very interesting and I leave the link here for your evaluation in order to understand if it can be integrated in smartbch without the usual new token

    https://zksync.io/

    opened by Polve 1
  • Handle BCH connectivity issues gracefully

    Handle BCH connectivity issues gracefully

    Currently when smartbchd(v0.4.4 - and prior) can't talk to the configured BCH node, we get issue described at #22 . I encountered that recently where I launched BCH node and smartbch at the same time, smartbchd kept crashing with similar logs as #22 even after the BCH node caught up and smartbchd was talking to the node(validated using tcpdump). Only way out of it seems to be to wipe smartbchd data clean and start over.

    What I think should happen.

    1. If smartbchd cant get the data it needs from BCH node, make the error more explicit "Cannot fetch block xxx from BCH node"
    2. If smartbchd cant get the data it needs from BCH node, do not corrupt the chain, so that it can resume once connectivity to the node is restored.
    opened by sajal 3
  • eth_getLogs hidden limit on returned data

    eth_getLogs hidden limit on returned data

    I'm experiencing some undesirable behaviour in the rpc interface, specifically the eth_getLogs call. There seems to be some kind of hidden limit on how much data it will deliver. Given a block range, depending on wether I query that range in one go or in multiple separate non-overlapping ranges, I get different number of items returned

    There's no error thrown afaict. Neither through response nor on stdout of smartbchd.

    It's easy to reproduce:

    #!/bin/bash
    SBCH_ENDPOINT="https://smartbch.fountainhead.cash/mainnet:8545"
    
    result1=`curl -s -X POST ${SBCH_ENDPOINT} -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "method": "eth_getLogs", "params": [{"address": "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72", "fromBlock": "0xf1b30", "toBlock": "0x10a1cf", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' | jq '.result | length'`
    
    echo "--- requested blocks 990000 to 1089999, got ${result1} items"
    
    result2a=`curl -s -X POST ${SBCH_ENDPOINT} -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "method": "eth_getLogs", "params": [{"address": "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72", "fromBlock": "0xf1b30", "toBlock": "0xfde7f", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' | jq '.result | length'`
    echo "--- requested blocks 990000 to 1039999, got ${result2a} items"
    result2b=`curl -s -X POST ${SBCH_ENDPOINT} -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "method": "eth_getLogs", "params": [{"address": "0x7b2B3C5308ab5b2a1d9a94d20D35CCDf61e05b72", "fromBlock": "0xfde80", "toBlock": "0x10a1cf", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' | jq '.result | length'`
    echo "--- requested blocks 1040000 to 1089999, got ${result2b} items"
    
    echo "$result2a + $result2b = $[ $result2a + $result2b ], should be $result1"
    

    above script will give this output for me:

    --- requested blocks 990000 to 1089999, got 6704 items
    --- requested blocks 990000 to 1039999, got 6314 items
    --- requested blocks 1040000 to 1089999, got 2893 items
    6314 + 2893 = 9207, should be 6704
    

    obviously querying block 990000 to 1089999 should give the same number of results as querying 990000 to 1039999 and 1040000 to 1089999 (probably 9207 results)

    opened by molecular 2
  • Is there other ways to contact developers besides Telegram that is more active?

    Is there other ways to contact developers besides Telegram that is more active?

    I've been noticing that once in a while, multiple users in Telegram will simply ask questions that only the developers will respond to.

    Annoyingly, there's no other public developer besides Kui that is there to respond, and even then he doesn't respond at all to other questions when people come in to ask something different.

    opened by RowanSkie 5
Releases(v0.4.6)
  • v0.4.6(Dec 2, 2022)

    • JSON-RPC
      • Fix a bug related to VRS signature
      • Fix a bug of eth_getLogs
      • Fix a bug of eth_gasPrice
    • Others
      • Other small bug fixes and improvements
    Source code(tar.gz)
    Source code(zip)
  • v0.4.5(Jul 23, 2022)

    • JSON-RPC
      • Fix internal transaction status of sbch_getTransactionReceipt
    • Library
      • Upgrade moeingdb to v0.4.3
      • Upgrade moeingevm to v0.4.3
    • Others
      • Prepare to slash offline validators
    Source code(tar.gz)
    Source code(zip)
  • v0.4.4-p2(Jun 30, 2022)

  • v0.4.4-p1(Jun 17, 2022)

  • v0.4.4(Apr 11, 2022)

    • Library
      • Upgrade moeingads to v0.4.2
      • Upgrade moeingdb to v0.4.2
      • Upgrade moeingevm to v0.4.2
    • Others
      • Update XHedgeContractSequence and XHedgeForkBlock
    Source code(tar.gz)
    Source code(zip)
  • v0.4.3(Apr 3, 2022)

    • Library
      • Upgrade moeingads to v0.4.1
      • Upgrade moeingdb to v0.4.1
      • Upgrade moeingevm to v0.4.1
    • Others
      • Switch to Go 1.18
      • Switch to static link
      • Prepare to support SyncDB
      • Refine debug RPC endpoints
    Source code(tar.gz)
    Source code(zip)
  • v0.4.2(Feb 11, 2022)

  • v0.4.1(Feb 8, 2022)

    • BCH Watcher
      • Support BCHD JSON-RPC
    • JSON-RPC
      • Rename tm_nodeInfo to debug_nodeInfo
      • Rename tm_validatorsInfo to sbch_validatorsInfo
    • Others
      • Merge amber branch into main and use build tags to select main/testnet params
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Feb 8, 2022)

    • Consensus Change (need to be activated after a hard fork)
      • BCH holders can elect validators through the XHedge smart contract.
      • An optimized scheme to decide the minimum gas price.
      • Refine SEP206:
        • An EOA can only call SEP206's contract address once in a block
        • When using "transferFrom", the source account must be left 0.001 BCH.
      • Implement SEP109 to support VRF (verifiable random function)
    • Mempool
      • Allows EOA to send transactions into mempool continuously, across several successive blocks
    • JSON-RPC
      • Support eth_subscribe (newHeads and logs)
      • Add debug API (debug_* RPC endpoints)
      • The following methods support extra block parameter (compatible with EIP-1898) now
        • eth_getBalance
        • eth_getCode
        • eth_getTransactionCount
        • eth_getStorageAt
        • eth_call
        • eth_estimateGas
      • Add several methods in sbch namespace
        • sbch_getTransactionReceipt (Add internal transactions' information in transaction receipt)
        • sbch_getCCEpochs
        • sbch_getCurrEpoch
        • sbch_call
      • The following methods return internal transactions
        • sbch_getTxListByHeight
        • sbch_getTxListByHeightWithRange
      • Add several methods in debug namespace
    • Command
      • Add options to smartbchd start command
        • --http.api, --ws.api
        • --archive-mode
        • --skip-sanity-check
    • Library
      • Upgrade moeingads to v0.4.0
      • Upgrade moeingdb to v0.4.0
      • Upgrade moeingevm to v0.4.0
    • Others
      • Upgrade Golang to 1.7
      • Support querying main chain blocks in parallel.
      • Rpcclient will retry after failure for better robustness.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.5(Dec 16, 2021)

  • v0.3.4(Oct 12, 2021)

    • JSON-RPC
      • Changed hardcoded HTTPS ports to parameters (PR#23)
      • Fixed a bug of eth_getBlockByNumber
      • Fixed eth_gasPrice
      • Fixed transaction's V,R,S (issue#25)
    • Command
      • smartbchd start will not ignore --home option
      • smartbchd start can disable HTTPS-RPC and WSS-RPC server now
    • Library
      • Upgrade moeingdb to v0.3.3
      • Upgrade moeingevm to v0.3.2
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jul 31, 2021)

    • Command
      • Add smartbchd version command
    • JSON-RPC
      • Improve web3_clientVersion
      • Ignore the height argument and always return latest status
    • Consensus
      • Fix several staking bugs
    • Library
      • MoeingADS uses internal multiple shards to boost performance
      • MoeingEVM update evmone to 0.8.0
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Jun 29, 2021)

    • JSON-RPC
      • Add sbch_getTxListByHeightWithRange
      • Add tm_validatorsInfo
      • Add sbch_getEpochs
      • Fix bugs of several endpoints
    • Command
      • Improve smartbchd staking command
    • Consensus
      • Continue to enhance multi-validator support
      • Integrate with BCHN special testnode
    Source code(tar.gz)
    Source code(zip)
  • v0.1.6(Jun 2, 2021)

    • JSON-RPC

      • sbch_getTxListByHeight returns more detailed tx info
      • Add placeholder implementation for txpool namespace
        • txpool_content
        • txpool_status
        • txpool_inspect
    • Add toolkits for stress test

    • Mempool

      • Add signature cache and SEP206 sender set to speed up tx-rechecking
      • Refuse incoming TXs when a lot of TXs need rechecking
    • Consensus

      • Enhance multi-validator support
      • Customize BlockMaxBytes and BlockMaxGas for testing
      • Add some staking-related sub commands
    • Docker

      • Refine docker scripts
    • Storage

      • Sync MoeingADS to fix some bugs
      • Add pruning calls to MoeingADS
    • Move the faucet out from this repo

    Source code(tar.gz)
    Source code(zip)
  • v0.1.5(May 13, 2021)

    • JSON-RPC

      • sbch_queryTxBySrc/Dst/Addr & sbch_queryLogs

        • allow startHeight to be greater than endHeight
        • add limit param

        please refer to JSON-RPC docs for more detailed change

    • Add config option to support lite history DB

    Source code(tar.gz)
    Source code(zip)
Owner
null
Go implementation of a vanity attempt to generate Bitcoin private keys and subsequently checking whether the corresponding Bitcoin address has a non-zero balance.

vanity-BTC-miner Go implementation of a vanity attempt to generate Bitcoin private keys and subsequently checking whether the corresponding Bitcoin ad

Lih Ingabo 1 Jun 3, 2022
Signer manages Web3 transactions

Signer Website: https://signer-tech41.com Signer is a distributed, highly available, and data center aware solution to connect and configure applicati

Tech41 GmbH 1 Oct 29, 2021
⚡️A tiny web3 platform for hack clubbers

Ethermint Ethermint is a scalable and interoperable Ethereum library, built on Proof-of-Stake with fast-finality using the Cosmos SDK which runs on to

Hack Club 5 Sep 25, 2022
A Gomora template for building dApps and web3-powered API and smart contract listeners

Gomora dApp A Gomora template for building dApps and web3-powered API and smart contract listeners Local Development Setup the .env file first cp .env

Nuxify Inc. 3 Feb 15, 2022
The goal of Binance Smart Chain is to bring programmability and interoperability to Binance Chain

Binance Smart Chain The goal of Binance Smart Chain is to bring programmability

lin 1 Aug 17, 2022
XT Smart Chain, a chain based on the go-ethereum fork

XT Smart Chain XT Smart Chain (XSC) is a decentralized, high-efficiency and ener

null 4 May 17, 2022
Berylbit PoW chain using Ethash, EPI-Burn and geth. The chain will be using bot congestion flashbot bundles through nodes

Berylbit PoW chain using Ethash, EPI-Burn and geth. The chain will be using bot congestion flashbot bundles through nodes. Soon, We will work towards

BerylBit 9 Jun 30, 2022
EVM frontrunning tool

CAKE SNIPER FRONTRUNNING BOT =================================================== BEFORE STARTING: This bot require you to run the GETH client + use

Supercycled 1.4k Dec 5, 2022
An easy tool to apply transactions to the current EVM state. Optimized for MEV.

sibyl A more embedded version of fxfactorial/run-evm-code. This tool makes it easy to apply transactions to the current EVM state. Call it a transacti

Dialectic 68 Dec 4, 2022
Akroma GO client - Akroma is an EVM based application development platform (smart-contracts).

Akroma Akroma is an EVM based application development platform (smart-contracts). Akroma will utilize a Masternode system, and build out an Oracle pla

null 3 Jul 24, 2022
Signing, Keystore and RLP encoding utilities for EVM / Ethereum / secp256k1 based blockchains

Signing, Keystore and RLP encoding utilities for EVM / Ethereum / secp256k1 based blockchains. Written in Go with an enterprise friendly Apache 2.0 license, and a runtime JSON/RPC proxy server. Part of the Hyperledger FireFly project

Hyperledger 3 Aug 9, 2022
A full node Bitcoin (BSV) implementation written in Go

bsvd bsvd is a full node Bitcoin (BSV) implementation written in Go (golang). This project is a port of the bchd codebase to Bitcoin (BSV). It provide

null 41 Nov 25, 2022
A db for bitcoin-sv & BTC

Welcome to go-svdb Project =========== Boquan Team The Boquan is a team dedicated to promoting and developing true bitcoin. The team has successfully

mempool.com team 31 Sep 3, 2021
Store data on Bitcoin for 350 sats/KB up to 185 KB by using P2SH-P2WSH witness scripts

Bitcandle Store data on Bitcoin for 350 sats/KB up to 185 kB by using P2SH-P2WSH witness scripts. 225ed8bc432d37cf434f80717286fd5671f676f12b573294db72

Aurèle Oulès 11 Aug 12, 2022
A curated Golang toolkit for creating Bitcoin SV powered apps

bsv A curated Golang toolkit for creating Bitcoin SV powered apps Table of Contents Installation Maintainers License Installation bsv requires a suppo

null 21 May 10, 2022
A work-in-progress Bitcoin wallet based on Output Descriptors

go-wallet A work-in-progress Bitcoin wallet Descriptors go-wallet is designed around Bitcoin Descriptors. It implements a Output Script Descriptors la

Gustavo Chaín 5 May 4, 2022
The go-to Bitcoin Node (BN) Go library.

go-bitcoin Go wrapper for bitcoin RPC RPC services Start by creating a connection to a bitcoin node b, err := New("rcp host", rpc port, "rpc usernam

null 3 Feb 13, 2022
Bitcoin CPU miner written in Go.

CPU Miner Bitcoin CPU miner written in Go. Introduction This is a CPU miner written in Go. It is a proof of concept and is not intended for production

Yaroslav Gaponov 0 Jan 6, 2022
A fully validating Bitcoin node with Utreexo support

btcd btcd is an alternative full node bitcoin implementation written in Go (golang). This project is currently under active development and is in a Be

Utreexo 13 Sep 5, 2022