Bitcoin Forum
May 07, 2024, 06:38:29 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Local / Барахолка / Bitcoin xpub address balance checker (bip32-bip39, bip44) - (p2pkh, p2sh) on: December 03, 2019, 03:20:35 PM
Доброго вам время суток!. Тема для тех кто любит халявные bitcoin, на днях написал checker, который произвольно генерирует mnemonic, под стандарты bip39 и bip44, проверяет xpub адреса есть ли там баланс, в случаи активного баланса  то выводит саму кодовую фразу - (mnemonic), а так же (Private Key), проверенно работает адекватно, но и за слабого интернета чекать практически невозможно.

https://youtu.be/Cke4KDryv0o

https://satoshidisk.com/pay/C8EA1f
Кто желает приобрести пишите Telegram: https://t.me/golangmaster
2  Local / Работа / Ищу работу. golang software engineer on: August 18, 2019, 08:33:28 AM
Ищу работу. golang software engineer, php engineer, vue, nodejs, html layout.

Навыки работы с: sql/nosql: MongoDB, Redis, MySQL, PostgreSQL, LevelDB, Rocksdb.
Навыки работы с: javascript, typescript.

А также многое другое от написания микро сервисов и до телеграмм ботов.

Telegram: @golangmaster
3  Local / Альтернативные криптовалюты / [go-ethereum] Ошибка при при переводе токенов on: October 19, 2018, 07:43:33 PM
Здравствуйте уважаемые кодеры!. Кто работал с (go-ethereum) возможно вы сталкивались с данной ошибкой (Attempting to run transaction which calls a contract function, but recipient address 0xefdb9e216f42424b54eb591ad086f20165830ad7 is not a contract address), значение данной ошибки мне понятно, deploy контракта выполнен, но суть в том что я все делаю по примере https://www.youtube.com/watch?v=-Epg5Ub-fA0&t=17s:

Code:
package main

import (
"context"
"crypto/ecdsa"
"fmt"
"log"
"math/big"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/ethclient"
)

func main() {
client, err := ethclient.Dial("http://127.0.0.1:7545")
if err != nil {
log.Fatal(err)
}

privateKey, err := crypto.HexToECDSA("51b24d0a29940af4b7f346f23b840c4c45d50ab0bb34d821cc41e766fc189016")
if err != nil {
log.Fatal(err)
}

publicKey := privateKey.Public()
publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)
if !ok {
log.Fatal("error casting public key to ECDSA")
}

fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)
nonce, err := client.PendingNonceAt(context.Background(), fromAddress)
if err != nil {
log.Fatal(err)
}

value := big.NewInt(0) // in wei (0 eth)
gasPrice, err := client.SuggestGasPrice(context.Background())
if err != nil {
log.Fatal(err)
}

        // Адрес получателя
toAddress := common.HexToAddress("0xeFDB9E216F42424B54eB591AD086F20165830ad7")

        // Адрес контракта
tokenAddress := common.HexToAddress("0xBACeE245e9a6b1846d225d9D21B1F5E22C374741")

transferFnSignature := []byte("transfer(address,uint256)")
hash := sha3.NewKeccak256()
hash.Write(transferFnSignature)
methodID := hash.Sum(nil)[:4]
fmt.Println(hexutil.Encode(methodID)) // 0xa9059cbb

paddedAddress := common.LeftPadBytes(toAddress.Bytes(), 32)
fmt.Println(hexutil.Encode(paddedAddress))

amount := new(big.Int)
amount.SetString("1000000000000000000000", 10) // 1000 tokens
paddedAmount := common.LeftPadBytes(amount.Bytes(), 32)
fmt.Println(hexutil.Encode(paddedAmount))

var data []byte
data = append(data, methodID...)
data = append(data, paddedAddress...)
data = append(data, paddedAmount...)

gasLimit, err := client.EstimateGas(context.Background(), ethereum.CallMsg{
To:   &toAddress,
Data: data,
})
if err != nil {
log.Fatal(err)
}
fmt.Println(gasLimit)

tx := types.NewTransaction(nonce, tokenAddress, value, gasLimit, gasPrice, data)

chainID, err := client.NetworkID(context.Background())
if err != nil {
log.Fatal(err)
}

signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey)
if err != nil {
log.Fatal(err)
}

err = client.SendTransaction(context.Background(), signedTx)
if err != nil {
log.Fatal(err)
}

fmt.Printf("tx sent: %s", signedTx.Hash().Hex())
}


Эмуляция блокчейна выполнена на Ganache v1.2.2.

Меня беспокоит данный метод (Estimate Gas) лимит на газ выдает мне 0
Code:
	gasLimit, err := client.EstimateGas(context.Background(), ethereum.CallMsg{
To:   &toAddress,
Data: data,
})

Переменные:
privateKey - Приватный ключь
toAddress - Адрес получателя
tokenAddress - Адрес контракта
все данные были взяты с Ganache, но не пойму в чем проблема, Адрес контракта ввожу вверно https://prnt.sc/l8330e

Заранее благодарен за помощь.






Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!