├── .github └── workflows │ └── go.yml ├── .gitignore ├── README.md ├── abi └── PoWERC20.go ├── go.mod ├── go.sum └── main.go /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | # .github/workflows/release.yaml 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | permissions: 8 | contents: write 9 | packages: write 10 | 11 | jobs: 12 | releases-matrix: 13 | name: Release Go Binary 14 | runs-on: ubuntu-latest 15 | strategy: 16 | matrix: 17 | goos: [linux, windows, darwin] 18 | goarch: ["386", amd64, arm64] 19 | exclude: 20 | - goarch: "386" 21 | goos: darwin 22 | - goarch: arm64 23 | goos: windows 24 | steps: 25 | - uses: actions/checkout@v3 26 | - uses: wangyoucao577/go-release-action@v1 27 | with: 28 | github_token: ${{ secrets.GITHUB_TOKEN }} 29 | goos: ${{ matrix.goos }} 30 | goarch: ${{ matrix.goarch }} 31 | goversion: "https://go.dev/dl/go1.21.1.linux-amd64.tar.gz" 32 | project_path: "./" 33 | binary_name: "Powerc20Worker" 34 | ldflags: -s -w 35 | 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sol 2 | *.abi 3 | abigen 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PoWERC20 Mining Tool 2 | 3 | ## Overview 4 | 5 | This Go project is a fully-functional tool for participating in Ethereum's PoWERC20 mining process. It provides a practical implementation for connecting to the Ethereum blockchain, generating nonces, and submitting transactions once a valid nonce is found. This tool is ideal for those looking to engage in Ethereum mining or understand the underlying mechanics in a real-world scenario. 6 | 7 | ## Features 8 | 9 | - **Mining Functionality**: Generates nonces and compares the resulting hash against a target, mimicking the actual mining process in Ethereum. 10 | - **Parallel Mining Workers**: Utilizes Go's concurrency capabilities to deploy multiple mining workers, increasing the chance of finding a valid nonce. 11 | - **Smart Contract Interaction**: Retrieves the current mining challenge and difficulty from a specified Ethereum smart contract. 12 | - **Nonce Submission and Transaction Handling**: Submits the mining solution to the Ethereum network and handles the transaction process once a valid nonce is discovered. 13 | 14 | ## Installation and Setup 15 | 16 | 1. **Install Go**: Ensure Go 1.21.x is installed on your system. 17 | 2. **Clone the Repository**: Download this repository to your local machine. 18 | 3. **Dependency Installation**: Run `go get` to install the necessary dependencies. 19 | 4. **Build the Project**: 20 | - Navigate to the project directory. 21 | - Run `go build -o Powerc20Worker` to build the executable. 22 | 23 | ## Usage 24 | 25 | 1. **Configuration**: 26 | - Customize your Ethereum private key and the contract address in the `init()` function. 27 | - Adjust the number of mining workers as needed. 28 | 29 | 2. **Running the Tool**: 30 | - Launch the tool by executing `./Powerc20Worker` in your terminal. 31 | - You can use optional flags for specific configurations, for example: `./Powerc20Worker -privateKey YOUR_PRIVATE_KEY -contractAddress CONTRACT_ADDRESS -workerCount NUMBER_OF_WORKERS`. 32 | 33 | ## Declare 34 | 35 | The project code is completely open source. The released version is compiled using Github Actions. If you have any questions about the code, please feel free to raise them or submit the code for security auditing anywhere. 36 | 37 | ## Contributing 38 | 39 | Your contributions are welcome. Please adhere to the project's coding standards and include tests for any new features or fixes. 40 | -------------------------------------------------------------------------------- /abi/PoWERC20.go: -------------------------------------------------------------------------------- 1 | // Code generated - DO NOT EDIT. 2 | // This file is a generated binding and any manual changes will be lost. 3 | 4 | package abi 5 | 6 | import ( 7 | "errors" 8 | "math/big" 9 | "strings" 10 | 11 | ethereum "github.com/ethereum/go-ethereum" 12 | "github.com/ethereum/go-ethereum/accounts/abi" 13 | "github.com/ethereum/go-ethereum/accounts/abi/bind" 14 | "github.com/ethereum/go-ethereum/common" 15 | "github.com/ethereum/go-ethereum/core/types" 16 | "github.com/ethereum/go-ethereum/event" 17 | ) 18 | 19 | // Reference imports to suppress errors if they are not otherwise used. 20 | var ( 21 | _ = errors.New 22 | _ = big.NewInt 23 | _ = strings.NewReader 24 | _ = ethereum.NotFound 25 | _ = bind.Bind 26 | _ = common.Big1 27 | _ = types.BloomLookup 28 | _ = event.NewSubscription 29 | _ = abi.ConvertType 30 | ) 31 | 32 | // PoWERC20MetaData contains all meta data concerning the PoWERC20 contract. 33 | var PoWERC20MetaData = &bind.MetaData{ 34 | ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_initialSupply\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"_decimals_\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_difficulty\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_miningLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_initialLimitPerMint\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"challenge\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"difficulty\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLimitPerMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRemainingSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"limitPerMint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"mine\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"minedNonces\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"miningLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"miningTimes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupplyCap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", 35 | } 36 | 37 | // PoWERC20ABI is the input ABI used to generate the binding from. 38 | // Deprecated: Use PoWERC20MetaData.ABI instead. 39 | var PoWERC20ABI = PoWERC20MetaData.ABI 40 | 41 | // PoWERC20 is an auto generated Go binding around an Ethereum contract. 42 | type PoWERC20 struct { 43 | PoWERC20Caller // Read-only binding to the contract 44 | PoWERC20Transactor // Write-only binding to the contract 45 | PoWERC20Filterer // Log filterer for contract events 46 | } 47 | 48 | // PoWERC20Caller is an auto generated read-only Go binding around an Ethereum contract. 49 | type PoWERC20Caller struct { 50 | contract *bind.BoundContract // Generic contract wrapper for the low level calls 51 | } 52 | 53 | // PoWERC20Transactor is an auto generated write-only Go binding around an Ethereum contract. 54 | type PoWERC20Transactor struct { 55 | contract *bind.BoundContract // Generic contract wrapper for the low level calls 56 | } 57 | 58 | // PoWERC20Filterer is an auto generated log filtering Go binding around an Ethereum contract events. 59 | type PoWERC20Filterer struct { 60 | contract *bind.BoundContract // Generic contract wrapper for the low level calls 61 | } 62 | 63 | // PoWERC20Session is an auto generated Go binding around an Ethereum contract, 64 | // with pre-set call and transact options. 65 | type PoWERC20Session struct { 66 | Contract *PoWERC20 // Generic contract binding to set the session for 67 | CallOpts bind.CallOpts // Call options to use throughout this session 68 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 69 | } 70 | 71 | // PoWERC20CallerSession is an auto generated read-only Go binding around an Ethereum contract, 72 | // with pre-set call options. 73 | type PoWERC20CallerSession struct { 74 | Contract *PoWERC20Caller // Generic contract caller binding to set the session for 75 | CallOpts bind.CallOpts // Call options to use throughout this session 76 | } 77 | 78 | // PoWERC20TransactorSession is an auto generated write-only Go binding around an Ethereum contract, 79 | // with pre-set transact options. 80 | type PoWERC20TransactorSession struct { 81 | Contract *PoWERC20Transactor // Generic contract transactor binding to set the session for 82 | TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session 83 | } 84 | 85 | // PoWERC20Raw is an auto generated low-level Go binding around an Ethereum contract. 86 | type PoWERC20Raw struct { 87 | Contract *PoWERC20 // Generic contract binding to access the raw methods on 88 | } 89 | 90 | // PoWERC20CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. 91 | type PoWERC20CallerRaw struct { 92 | Contract *PoWERC20Caller // Generic read-only contract binding to access the raw methods on 93 | } 94 | 95 | // PoWERC20TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. 96 | type PoWERC20TransactorRaw struct { 97 | Contract *PoWERC20Transactor // Generic write-only contract binding to access the raw methods on 98 | } 99 | 100 | // NewPoWERC20 creates a new instance of PoWERC20, bound to a specific deployed contract. 101 | func NewPoWERC20(address common.Address, backend bind.ContractBackend) (*PoWERC20, error) { 102 | contract, err := bindPoWERC20(address, backend, backend, backend) 103 | if err != nil { 104 | return nil, err 105 | } 106 | return &PoWERC20{PoWERC20Caller: PoWERC20Caller{contract: contract}, PoWERC20Transactor: PoWERC20Transactor{contract: contract}, PoWERC20Filterer: PoWERC20Filterer{contract: contract}}, nil 107 | } 108 | 109 | // NewPoWERC20Caller creates a new read-only instance of PoWERC20, bound to a specific deployed contract. 110 | func NewPoWERC20Caller(address common.Address, caller bind.ContractCaller) (*PoWERC20Caller, error) { 111 | contract, err := bindPoWERC20(address, caller, nil, nil) 112 | if err != nil { 113 | return nil, err 114 | } 115 | return &PoWERC20Caller{contract: contract}, nil 116 | } 117 | 118 | // NewPoWERC20Transactor creates a new write-only instance of PoWERC20, bound to a specific deployed contract. 119 | func NewPoWERC20Transactor(address common.Address, transactor bind.ContractTransactor) (*PoWERC20Transactor, error) { 120 | contract, err := bindPoWERC20(address, nil, transactor, nil) 121 | if err != nil { 122 | return nil, err 123 | } 124 | return &PoWERC20Transactor{contract: contract}, nil 125 | } 126 | 127 | // NewPoWERC20Filterer creates a new log filterer instance of PoWERC20, bound to a specific deployed contract. 128 | func NewPoWERC20Filterer(address common.Address, filterer bind.ContractFilterer) (*PoWERC20Filterer, error) { 129 | contract, err := bindPoWERC20(address, nil, nil, filterer) 130 | if err != nil { 131 | return nil, err 132 | } 133 | return &PoWERC20Filterer{contract: contract}, nil 134 | } 135 | 136 | // bindPoWERC20 binds a generic wrapper to an already deployed contract. 137 | func bindPoWERC20(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { 138 | parsed, err := PoWERC20MetaData.GetAbi() 139 | if err != nil { 140 | return nil, err 141 | } 142 | return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil 143 | } 144 | 145 | // Call invokes the (constant) contract method with params as input values and 146 | // sets the output to result. The result type might be a single field for simple 147 | // returns, a slice of interfaces for anonymous returns and a struct for named 148 | // returns. 149 | func (_PoWERC20 *PoWERC20Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 150 | return _PoWERC20.Contract.PoWERC20Caller.contract.Call(opts, result, method, params...) 151 | } 152 | 153 | // Transfer initiates a plain transaction to move funds to the contract, calling 154 | // its default method if one is available. 155 | func (_PoWERC20 *PoWERC20Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 156 | return _PoWERC20.Contract.PoWERC20Transactor.contract.Transfer(opts) 157 | } 158 | 159 | // Transact invokes the (paid) contract method with params as input values. 160 | func (_PoWERC20 *PoWERC20Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 161 | return _PoWERC20.Contract.PoWERC20Transactor.contract.Transact(opts, method, params...) 162 | } 163 | 164 | // Call invokes the (constant) contract method with params as input values and 165 | // sets the output to result. The result type might be a single field for simple 166 | // returns, a slice of interfaces for anonymous returns and a struct for named 167 | // returns. 168 | func (_PoWERC20 *PoWERC20CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { 169 | return _PoWERC20.Contract.contract.Call(opts, result, method, params...) 170 | } 171 | 172 | // Transfer initiates a plain transaction to move funds to the contract, calling 173 | // its default method if one is available. 174 | func (_PoWERC20 *PoWERC20TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { 175 | return _PoWERC20.Contract.contract.Transfer(opts) 176 | } 177 | 178 | // Transact invokes the (paid) contract method with params as input values. 179 | func (_PoWERC20 *PoWERC20TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { 180 | return _PoWERC20.Contract.contract.Transact(opts, method, params...) 181 | } 182 | 183 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 184 | // 185 | // Solidity: function allowance(address owner, address spender) view returns(uint256) 186 | func (_PoWERC20 *PoWERC20Caller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { 187 | var out []interface{} 188 | err := _PoWERC20.contract.Call(opts, &out, "allowance", owner, spender) 189 | 190 | if err != nil { 191 | return *new(*big.Int), err 192 | } 193 | 194 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 195 | 196 | return out0, err 197 | 198 | } 199 | 200 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 201 | // 202 | // Solidity: function allowance(address owner, address spender) view returns(uint256) 203 | func (_PoWERC20 *PoWERC20Session) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { 204 | return _PoWERC20.Contract.Allowance(&_PoWERC20.CallOpts, owner, spender) 205 | } 206 | 207 | // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. 208 | // 209 | // Solidity: function allowance(address owner, address spender) view returns(uint256) 210 | func (_PoWERC20 *PoWERC20CallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { 211 | return _PoWERC20.Contract.Allowance(&_PoWERC20.CallOpts, owner, spender) 212 | } 213 | 214 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 215 | // 216 | // Solidity: function balanceOf(address account) view returns(uint256) 217 | func (_PoWERC20 *PoWERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { 218 | var out []interface{} 219 | err := _PoWERC20.contract.Call(opts, &out, "balanceOf", account) 220 | 221 | if err != nil { 222 | return *new(*big.Int), err 223 | } 224 | 225 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 226 | 227 | return out0, err 228 | 229 | } 230 | 231 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 232 | // 233 | // Solidity: function balanceOf(address account) view returns(uint256) 234 | func (_PoWERC20 *PoWERC20Session) BalanceOf(account common.Address) (*big.Int, error) { 235 | return _PoWERC20.Contract.BalanceOf(&_PoWERC20.CallOpts, account) 236 | } 237 | 238 | // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. 239 | // 240 | // Solidity: function balanceOf(address account) view returns(uint256) 241 | func (_PoWERC20 *PoWERC20CallerSession) BalanceOf(account common.Address) (*big.Int, error) { 242 | return _PoWERC20.Contract.BalanceOf(&_PoWERC20.CallOpts, account) 243 | } 244 | 245 | // Challenge is a free data retrieval call binding the contract method 0xd2ef7398. 246 | // 247 | // Solidity: function challenge() view returns(uint256) 248 | func (_PoWERC20 *PoWERC20Caller) Challenge(opts *bind.CallOpts) (*big.Int, error) { 249 | var out []interface{} 250 | err := _PoWERC20.contract.Call(opts, &out, "challenge") 251 | 252 | if err != nil { 253 | return *new(*big.Int), err 254 | } 255 | 256 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 257 | 258 | return out0, err 259 | 260 | } 261 | 262 | // Challenge is a free data retrieval call binding the contract method 0xd2ef7398. 263 | // 264 | // Solidity: function challenge() view returns(uint256) 265 | func (_PoWERC20 *PoWERC20Session) Challenge() (*big.Int, error) { 266 | return _PoWERC20.Contract.Challenge(&_PoWERC20.CallOpts) 267 | } 268 | 269 | // Challenge is a free data retrieval call binding the contract method 0xd2ef7398. 270 | // 271 | // Solidity: function challenge() view returns(uint256) 272 | func (_PoWERC20 *PoWERC20CallerSession) Challenge() (*big.Int, error) { 273 | return _PoWERC20.Contract.Challenge(&_PoWERC20.CallOpts) 274 | } 275 | 276 | // Decimals is a free data retrieval call binding the contract method 0x313ce567. 277 | // 278 | // Solidity: function decimals() view returns(uint8) 279 | func (_PoWERC20 *PoWERC20Caller) Decimals(opts *bind.CallOpts) (uint8, error) { 280 | var out []interface{} 281 | err := _PoWERC20.contract.Call(opts, &out, "decimals") 282 | 283 | if err != nil { 284 | return *new(uint8), err 285 | } 286 | 287 | out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) 288 | 289 | return out0, err 290 | 291 | } 292 | 293 | // Decimals is a free data retrieval call binding the contract method 0x313ce567. 294 | // 295 | // Solidity: function decimals() view returns(uint8) 296 | func (_PoWERC20 *PoWERC20Session) Decimals() (uint8, error) { 297 | return _PoWERC20.Contract.Decimals(&_PoWERC20.CallOpts) 298 | } 299 | 300 | // Decimals is a free data retrieval call binding the contract method 0x313ce567. 301 | // 302 | // Solidity: function decimals() view returns(uint8) 303 | func (_PoWERC20 *PoWERC20CallerSession) Decimals() (uint8, error) { 304 | return _PoWERC20.Contract.Decimals(&_PoWERC20.CallOpts) 305 | } 306 | 307 | // Difficulty is a free data retrieval call binding the contract method 0x19cae462. 308 | // 309 | // Solidity: function difficulty() view returns(uint256) 310 | func (_PoWERC20 *PoWERC20Caller) Difficulty(opts *bind.CallOpts) (*big.Int, error) { 311 | var out []interface{} 312 | err := _PoWERC20.contract.Call(opts, &out, "difficulty") 313 | 314 | if err != nil { 315 | return *new(*big.Int), err 316 | } 317 | 318 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 319 | 320 | return out0, err 321 | 322 | } 323 | 324 | // Difficulty is a free data retrieval call binding the contract method 0x19cae462. 325 | // 326 | // Solidity: function difficulty() view returns(uint256) 327 | func (_PoWERC20 *PoWERC20Session) Difficulty() (*big.Int, error) { 328 | return _PoWERC20.Contract.Difficulty(&_PoWERC20.CallOpts) 329 | } 330 | 331 | // Difficulty is a free data retrieval call binding the contract method 0x19cae462. 332 | // 333 | // Solidity: function difficulty() view returns(uint256) 334 | func (_PoWERC20 *PoWERC20CallerSession) Difficulty() (*big.Int, error) { 335 | return _PoWERC20.Contract.Difficulty(&_PoWERC20.CallOpts) 336 | } 337 | 338 | // GetLimitPerMint is a free data retrieval call binding the contract method 0xb32e82c0. 339 | // 340 | // Solidity: function getLimitPerMint() view returns(uint256) 341 | func (_PoWERC20 *PoWERC20Caller) GetLimitPerMint(opts *bind.CallOpts) (*big.Int, error) { 342 | var out []interface{} 343 | err := _PoWERC20.contract.Call(opts, &out, "getLimitPerMint") 344 | 345 | if err != nil { 346 | return *new(*big.Int), err 347 | } 348 | 349 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 350 | 351 | return out0, err 352 | 353 | } 354 | 355 | // GetLimitPerMint is a free data retrieval call binding the contract method 0xb32e82c0. 356 | // 357 | // Solidity: function getLimitPerMint() view returns(uint256) 358 | func (_PoWERC20 *PoWERC20Session) GetLimitPerMint() (*big.Int, error) { 359 | return _PoWERC20.Contract.GetLimitPerMint(&_PoWERC20.CallOpts) 360 | } 361 | 362 | // GetLimitPerMint is a free data retrieval call binding the contract method 0xb32e82c0. 363 | // 364 | // Solidity: function getLimitPerMint() view returns(uint256) 365 | func (_PoWERC20 *PoWERC20CallerSession) GetLimitPerMint() (*big.Int, error) { 366 | return _PoWERC20.Contract.GetLimitPerMint(&_PoWERC20.CallOpts) 367 | } 368 | 369 | // GetRemainingSupply is a free data retrieval call binding the contract method 0xe4b7fb73. 370 | // 371 | // Solidity: function getRemainingSupply() view returns(uint256) 372 | func (_PoWERC20 *PoWERC20Caller) GetRemainingSupply(opts *bind.CallOpts) (*big.Int, error) { 373 | var out []interface{} 374 | err := _PoWERC20.contract.Call(opts, &out, "getRemainingSupply") 375 | 376 | if err != nil { 377 | return *new(*big.Int), err 378 | } 379 | 380 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 381 | 382 | return out0, err 383 | 384 | } 385 | 386 | // GetRemainingSupply is a free data retrieval call binding the contract method 0xe4b7fb73. 387 | // 388 | // Solidity: function getRemainingSupply() view returns(uint256) 389 | func (_PoWERC20 *PoWERC20Session) GetRemainingSupply() (*big.Int, error) { 390 | return _PoWERC20.Contract.GetRemainingSupply(&_PoWERC20.CallOpts) 391 | } 392 | 393 | // GetRemainingSupply is a free data retrieval call binding the contract method 0xe4b7fb73. 394 | // 395 | // Solidity: function getRemainingSupply() view returns(uint256) 396 | func (_PoWERC20 *PoWERC20CallerSession) GetRemainingSupply() (*big.Int, error) { 397 | return _PoWERC20.Contract.GetRemainingSupply(&_PoWERC20.CallOpts) 398 | } 399 | 400 | // LimitPerMint is a free data retrieval call binding the contract method 0xe2ce9f51. 401 | // 402 | // Solidity: function limitPerMint() view returns(uint256) 403 | func (_PoWERC20 *PoWERC20Caller) LimitPerMint(opts *bind.CallOpts) (*big.Int, error) { 404 | var out []interface{} 405 | err := _PoWERC20.contract.Call(opts, &out, "limitPerMint") 406 | 407 | if err != nil { 408 | return *new(*big.Int), err 409 | } 410 | 411 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 412 | 413 | return out0, err 414 | 415 | } 416 | 417 | // LimitPerMint is a free data retrieval call binding the contract method 0xe2ce9f51. 418 | // 419 | // Solidity: function limitPerMint() view returns(uint256) 420 | func (_PoWERC20 *PoWERC20Session) LimitPerMint() (*big.Int, error) { 421 | return _PoWERC20.Contract.LimitPerMint(&_PoWERC20.CallOpts) 422 | } 423 | 424 | // LimitPerMint is a free data retrieval call binding the contract method 0xe2ce9f51. 425 | // 426 | // Solidity: function limitPerMint() view returns(uint256) 427 | func (_PoWERC20 *PoWERC20CallerSession) LimitPerMint() (*big.Int, error) { 428 | return _PoWERC20.Contract.LimitPerMint(&_PoWERC20.CallOpts) 429 | } 430 | 431 | // MinedNonces is a free data retrieval call binding the contract method 0x342a252a. 432 | // 433 | // Solidity: function minedNonces(address , uint256 ) view returns(bool) 434 | func (_PoWERC20 *PoWERC20Caller) MinedNonces(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (bool, error) { 435 | var out []interface{} 436 | err := _PoWERC20.contract.Call(opts, &out, "minedNonces", arg0, arg1) 437 | 438 | if err != nil { 439 | return *new(bool), err 440 | } 441 | 442 | out0 := *abi.ConvertType(out[0], new(bool)).(*bool) 443 | 444 | return out0, err 445 | 446 | } 447 | 448 | // MinedNonces is a free data retrieval call binding the contract method 0x342a252a. 449 | // 450 | // Solidity: function minedNonces(address , uint256 ) view returns(bool) 451 | func (_PoWERC20 *PoWERC20Session) MinedNonces(arg0 common.Address, arg1 *big.Int) (bool, error) { 452 | return _PoWERC20.Contract.MinedNonces(&_PoWERC20.CallOpts, arg0, arg1) 453 | } 454 | 455 | // MinedNonces is a free data retrieval call binding the contract method 0x342a252a. 456 | // 457 | // Solidity: function minedNonces(address , uint256 ) view returns(bool) 458 | func (_PoWERC20 *PoWERC20CallerSession) MinedNonces(arg0 common.Address, arg1 *big.Int) (bool, error) { 459 | return _PoWERC20.Contract.MinedNonces(&_PoWERC20.CallOpts, arg0, arg1) 460 | } 461 | 462 | // MiningLimit is a free data retrieval call binding the contract method 0xc2651503. 463 | // 464 | // Solidity: function miningLimit() view returns(uint256) 465 | func (_PoWERC20 *PoWERC20Caller) MiningLimit(opts *bind.CallOpts) (*big.Int, error) { 466 | var out []interface{} 467 | err := _PoWERC20.contract.Call(opts, &out, "miningLimit") 468 | 469 | if err != nil { 470 | return *new(*big.Int), err 471 | } 472 | 473 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 474 | 475 | return out0, err 476 | 477 | } 478 | 479 | // MiningLimit is a free data retrieval call binding the contract method 0xc2651503. 480 | // 481 | // Solidity: function miningLimit() view returns(uint256) 482 | func (_PoWERC20 *PoWERC20Session) MiningLimit() (*big.Int, error) { 483 | return _PoWERC20.Contract.MiningLimit(&_PoWERC20.CallOpts) 484 | } 485 | 486 | // MiningLimit is a free data retrieval call binding the contract method 0xc2651503. 487 | // 488 | // Solidity: function miningLimit() view returns(uint256) 489 | func (_PoWERC20 *PoWERC20CallerSession) MiningLimit() (*big.Int, error) { 490 | return _PoWERC20.Contract.MiningLimit(&_PoWERC20.CallOpts) 491 | } 492 | 493 | // MiningTimes is a free data retrieval call binding the contract method 0x2719881e. 494 | // 495 | // Solidity: function miningTimes(address ) view returns(uint256) 496 | func (_PoWERC20 *PoWERC20Caller) MiningTimes(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { 497 | var out []interface{} 498 | err := _PoWERC20.contract.Call(opts, &out, "miningTimes", arg0) 499 | 500 | if err != nil { 501 | return *new(*big.Int), err 502 | } 503 | 504 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 505 | 506 | return out0, err 507 | 508 | } 509 | 510 | // MiningTimes is a free data retrieval call binding the contract method 0x2719881e. 511 | // 512 | // Solidity: function miningTimes(address ) view returns(uint256) 513 | func (_PoWERC20 *PoWERC20Session) MiningTimes(arg0 common.Address) (*big.Int, error) { 514 | return _PoWERC20.Contract.MiningTimes(&_PoWERC20.CallOpts, arg0) 515 | } 516 | 517 | // MiningTimes is a free data retrieval call binding the contract method 0x2719881e. 518 | // 519 | // Solidity: function miningTimes(address ) view returns(uint256) 520 | func (_PoWERC20 *PoWERC20CallerSession) MiningTimes(arg0 common.Address) (*big.Int, error) { 521 | return _PoWERC20.Contract.MiningTimes(&_PoWERC20.CallOpts, arg0) 522 | } 523 | 524 | // Name is a free data retrieval call binding the contract method 0x06fdde03. 525 | // 526 | // Solidity: function name() view returns(string) 527 | func (_PoWERC20 *PoWERC20Caller) Name(opts *bind.CallOpts) (string, error) { 528 | var out []interface{} 529 | err := _PoWERC20.contract.Call(opts, &out, "name") 530 | 531 | if err != nil { 532 | return *new(string), err 533 | } 534 | 535 | out0 := *abi.ConvertType(out[0], new(string)).(*string) 536 | 537 | return out0, err 538 | 539 | } 540 | 541 | // Name is a free data retrieval call binding the contract method 0x06fdde03. 542 | // 543 | // Solidity: function name() view returns(string) 544 | func (_PoWERC20 *PoWERC20Session) Name() (string, error) { 545 | return _PoWERC20.Contract.Name(&_PoWERC20.CallOpts) 546 | } 547 | 548 | // Name is a free data retrieval call binding the contract method 0x06fdde03. 549 | // 550 | // Solidity: function name() view returns(string) 551 | func (_PoWERC20 *PoWERC20CallerSession) Name() (string, error) { 552 | return _PoWERC20.Contract.Name(&_PoWERC20.CallOpts) 553 | } 554 | 555 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 556 | // 557 | // Solidity: function symbol() view returns(string) 558 | func (_PoWERC20 *PoWERC20Caller) Symbol(opts *bind.CallOpts) (string, error) { 559 | var out []interface{} 560 | err := _PoWERC20.contract.Call(opts, &out, "symbol") 561 | 562 | if err != nil { 563 | return *new(string), err 564 | } 565 | 566 | out0 := *abi.ConvertType(out[0], new(string)).(*string) 567 | 568 | return out0, err 569 | 570 | } 571 | 572 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 573 | // 574 | // Solidity: function symbol() view returns(string) 575 | func (_PoWERC20 *PoWERC20Session) Symbol() (string, error) { 576 | return _PoWERC20.Contract.Symbol(&_PoWERC20.CallOpts) 577 | } 578 | 579 | // Symbol is a free data retrieval call binding the contract method 0x95d89b41. 580 | // 581 | // Solidity: function symbol() view returns(string) 582 | func (_PoWERC20 *PoWERC20CallerSession) Symbol() (string, error) { 583 | return _PoWERC20.Contract.Symbol(&_PoWERC20.CallOpts) 584 | } 585 | 586 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 587 | // 588 | // Solidity: function totalSupply() view returns(uint256) 589 | func (_PoWERC20 *PoWERC20Caller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { 590 | var out []interface{} 591 | err := _PoWERC20.contract.Call(opts, &out, "totalSupply") 592 | 593 | if err != nil { 594 | return *new(*big.Int), err 595 | } 596 | 597 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 598 | 599 | return out0, err 600 | 601 | } 602 | 603 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 604 | // 605 | // Solidity: function totalSupply() view returns(uint256) 606 | func (_PoWERC20 *PoWERC20Session) TotalSupply() (*big.Int, error) { 607 | return _PoWERC20.Contract.TotalSupply(&_PoWERC20.CallOpts) 608 | } 609 | 610 | // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. 611 | // 612 | // Solidity: function totalSupply() view returns(uint256) 613 | func (_PoWERC20 *PoWERC20CallerSession) TotalSupply() (*big.Int, error) { 614 | return _PoWERC20.Contract.TotalSupply(&_PoWERC20.CallOpts) 615 | } 616 | 617 | // TotalSupplyCap is a free data retrieval call binding the contract method 0xbb102aea. 618 | // 619 | // Solidity: function totalSupplyCap() view returns(uint256) 620 | func (_PoWERC20 *PoWERC20Caller) TotalSupplyCap(opts *bind.CallOpts) (*big.Int, error) { 621 | var out []interface{} 622 | err := _PoWERC20.contract.Call(opts, &out, "totalSupplyCap") 623 | 624 | if err != nil { 625 | return *new(*big.Int), err 626 | } 627 | 628 | out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) 629 | 630 | return out0, err 631 | 632 | } 633 | 634 | // TotalSupplyCap is a free data retrieval call binding the contract method 0xbb102aea. 635 | // 636 | // Solidity: function totalSupplyCap() view returns(uint256) 637 | func (_PoWERC20 *PoWERC20Session) TotalSupplyCap() (*big.Int, error) { 638 | return _PoWERC20.Contract.TotalSupplyCap(&_PoWERC20.CallOpts) 639 | } 640 | 641 | // TotalSupplyCap is a free data retrieval call binding the contract method 0xbb102aea. 642 | // 643 | // Solidity: function totalSupplyCap() view returns(uint256) 644 | func (_PoWERC20 *PoWERC20CallerSession) TotalSupplyCap() (*big.Int, error) { 645 | return _PoWERC20.Contract.TotalSupplyCap(&_PoWERC20.CallOpts) 646 | } 647 | 648 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 649 | // 650 | // Solidity: function approve(address spender, uint256 value) returns(bool) 651 | func (_PoWERC20 *PoWERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) { 652 | return _PoWERC20.contract.Transact(opts, "approve", spender, value) 653 | } 654 | 655 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 656 | // 657 | // Solidity: function approve(address spender, uint256 value) returns(bool) 658 | func (_PoWERC20 *PoWERC20Session) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { 659 | return _PoWERC20.Contract.Approve(&_PoWERC20.TransactOpts, spender, value) 660 | } 661 | 662 | // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. 663 | // 664 | // Solidity: function approve(address spender, uint256 value) returns(bool) 665 | func (_PoWERC20 *PoWERC20TransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { 666 | return _PoWERC20.Contract.Approve(&_PoWERC20.TransactOpts, spender, value) 667 | } 668 | 669 | // Mine is a paid mutator transaction binding the contract method 0x4d474898. 670 | // 671 | // Solidity: function mine(uint256 nonce) returns() 672 | func (_PoWERC20 *PoWERC20Transactor) Mine(opts *bind.TransactOpts, nonce *big.Int) (*types.Transaction, error) { 673 | return _PoWERC20.contract.Transact(opts, "mine", nonce) 674 | } 675 | 676 | // Mine is a paid mutator transaction binding the contract method 0x4d474898. 677 | // 678 | // Solidity: function mine(uint256 nonce) returns() 679 | func (_PoWERC20 *PoWERC20Session) Mine(nonce *big.Int) (*types.Transaction, error) { 680 | return _PoWERC20.Contract.Mine(&_PoWERC20.TransactOpts, nonce) 681 | } 682 | 683 | // Mine is a paid mutator transaction binding the contract method 0x4d474898. 684 | // 685 | // Solidity: function mine(uint256 nonce) returns() 686 | func (_PoWERC20 *PoWERC20TransactorSession) Mine(nonce *big.Int) (*types.Transaction, error) { 687 | return _PoWERC20.Contract.Mine(&_PoWERC20.TransactOpts, nonce) 688 | } 689 | 690 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 691 | // 692 | // Solidity: function transfer(address to, uint256 amount) returns(bool) 693 | func (_PoWERC20 *PoWERC20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { 694 | return _PoWERC20.contract.Transact(opts, "transfer", to, amount) 695 | } 696 | 697 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 698 | // 699 | // Solidity: function transfer(address to, uint256 amount) returns(bool) 700 | func (_PoWERC20 *PoWERC20Session) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { 701 | return _PoWERC20.Contract.Transfer(&_PoWERC20.TransactOpts, to, amount) 702 | } 703 | 704 | // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. 705 | // 706 | // Solidity: function transfer(address to, uint256 amount) returns(bool) 707 | func (_PoWERC20 *PoWERC20TransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { 708 | return _PoWERC20.Contract.Transfer(&_PoWERC20.TransactOpts, to, amount) 709 | } 710 | 711 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 712 | // 713 | // Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) 714 | func (_PoWERC20 *PoWERC20Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { 715 | return _PoWERC20.contract.Transact(opts, "transferFrom", from, to, value) 716 | } 717 | 718 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 719 | // 720 | // Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) 721 | func (_PoWERC20 *PoWERC20Session) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { 722 | return _PoWERC20.Contract.TransferFrom(&_PoWERC20.TransactOpts, from, to, value) 723 | } 724 | 725 | // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. 726 | // 727 | // Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) 728 | func (_PoWERC20 *PoWERC20TransactorSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { 729 | return _PoWERC20.Contract.TransferFrom(&_PoWERC20.TransactOpts, from, to, value) 730 | } 731 | 732 | // PoWERC20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the PoWERC20 contract. 733 | type PoWERC20ApprovalIterator struct { 734 | Event *PoWERC20Approval // Event containing the contract specifics and raw log 735 | 736 | contract *bind.BoundContract // Generic contract to use for unpacking event data 737 | event string // Event name to use for unpacking event data 738 | 739 | logs chan types.Log // Log channel receiving the found contract events 740 | sub ethereum.Subscription // Subscription for errors, completion and termination 741 | done bool // Whether the subscription completed delivering logs 742 | fail error // Occurred error to stop iteration 743 | } 744 | 745 | // Next advances the iterator to the subsequent event, returning whether there 746 | // are any more events found. In case of a retrieval or parsing error, false is 747 | // returned and Error() can be queried for the exact failure. 748 | func (it *PoWERC20ApprovalIterator) Next() bool { 749 | // If the iterator failed, stop iterating 750 | if it.fail != nil { 751 | return false 752 | } 753 | // If the iterator completed, deliver directly whatever's available 754 | if it.done { 755 | select { 756 | case log := <-it.logs: 757 | it.Event = new(PoWERC20Approval) 758 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 759 | it.fail = err 760 | return false 761 | } 762 | it.Event.Raw = log 763 | return true 764 | 765 | default: 766 | return false 767 | } 768 | } 769 | // Iterator still in progress, wait for either a data or an error event 770 | select { 771 | case log := <-it.logs: 772 | it.Event = new(PoWERC20Approval) 773 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 774 | it.fail = err 775 | return false 776 | } 777 | it.Event.Raw = log 778 | return true 779 | 780 | case err := <-it.sub.Err(): 781 | it.done = true 782 | it.fail = err 783 | return it.Next() 784 | } 785 | } 786 | 787 | // Error returns any retrieval or parsing error occurred during filtering. 788 | func (it *PoWERC20ApprovalIterator) Error() error { 789 | return it.fail 790 | } 791 | 792 | // Close terminates the iteration process, releasing any pending underlying 793 | // resources. 794 | func (it *PoWERC20ApprovalIterator) Close() error { 795 | it.sub.Unsubscribe() 796 | return nil 797 | } 798 | 799 | // PoWERC20Approval represents a Approval event raised by the PoWERC20 contract. 800 | type PoWERC20Approval struct { 801 | Owner common.Address 802 | Spender common.Address 803 | Value *big.Int 804 | Raw types.Log // Blockchain specific contextual infos 805 | } 806 | 807 | // FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 808 | // 809 | // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 810 | func (_PoWERC20 *PoWERC20Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*PoWERC20ApprovalIterator, error) { 811 | 812 | var ownerRule []interface{} 813 | for _, ownerItem := range owner { 814 | ownerRule = append(ownerRule, ownerItem) 815 | } 816 | var spenderRule []interface{} 817 | for _, spenderItem := range spender { 818 | spenderRule = append(spenderRule, spenderItem) 819 | } 820 | 821 | logs, sub, err := _PoWERC20.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) 822 | if err != nil { 823 | return nil, err 824 | } 825 | return &PoWERC20ApprovalIterator{contract: _PoWERC20.contract, event: "Approval", logs: logs, sub: sub}, nil 826 | } 827 | 828 | // WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 829 | // 830 | // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 831 | func (_PoWERC20 *PoWERC20Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *PoWERC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error) { 832 | 833 | var ownerRule []interface{} 834 | for _, ownerItem := range owner { 835 | ownerRule = append(ownerRule, ownerItem) 836 | } 837 | var spenderRule []interface{} 838 | for _, spenderItem := range spender { 839 | spenderRule = append(spenderRule, spenderItem) 840 | } 841 | 842 | logs, sub, err := _PoWERC20.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) 843 | if err != nil { 844 | return nil, err 845 | } 846 | return event.NewSubscription(func(quit <-chan struct{}) error { 847 | defer sub.Unsubscribe() 848 | for { 849 | select { 850 | case log := <-logs: 851 | // New log arrived, parse the event and forward to the user 852 | event := new(PoWERC20Approval) 853 | if err := _PoWERC20.contract.UnpackLog(event, "Approval", log); err != nil { 854 | return err 855 | } 856 | event.Raw = log 857 | 858 | select { 859 | case sink <- event: 860 | case err := <-sub.Err(): 861 | return err 862 | case <-quit: 863 | return nil 864 | } 865 | case err := <-sub.Err(): 866 | return err 867 | case <-quit: 868 | return nil 869 | } 870 | } 871 | }), nil 872 | } 873 | 874 | // ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. 875 | // 876 | // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) 877 | func (_PoWERC20 *PoWERC20Filterer) ParseApproval(log types.Log) (*PoWERC20Approval, error) { 878 | event := new(PoWERC20Approval) 879 | if err := _PoWERC20.contract.UnpackLog(event, "Approval", log); err != nil { 880 | return nil, err 881 | } 882 | event.Raw = log 883 | return event, nil 884 | } 885 | 886 | // PoWERC20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the PoWERC20 contract. 887 | type PoWERC20TransferIterator struct { 888 | Event *PoWERC20Transfer // Event containing the contract specifics and raw log 889 | 890 | contract *bind.BoundContract // Generic contract to use for unpacking event data 891 | event string // Event name to use for unpacking event data 892 | 893 | logs chan types.Log // Log channel receiving the found contract events 894 | sub ethereum.Subscription // Subscription for errors, completion and termination 895 | done bool // Whether the subscription completed delivering logs 896 | fail error // Occurred error to stop iteration 897 | } 898 | 899 | // Next advances the iterator to the subsequent event, returning whether there 900 | // are any more events found. In case of a retrieval or parsing error, false is 901 | // returned and Error() can be queried for the exact failure. 902 | func (it *PoWERC20TransferIterator) Next() bool { 903 | // If the iterator failed, stop iterating 904 | if it.fail != nil { 905 | return false 906 | } 907 | // If the iterator completed, deliver directly whatever's available 908 | if it.done { 909 | select { 910 | case log := <-it.logs: 911 | it.Event = new(PoWERC20Transfer) 912 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 913 | it.fail = err 914 | return false 915 | } 916 | it.Event.Raw = log 917 | return true 918 | 919 | default: 920 | return false 921 | } 922 | } 923 | // Iterator still in progress, wait for either a data or an error event 924 | select { 925 | case log := <-it.logs: 926 | it.Event = new(PoWERC20Transfer) 927 | if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { 928 | it.fail = err 929 | return false 930 | } 931 | it.Event.Raw = log 932 | return true 933 | 934 | case err := <-it.sub.Err(): 935 | it.done = true 936 | it.fail = err 937 | return it.Next() 938 | } 939 | } 940 | 941 | // Error returns any retrieval or parsing error occurred during filtering. 942 | func (it *PoWERC20TransferIterator) Error() error { 943 | return it.fail 944 | } 945 | 946 | // Close terminates the iteration process, releasing any pending underlying 947 | // resources. 948 | func (it *PoWERC20TransferIterator) Close() error { 949 | it.sub.Unsubscribe() 950 | return nil 951 | } 952 | 953 | // PoWERC20Transfer represents a Transfer event raised by the PoWERC20 contract. 954 | type PoWERC20Transfer struct { 955 | From common.Address 956 | To common.Address 957 | Value *big.Int 958 | Raw types.Log // Blockchain specific contextual infos 959 | } 960 | 961 | // FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 962 | // 963 | // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 964 | func (_PoWERC20 *PoWERC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*PoWERC20TransferIterator, error) { 965 | 966 | var fromRule []interface{} 967 | for _, fromItem := range from { 968 | fromRule = append(fromRule, fromItem) 969 | } 970 | var toRule []interface{} 971 | for _, toItem := range to { 972 | toRule = append(toRule, toItem) 973 | } 974 | 975 | logs, sub, err := _PoWERC20.contract.FilterLogs(opts, "Transfer", fromRule, toRule) 976 | if err != nil { 977 | return nil, err 978 | } 979 | return &PoWERC20TransferIterator{contract: _PoWERC20.contract, event: "Transfer", logs: logs, sub: sub}, nil 980 | } 981 | 982 | // WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 983 | // 984 | // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 985 | func (_PoWERC20 *PoWERC20Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *PoWERC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error) { 986 | 987 | var fromRule []interface{} 988 | for _, fromItem := range from { 989 | fromRule = append(fromRule, fromItem) 990 | } 991 | var toRule []interface{} 992 | for _, toItem := range to { 993 | toRule = append(toRule, toItem) 994 | } 995 | 996 | logs, sub, err := _PoWERC20.contract.WatchLogs(opts, "Transfer", fromRule, toRule) 997 | if err != nil { 998 | return nil, err 999 | } 1000 | return event.NewSubscription(func(quit <-chan struct{}) error { 1001 | defer sub.Unsubscribe() 1002 | for { 1003 | select { 1004 | case log := <-logs: 1005 | // New log arrived, parse the event and forward to the user 1006 | event := new(PoWERC20Transfer) 1007 | if err := _PoWERC20.contract.UnpackLog(event, "Transfer", log); err != nil { 1008 | return err 1009 | } 1010 | event.Raw = log 1011 | 1012 | select { 1013 | case sink <- event: 1014 | case err := <-sub.Err(): 1015 | return err 1016 | case <-quit: 1017 | return nil 1018 | } 1019 | case err := <-sub.Err(): 1020 | return err 1021 | case <-quit: 1022 | return nil 1023 | } 1024 | } 1025 | }), nil 1026 | } 1027 | 1028 | // ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. 1029 | // 1030 | // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) 1031 | func (_PoWERC20 *PoWERC20Filterer) ParseTransfer(log types.Log) (*PoWERC20Transfer, error) { 1032 | event := new(PoWERC20Transfer) 1033 | if err := _PoWERC20.contract.UnpackLog(event, "Transfer", log); err != nil { 1034 | return nil, err 1035 | } 1036 | event.Raw = log 1037 | return event, nil 1038 | } 1039 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module Powerc20Worker 2 | 3 | go 1.21.4 4 | 5 | require ( 6 | github.com/ethereum/go-ethereum v1.13.5 7 | github.com/fatih/color v1.16.0 8 | github.com/gosuri/uilive v0.0.4 9 | github.com/sirupsen/logrus v1.9.3 10 | ) 11 | 12 | require ( 13 | github.com/Microsoft/go-winio v0.6.1 // indirect 14 | github.com/StackExchange/wmi v1.2.1 // indirect 15 | github.com/bits-and-blooms/bitset v1.7.0 // indirect 16 | github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect 17 | github.com/consensys/bavard v0.1.13 // indirect 18 | github.com/consensys/gnark-crypto v0.12.1 // indirect 19 | github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect 20 | github.com/deckarep/golang-set/v2 v2.1.0 // indirect 21 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect 22 | github.com/ethereum/c-kzg-4844 v0.4.0 // indirect 23 | github.com/fsnotify/fsnotify v1.6.0 // indirect 24 | github.com/go-ole/go-ole v1.2.5 // indirect 25 | github.com/go-stack/stack v1.8.1 // indirect 26 | github.com/google/uuid v1.3.0 // indirect 27 | github.com/gorilla/websocket v1.4.2 // indirect 28 | github.com/holiman/uint256 v1.2.3 // indirect 29 | github.com/mattn/go-colorable v0.1.13 // indirect 30 | github.com/mattn/go-isatty v0.0.20 // indirect 31 | github.com/mmcloughlin/addchain v0.4.0 // indirect 32 | github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect 33 | github.com/supranational/blst v0.3.11 // indirect 34 | github.com/tklauser/go-sysconf v0.3.12 // indirect 35 | github.com/tklauser/numcpus v0.6.1 // indirect 36 | golang.org/x/crypto v0.14.0 // indirect 37 | golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect 38 | golang.org/x/mod v0.12.0 // indirect 39 | golang.org/x/sync v0.3.0 // indirect 40 | golang.org/x/sys v0.14.0 // indirect 41 | golang.org/x/tools v0.13.0 // indirect 42 | rsc.io/tmplfunc v0.0.3 // indirect 43 | ) 44 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= 2 | github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= 3 | github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= 4 | github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= 5 | github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= 6 | github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= 7 | github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= 8 | github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= 9 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 10 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 11 | github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= 12 | github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= 13 | github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= 14 | github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= 15 | github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= 16 | github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= 17 | github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= 18 | github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= 19 | github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= 20 | github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 21 | github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= 22 | github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= 23 | github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= 24 | github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= 25 | github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 h1:aPEJyR4rPBvDmeyi+l/FS/VtA00IWvjeFvjen1m1l1A= 26 | github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593/go.mod h1:6hk1eMY/u5t+Cf18q5lFMUA1Rc+Sm5I6Ra1QuPyxXCo= 27 | github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= 28 | github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= 29 | github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= 30 | github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= 31 | github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= 32 | github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= 33 | github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= 34 | github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= 35 | github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= 36 | github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= 37 | github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= 38 | github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 39 | github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= 40 | github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= 41 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 42 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 43 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 44 | github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= 45 | github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= 46 | github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= 47 | github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= 48 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= 49 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= 50 | github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= 51 | github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= 52 | github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= 53 | github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= 54 | github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= 55 | github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= 56 | github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= 57 | github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= 58 | github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= 59 | github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= 60 | github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= 61 | github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= 62 | github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= 63 | github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= 64 | github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= 65 | github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= 66 | github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= 67 | github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= 68 | github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 69 | github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 70 | github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= 71 | github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 72 | github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= 73 | github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 74 | github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= 75 | github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 76 | github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= 77 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 78 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 79 | github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= 80 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 81 | github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY= 82 | github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI= 83 | github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= 84 | github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= 85 | github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= 86 | github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= 87 | github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= 88 | github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= 89 | github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= 90 | github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= 91 | github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= 92 | github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= 93 | github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= 94 | github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= 95 | github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= 96 | github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= 97 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 98 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 99 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 100 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 101 | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 102 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 103 | github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= 104 | github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= 105 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= 106 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 107 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 108 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 109 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 110 | github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= 111 | github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 112 | github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= 113 | github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= 114 | github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= 115 | github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 116 | github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= 117 | github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= 118 | github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= 119 | github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= 120 | github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= 121 | github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= 122 | github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= 123 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 124 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 125 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 126 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 127 | github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= 128 | github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= 129 | github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a h1:CmF68hwI0XsOQ5UwlBopMi2Ow4Pbg32akc4KIVCOm+Y= 130 | github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= 131 | github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= 132 | github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= 133 | github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= 134 | github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= 135 | github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= 136 | github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 137 | github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= 138 | github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= 139 | github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= 140 | github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= 141 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 142 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 143 | github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= 144 | github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= 145 | github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= 146 | github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 147 | github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= 148 | github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= 149 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 150 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 151 | github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= 152 | github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 153 | github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= 154 | github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= 155 | github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= 156 | github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= 157 | github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= 158 | github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= 159 | github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= 160 | github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= 161 | github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= 162 | github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= 163 | github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= 164 | github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= 165 | github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= 166 | github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= 167 | golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= 168 | golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= 169 | golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= 170 | golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= 171 | golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= 172 | golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 173 | golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= 174 | golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 175 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 176 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 177 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 178 | golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 179 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 180 | golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 181 | golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 182 | golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= 183 | golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 184 | golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= 185 | golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= 186 | golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= 187 | golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 188 | golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= 189 | golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= 190 | google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= 191 | google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 192 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 193 | gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= 194 | gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= 195 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 196 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 197 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 198 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 199 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 200 | rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= 201 | rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= 202 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "crypto/rand" 6 | "flag" 7 | "fmt" 8 | "math/big" 9 | "sync" 10 | "time" 11 | 12 | "Powerc20Worker/abi" 13 | 14 | "github.com/ethereum/go-ethereum/accounts/abi/bind" 15 | "github.com/ethereum/go-ethereum/common" 16 | "github.com/ethereum/go-ethereum/crypto" 17 | "github.com/ethereum/go-ethereum/ethclient" 18 | "github.com/fatih/color" 19 | "github.com/gosuri/uilive" 20 | "github.com/sirupsen/logrus" 21 | ) 22 | 23 | var ( 24 | infuraURL = "https://rpc.ankr.com/eth" 25 | privateKey string 26 | contractAddress string 27 | workerCount int 28 | logger = logrus.New() 29 | ) 30 | 31 | func init() { 32 | flag.StringVar(&privateKey, "privateKey", "", "Private key for the Ethereum account") 33 | flag.StringVar(&contractAddress, "contractAddress", "0xca9b78435Be8267922E7Ac5cDE70401e7502c9cc", "Address of the Ethereum contract") 34 | flag.IntVar(&workerCount, "workerCount", 10, "Number of concurrent mining workers") 35 | 36 | logger.SetFormatter(&logrus.TextFormatter{ 37 | FullTimestamp: true, 38 | TimestampFormat: "2006-01-02 15:04:05", 39 | }) 40 | } 41 | 42 | func mineWorker(ctx context.Context, wg *sync.WaitGroup, contract *abi.PoWERC20, fromAddress common.Address, client *ethclient.Client, auth *bind.TransactOpts, resultChan chan<- *big.Int, errorChan chan<- error, challenge *big.Int, target *big.Int, hashCountChan chan<- int) { 43 | defer wg.Done() 44 | 45 | var nonce *big.Int 46 | var err error 47 | 48 | for { 49 | select { 50 | case <-ctx.Done(): 51 | return 52 | default: 53 | nonce, err = rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), 256)) 54 | if err != nil { 55 | errorChan <- fmt.Errorf("failed to generate random nonce: %v", err) 56 | return 57 | } 58 | 59 | noncePadded := common.LeftPadBytes(nonce.Bytes(), 32) 60 | challengePadded := common.LeftPadBytes(challenge.Bytes(), 32) 61 | addressBytes := fromAddress.Bytes() 62 | data := append(challengePadded, append(addressBytes, noncePadded...)...) 63 | hash := crypto.Keccak256Hash(data) 64 | if hash.Big().Cmp(target) == -1 { 65 | resultChan <- nonce 66 | return 67 | } 68 | hashCountChan <- 1 69 | 70 | } 71 | } 72 | } 73 | 74 | func main() { 75 | banner := ` 76 | // ____ __ _______ ____ ____ ____ ___ __ __ _ 77 | // | _ \ __\ \ / / ____| _ \ / ___|___ \ / _ \ | \/ (_)_ __ ___ _ __ 78 | // | |_) / _ \ \ /\ / /| _| | |_) | | __) | | | | | |\/| | | '_ \ / _ \ '__| 79 | // | __/ (_) \ V V / | |___| _ <| |___ / __/| |_| | | | | | | | | | __/ | 80 | // |_| \___/ \_/\_/ |_____|_| \_\\____|_____|\___/ |_| |_|_|_| |_|\___|_| 81 | ` 82 | fmt.Println(banner) 83 | flag.Parse() 84 | writer := uilive.New() 85 | 86 | writer.Start() 87 | defer writer.Stop() 88 | 89 | logger.Info(color.GreenString("Establishing connection with Ethereum client...")) 90 | client, err := ethclient.Dial(infuraURL) 91 | if err != nil { 92 | logger.Fatalf("Failed to connect to the Ethereum client: %v", err) 93 | } 94 | logger.Info(color.GreenString("Successfully connected to Ethereum client.")) 95 | privateKeyECDSA, err := crypto.HexToECDSA(privateKey) 96 | if err != nil { 97 | logger.Fatalf("Error in parsing private key: %v", err) 98 | } 99 | 100 | chainID, err := client.NetworkID(context.Background()) 101 | if err != nil { 102 | logger.Fatalf("Failed to get chainID: %v", err) 103 | } 104 | logger.Infof(color.GreenString("Successfully connected to Ethereum network with Chain ID: %v"), chainID) 105 | 106 | auth, err := bind.NewKeyedTransactorWithChainID(privateKeyECDSA, chainID) 107 | if err != nil { 108 | logger.Fatalf("Failed to create transactor: %v", err) 109 | } 110 | 111 | contractAddr := common.HexToAddress(contractAddress) 112 | contract, err := abi.NewPoWERC20(contractAddr, client) 113 | if err != nil { 114 | logger.Fatalf("Failed to instantiate a Token contract: %v", err) 115 | } 116 | logger.Info(color.GreenString("PoWERC20 token contract successfully instantiated.")) 117 | 118 | contractName, err := contract.Name(nil) 119 | if err != nil { 120 | logger.Fatalf("Failed to get contract name: %v", err) 121 | } 122 | logger.Infof(color.GreenString("Contract Name: %s"), color.RedString(contractName)) 123 | 124 | challenge, err := contract.Challenge(nil) 125 | if err != nil { 126 | logger.Fatalf("Failed to get challenge: %v", err) 127 | } 128 | logger.Infof(color.GreenString("Current mining challenge number: %d"), challenge) 129 | 130 | difficulty, err := contract.Difficulty(nil) 131 | if err != nil { 132 | logger.Fatalf("Failed to get difficulty: %v", err) 133 | } 134 | logger.Infof(color.GreenString("Current mining difficulty level: %d"), difficulty) 135 | 136 | difficultyUint := uint(difficulty.Uint64()) 137 | target := new(big.Int).Lsh(big.NewInt(1), 256-difficultyUint) 138 | logger.Infof(color.GreenString("Target number is: %d"), target) 139 | 140 | resultChan := make(chan *big.Int) 141 | errorChan := make(chan error) 142 | ctx, cancel := context.WithCancel(context.Background()) 143 | defer cancel() 144 | 145 | logger.Info(color.YellowString("Mining workers started...")) 146 | 147 | hashCountChan := make(chan int) 148 | totalHashCount := 0 149 | ticker := time.NewTicker(1 * time.Second) 150 | 151 | go func() { 152 | for { 153 | select { 154 | case <-ticker.C: 155 | timestamp := time.Now().Format("2006-01-02 15:04:05") 156 | hashesPerSecond := float64(totalHashCount) / 1000.0 157 | fmt.Fprintf(writer, "%s[%s] %s\n", color.BlueString("Mining"), timestamp, color.GreenString("Total hashes per second: %8.2f K/s", hashesPerSecond)) 158 | totalHashCount = 0 159 | case count := <-hashCountChan: 160 | totalHashCount += count 161 | } 162 | } 163 | }() 164 | 165 | var wg sync.WaitGroup 166 | for i := 0; i < workerCount; i++ { 167 | wg.Add(1) 168 | go mineWorker(ctx, &wg, contract, auth.From, client, auth, resultChan, errorChan, challenge, target, hashCountChan) 169 | } 170 | 171 | select { 172 | case nonce := <-resultChan: 173 | ticker.Stop() 174 | cancel() 175 | wg.Wait() 176 | logger.Infof(color.GreenString("Successfully discovered a valid nonce: %d"), nonce) 177 | logger.Info(color.YellowString("Submitting mining transaction with nonce...")) 178 | tx, err := contract.Mine(auth, nonce) 179 | if err != nil { 180 | logger.Fatalf("Failed to submit mine transaction: %v", err) 181 | } 182 | receipt, err := bind.WaitMined(context.Background(), client, tx) 183 | if err != nil { 184 | logger.Fatalf("Failed to mine the transaction: %v", err) 185 | } 186 | logger.Infof(color.GreenString("Mining transaction successfully confirmed, Transaction Hash: %s"), color.CyanString(receipt.TxHash.Hex())) 187 | 188 | case err := <-errorChan: 189 | cancel() 190 | wg.Wait() 191 | logger.Fatalf("Mining operation failed due to an error: %v", err) 192 | } 193 | logger.Info(color.GreenString("Mining process successfully completed")) 194 | } 195 | 196 | --------------------------------------------------------------------------------