goar

package
v0.0.0-...-6b33018 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: MIT, Apache-2.0 Imports: 30 Imported by: 0

README

goar

Install
go get github.com/Hubmakerlabs/hoover/pkg/arweave/goar
Example
Send AR or Winston
package main

import (
	"fmt"
	"math/big"

	"github.com/Hubmakerlabs/hoover/pkg/arweave/goar"
	"github.com/Hubmakerlabs/hoover/pkg/arweave/goar/types"
)

func main() {
	wallet, err := goar.NewWalletFromPath("./test-keyfile.json",
		"https://arweave.net")
	if err != nil {
		panic(err)
	}

	tx, err := wallet.SendAR(
		// id, err := wallet.SendWinston( 
		big.NewFloat(1.0), // AR amount
	{
		{
			target
		}
	},                     // target address
	[]types.Tag{},
)

	fmt.Println(tx.ID, err)
}

Send Data
tx, err := wallet.SendData(
  []byte("123"), // Data bytes
  []types.Tag{
    types.Tag{
      Name:  "testSendData",
      Value: "123",
    },
  },
)

fmt.Println(id, err) // {{id}}, nil
Send Data SpeedUp

Arweave occasionally experiences congestion, and a low Reward can cause a transaction to fail; use speedUp to accelerate the transaction.

speedUp := int64(50) // means reward = reward * 150%
tx, err := wallet.SendDataSpeedUp(
  []byte("123"), // Data bytes
  []types.Tag{
    types.Tag{
      Name:  "testSendDataSpeedUp",
      Value: "123",
    },
  },speedUp)

fmt.Println(tx.ID, err)
Components
Client
  • GetInfo
  • GetTransactionByID
  • GetTransactionStatus
  • GetTransactionField
  • GetTransactionData
  • GetTransactionPrice
  • GetTransactionAnchor
  • SubmitTransaction
  • Arql(Deprecated)
  • GraphQL
  • GetWalletBalance
  • GetLastTransactionID
  • GetBlockByID
  • GetBlockByHeight
  • BatchSendItemToBundler
  • GetBundle
  • GetTxDataFromPeers
  • BroadcastData
  • GetUnconfirmedTx
  • GetPendingTxIds
  • GetBlockHashList
  • ConcurrentDownloadChunkData

Initialize the instance:

arClient := goar.NewClient("https://arweave.net")

// if your network is not good, you can config http proxy
proxyUrl := "http://127.0.0.1:8001"
arClient := goar.NewClient("https://arweave.net", proxyUrl)
Wallet
  • SendAR
  • SendARSpeedUp
  • SendWinston
  • SendWinstonSpeedUp
  • SendData
  • SendDataSpeedUp
  • SendTransaction
  • CreateAndSignBundleItem
  • SendBundleTxSpeedUp
  • SendBundleTx
  • SendPst

Initialize the instance, use a keyfile.json:

arWallet := goar.NewWalletFromPath("./keyfile.json")

// if your network is not good, you can config http proxy
proxyUrl := "http://127.0.0.1:8001"
arWallet := NewWalletFromPath("./keyfile.json", "https://arweave.net", proxyUrl)
Signer
  • SignTx
  • SignMsg
  • Owner
signer := goar.NewSignerFromPath("./keyfile.json")
Utils

Package for Arweave develop toolkit.

  • Base64Encode
  • Base64Decode
  • Sign
  • Verify
  • DeepHash
  • GenerateChunks
  • ValidatePath
  • OwnerToAddress
  • OwnerToPubKey
  • TagsEncode
  • TagsDecode
  • PrepareChunks
  • GetChunk
  • SignTransaction
  • GetSignatureData
  • VerifyTransaction
  • NewBundle
  • NewBundleItem
  • SubmitItemToBundlr
  • SubmitItemToArSeed
RSA Threshold Cryptography
  • CreateTcKeyPair
  • ThresholdSign
  • AssembleSigShares
  • VerifySigShare

Threshold Signature Usage Guidelines

Create RSA Threshold Cryptography:

bitSize := 512 // If the values are 2048 and 4096, then the generation functions below will perform minute-level times, and we need 4096 bits as the maximum safety level for production environments.
l := 5
k := 3
keyShares, keyMeta, err := goar.CreateTcKeyPair(bitSize, k, l)

New sign instance:

exampleData := []byte("aaabbbcccddd112233") // need sign data
ts, err := goar.NewTcSign(keyMeta, exampleData)

// signer threshold sign
signer01 := keyShares[0]
signedData01, err := ts.ThresholdSign(signer01)

// assemble sign
signedShares := tcrsa.SigShareList{
  signedData01,
  ...
}
signature, err := ts.AssembleSigShares(signedShares)

// verify share sign 
err := ts.VerifySigShare(signer01)
Development
Test
make test

About chunks
  1. First, we use Chunk transactions for all types of transactions in this library, so we only support transactions where format equals 2.
  2. Second, the library already encapsulates a common interface for sending transactions : e.g SendAR; SendData. The user only needs to call this interface to send the transaction and do not need to worry about the usage of chunks.
  3. The third,If the user needs to control the transaction such as breakpoint retransmission and breakpoint continuation operations. Here is how to do it.
chunked uploading advanced options
upload all transaction data

The method of submitting a data transaction is to use chunk uploading. This method will allow larger transaction sizes, resuming a transaction upload if it's interrupted and give progress updates while uploading. Simple example:

arNode := "https://arweave.net"
w, err := goar.NewWalletFromPath("../example/testKey.json", arNode) // your wallet private key
anchor, err := w.Client.GetTransactionAnchor()
if err != nil {
  return
}
data, err := ioutil.ReadFile("./2.3MBPhoto.jpg")
if err != nil {
  return
}

reward, err := w.Client.GetTransactionPrice(data, nil)
if err != nil {
  return
}

tx := &types.Transaction{
  Format:   2,
  Target:   "",
  Quantity: "0",
  Tags:     utils.TagsEncode(tags),
  Data:     utils.Base64Encode(data),
  DataSize: fmt.Sprintf("%d", len(data)),
  Reward:   fmt.Sprintf("%d", reward*(100+speedFactor)/100),
}

tx.LastTx = anchor
tx.Owner = utils.Base64Encode(w.PubKey.N.Bytes())

if err = utils.SignTransaction(tx, w.PubKey, w.Signer.PrvKey); err != nil {
  return
}

id = tx.ID

uploader, err := goar.CreateUploader(w.Client, tx, nil)
if err != nil {
  return
}

err = uploader.Once()
if err != nil {
  return
}
Breakpoint continuingly

You can resume an upload from a saved uploader object, that you have persisted in storage some using json.marshal(uploader) at any stage of the upload. To resume, parse it back into an object and pass it to getUploader() along with the transactions data:

uploaderBuf, err := ioutil.ReadFile("./jsonUploaderFile.json")
lastUploader := &txType.TransactionUploader{}
err = json.Unmarshal(uploaderBuf, lastUploader)
assert.NoError(t, err)

// new uploader object by last time uploader
newUploader, err := txType.CreateUploader(wallet.Client, lastUploader.FormatSerializedUploader(), bigData)
assert.NoError(t, err)
for !newUploader.IsComplete() {
  err := newUploader.UploadChunk()
  assert.NoError(t, err)
}

When resuming the upload, you must provide the same data as the original upload. When you serialize the uploader object with json.marshal() to save it somewhere, it will not include the data.

Breakpoint retransmission

You can also resume an upload from just the transaction ID and data, once it has been mined into a block. This can be useful if you didn't save the uploader somewhere but the upload got interrupted. This will re-upload all of the data from the beginning, since we don't know which parts have been uploaded:

bigData, err := ioutil.ReadFile(filePath)
txId := "myTxId"

// get uploader by txId and post big data by chunks
uploader, err := goar.CreateUploader(wallet.Client, txId, bigData)
assert.NoError(t, err)
assert.NoError(t, uploader.Once())
NOTE: About all chunk transfer full example can be viewed in path ./example/chunks_tx_test.go

About Arweave Bundles
  1. goar implemented creating, editing, reading and verifying bundles tx
  2. This is the ANS-104 standard protocol and refers to the arbundles js-lib implement
Create Bundle Item
signer, err := goar.NewSignerFromPath("./testKey.json") // rsa signer
// or 
signer, err := goether.NewSigner("0x.....") // ecdsa signer

// Create Item
data := []byte("aa bb cc dd")
target := "" // option 
anchor := "" // option
tags := []types.Tags{}{} // option bundle item tags
item01, err := itemSigner.CreateAndSignItem(data, target, anchor, tags)    
// Same as create item
item02
item03
....

assemble bundle and send to arweave network

You can send items directly to the arweave network


items := []types.BundleItem{item01, item02, item03 ...}
bundle, err := utils.NewBundle(items...)

w, err := goar.NewWalletFromPath("./key.json", arNode)

arTxTags := []types.Tags{}{} // option
tx, err := w.SendBundleTx(bd.BundleBinary, arTxtags)

Send Item to Arseeding gateway

Arseeding provides guaranteed data seeding and instant data accessibility

arseedUrl := "https://seed.everpay.io"
currency := "USDC" // used for payment fee currency
resp, err := utils.SubmitItemToArSeed(item01,currency,arseedUrl)
Send Item to Bundler gateway

Bundler provides guaranteed data seeding and instant data accessibility

bundlrUrl := "https://node1.bundlr.network"
resp, err := utils.SubmitItemToBundlr(item01, bundlrUrl)
Verify Bundle Items

// verify
for _, item := range bundle.Items {
  err = utils.VerifyBundleItem(item)
  assert.NoError(t, err)
}

check bundle example

About Arseeding

if you can utils.SubmitItemToArseed(item,currency,arseedUrl) and you will get the following return response

{
    "ItemId": "5rEb7c6OjMQIYjl6P7AJIb4bB9CLMBSxhZ9N7BVbRCk",
    "bundler": "Fkj5J8CDLC9Jif4CzgtbiXJBnwXLSrp5AaIllleH_yY",
    "currency": "USDT",
    "decimals": 6,
    "fee": "701",
    "paymentExpiredTime": 1656044994,
    "expectedBlock": 960751
}

After you transfer 0.000701 USDT to bundler using everpay, arseeding will upload the item to arweave.
For more usage, jump to docs

About Bundlr

if you call utils.SubmitItemToBundlr(item,bundlrUrl) and return panic: send to bundler request failed; http code: 402
means that you have to pay ar to the bundler service address
must use item signature address to transfer funds

how to get bundler service address?
curl --location --request GET 'https://node1.bundlr.network/info'

response:
{
    "version": "0.2.0",
    "addresses": {
        "arweave": "OXcT1sVRSA5eGwt2k6Yuz8-3e3g9WJi5uSE99CWqsBs",
        "ethereum": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "matic": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "bnb": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "avalanche": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "solana": "DHyDV2ZjN3rB6qNGXS48dP5onfbZd3fAEz6C5HJwSqRD",
        "arbitrum": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "boba-eth": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "boba": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "chainlink": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "kyve": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "fantom": "0xb4DE0833771eae55040b698aF5eB06d59E142C82",
        "near": "bundlr1.near",
        "algorand": "DL7ZTTQMTFNXRF3367OTSNAZ3L2X676OJ4GGB3DXMUJ37CCKJ5RJMEO6RI"
    },
    "gateway": "arweave.net"
}

This "addresses" are the bundler service receive address.
You need to transfer a certain amount of token to this address
and wait for 25 blocks to confirm the transaction before you can use the bundler service.

You can also use the following api to query the balance in the bundler service.

curl --location --request GET 'https://node1.bundlr.network/account/balance?address=Ii5wAMlLNz13n26nYY45mcZErwZLjICmYd46GZvn4ck'

response:
{
    "balance": 1000000000
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("Not Found")
	ErrPendingTx    = errors.New("Pending")
	ErrInvalidId    = errors.New("Invalid ArId")
	ErrBadGateway   = errors.New("Bad Gateway")
	ErrRequestLimit = errors.New("Arweave gateway request limit")
)

Functions

func CreateTcKeyPair

func CreateTcKeyPair(bitSize, k, l int) (shares tcrsa.KeyShareList,
	meta *tcrsa.KeyMeta, err error)

CreateTcKeyPair bitSize: Is used to generate key shares with a security level equivalent to a RSA private of that size. l: creates l key shares for a k-threshold signing scheme. k: The generated key shares have a threshold parameter of k

func SignBundleItem

func SignBundleItem(signatureType int, signer interface{},
	item *types.BundleItem) error

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(nodeUrl string, proxyUrl ...string) *Client

func NewTempConn

func NewTempConn() *Client

func (*Client) Arql

func (c *Client) Arql(arql string) (ids []string, err error)

Arql is Deprecated, recommended to use GraphQL

func (*Client) BroadcastData

func (c *Client) BroadcastData(txId string, data []byte, numOfNodes int64,
	peers ...string) error

func (*Client) ConcurrentDownloadChunkData

func (c *Client) ConcurrentDownloadChunkData(id string,
	concurrentNum int) ([]byte, error)

func (*Client) ConcurrentDownloadChunkDataStream

func (c *Client) ConcurrentDownloadChunkDataStream(id string,
	concurrentNum int) (dataFile *os.File, err error)

func (*Client) DataSyncRecord

func (c *Client) DataSyncRecord(endOffset string, intervalsNum int) ([]string,
	error)

DataSyncRecord you can use GET /data_sync_record/<end_offset>/<number_of_intervals> to fetch the first intervals with end offset >= end_offset; set Content-Type: application/json to get the reply in JSON

func (*Client) DownloadChunkData

func (c *Client) DownloadChunkData(id string) ([]byte, error)

func (*Client) DownloadChunkDataStream

func (c *Client) DownloadChunkDataStream(id string) (*os.File, error)

func (*Client) ExistTxData

func (c *Client) ExistTxData(arId string) (bool, error)

func (*Client) GetBlockByHeight

func (c *Client) GetBlockByHeight(height int64) (block *types.Block,
	err error)

func (*Client) GetBlockByID

func (c *Client) GetBlockByID(id string) (block *types.Block, err error)

Block

func (*Client) GetBlockFromPeers

func (c *Client) GetBlockFromPeers(height int64, peers ...string) (*types.Block,
	error)

func (*Client) GetBlockHashList

func (c *Client) GetBlockHashList(from, to int) ([]string, error)

func (*Client) GetBundleItems

func (c *Client) GetBundleItems(bundleInId string,
	itemsIds []string) (items []*types.BundleItem, err error)

func (*Client) GetInfo

func (c *Client) GetInfo() (info *types.NetworkInfo, err error)

func (*Client) GetLastTransactionID

func (c *Client) GetLastTransactionID(address string) (id string, err error)

func (*Client) GetPeers

func (c *Client) GetPeers() ([]string, error)

func (*Client) GetPendingTxIds

func (c *Client) GetPendingTxIds() ([]string, error)

func (*Client) GetTransactionAnchor

func (c *Client) GetTransactionAnchor() (anchor string, err error)

func (*Client) GetTransactionByID

func (c *Client) GetTransactionByID(id string) (tx *types.Transaction,
	err error)

GetTransactionByID status: Pending/Invalid hash/overspend

func (*Client) GetTransactionData

func (c *Client) GetTransactionData(id string, extension ...string) ([]byte,
	error)

func (*Client) GetTransactionDataByGateway

func (c *Client) GetTransactionDataByGateway(id string) (body []byte,
	err error)

GetTransactionDataByGateway

func (*Client) GetTransactionDataStream

func (c *Client) GetTransactionDataStream(id string,
	extension ...string) (*os.File, error)

func (*Client) GetTransactionDataStreamByGateway

func (c *Client) GetTransactionDataStreamByGateway(id string) (*os.File,
	error)

func (*Client) GetTransactionField

func (c *Client) GetTransactionField(id string, field string) (string, error)

func (*Client) GetTransactionPrice

func (c *Client) GetTransactionPrice(dataSize int,
	target *string) (reward int64, err error)

func (*Client) GetTransactionPriceFloat

func (c *Client) GetTransactionPriceFloat(dataSize int,
	target *string) (reward float64, err error)

func (*Client) GetTransactionStatus

func (c *Client) GetTransactionStatus(id string) (*types.TxStatus, error)

GetTransactionStatus

func (*Client) GetTransactionTags

func (c *Client) GetTransactionTags(id string) ([]types.Tag, error)

func (*Client) GetTxDataFromPeers

func (c *Client) GetTxDataFromPeers(txId string, peers ...string) ([]byte,
	error)

func (*Client) GetTxFromPeers

func (c *Client) GetTxFromPeers(arId string,
	peers ...string) (*types.Transaction, error)

func (*Client) GetUnconfirmedTx

func (c *Client) GetUnconfirmedTx(arId string) (*types.Transaction, error)

func (*Client) GetUnconfirmedTxFromPeers

func (c *Client) GetUnconfirmedTxFromPeers(arId string,
	peers ...string) (*types.Transaction, error)

func (*Client) GetWalletBalance

func (c *Client) GetWalletBalance(address string) (arAmount *big.Float,
	err error)

Wallet

func (*Client) GetWalletWinstonBalance

func (c *Client) GetWalletWinstonBalance(address string) (arAmount *big.Int,
	err error)

func (*Client) GraphQL

func (c *Client) GraphQL(query string) ([]byte, error)

func (*Client) SetTempConnUrl

func (c *Client) SetTempConnUrl(url string)

func (*Client) SetTimeout

func (c *Client) SetTimeout(timeout time.Duration)

func (*Client) SubmitChunks

func (c *Client) SubmitChunks(gc *types.GetChunk) (status string, code int,
	err error)

func (*Client) SubmitToWarp

func (c *Client) SubmitToWarp(tx *types.Transaction) ([]byte, error)

func (*Client) SubmitTransaction

func (c *Client) SubmitTransaction(tx *types.Transaction) (status string,
	code int, err error)

type ItemSigner

type ItemSigner struct {
	// contains filtered or unexported fields
}

func NewItemSigner

func NewItemSigner(signer interface{}) (*ItemSigner, error)

func (*ItemSigner) CreateAndSignItem

func (i *ItemSigner) CreateAndSignItem(data []byte, target string,
	anchor string, tags []types.Tag) (types.BundleItem, error)

func (*ItemSigner) CreateAndSignItemStream

func (i *ItemSigner) CreateAndSignItemStream(data io.Reader, target string,
	anchor string, tags []types.Tag) (types.BundleItem, error)

func (*ItemSigner) CreateAndSignNestedItem

func (i *ItemSigner) CreateAndSignNestedItem(target string, anchor string,
	tags []types.Tag, items ...types.BundleItem) (types.BundleItem, error)

type SerializedUploader

type SerializedUploader struct {
	// contains filtered or unexported fields
}

type Signer

type Signer struct {
	Address string
	PubKey  *rsa.PublicKey
	PrvKey  *rsa.PrivateKey
}

func NewSigner

func NewSigner(b []byte) (*Signer, error)

func NewSignerByPrivateKey

func NewSignerByPrivateKey(privateKey *rsa.PrivateKey) *Signer

func NewSignerFromPath

func NewSignerFromPath(path string) (*Signer, error)

func (*Signer) Owner

func (s *Signer) Owner() string

func (*Signer) SignMsg

func (s *Signer) SignMsg(msg []byte) ([]byte, error)

func (*Signer) SignTx

func (s *Signer) SignTx(tx *types.Transaction) error

type TcSign

type TcSign struct {
	// contains filtered or unexported fields
}

func NewTcSign

func NewTcSign(meta *tcrsa.KeyMeta, signData []byte, salt []byte) (*TcSign,
	error)

func (*TcSign) AssembleSigShares

func (ts *TcSign) AssembleSigShares(signedShares tcrsa.SigShareList) ([]byte,
	error)

for server hub AssembleSigShares

func (*TcSign) ThresholdSign

func (ts *TcSign) ThresholdSign(signShare *tcrsa.KeyShare) (*tcrsa.SigShare,
	error)

for signer ThresholdSignTx single share sign tx

func (*TcSign) VerifySigShare

func (ts *TcSign) VerifySigShare(sigShareData []byte) error

VerifySigShare verify share sig

type TransactionUploader

type TransactionUploader struct {
	Client             *Client `json:"-"`
	ChunkIndex         int
	TxPosted           bool
	Transaction        *types.Transaction
	Data               []byte
	DataReader         *os.File
	LastRequestTimeEnd int64
	TotalErrors        int // Not serialized.
	LastResponseStatus int
	LastResponseError  string
}

func CreateUploader

func CreateUploader(api *Client, upload interface{},
	data []byte) (*TransactionUploader, error)

CreateUploader @param upload: Transaction | SerializedUploader | string, @param Data the Data of the Transaction. Required when resuming an upload.

func (*TransactionUploader) ConcurrentOnce

func (tt *TransactionUploader) ConcurrentOnce(ctx context.Context,
	concurrentNum int) error

func (*TransactionUploader) FormatSerializedUploader

func (tt *TransactionUploader) FormatSerializedUploader() *SerializedUploader

func (*TransactionUploader) FromSerialized

func (tt *TransactionUploader) FromSerialized(serialized *SerializedUploader,
	data []byte) (*TransactionUploader, error)

*

  • Reconstructs an upload from its serialized state and data.
  • Checks if data matches the expected data_root. *
  • @param serialized
  • @param data

func (*TransactionUploader) FromTransactionId

func (tt *TransactionUploader) FromTransactionId(id string) (*SerializedUploader,
	error)

*

  • Reconstruct an upload from the tx metadata, ie /tx/<id>. *
  • @param api
  • @param id
  • @param data

func (*TransactionUploader) IsComplete

func (tt *TransactionUploader) IsComplete() bool

func (*TransactionUploader) Once

func (tt *TransactionUploader) Once() (err error)

func (*TransactionUploader) PctComplete

func (tt *TransactionUploader) PctComplete() float64

func (*TransactionUploader) TotalChunks

func (tt *TransactionUploader) TotalChunks() int

func (*TransactionUploader) UploadChunk

func (tt *TransactionUploader) UploadChunk() error

*

  • Uploads the next part of the Transaction.
  • On the first call this posts the Transaction
  • itself and on any subsequent calls uploads the
  • next chunk until it completes.

func (*TransactionUploader) UploadedChunks

func (tt *TransactionUploader) UploadedChunks() int

type Wallet

type Wallet struct {
	Client *Client
	Signer *Signer
}

func NewWallet

func NewWallet(b []byte, clientUrl string, proxyUrl ...string) (w *Wallet,
	err error)

func NewWalletFromPath

func NewWalletFromPath(path string, clientUrl string,
	proxyUrl ...string) (*Wallet, error)

proxyUrl: option

func (*Wallet) Owner

func (w *Wallet) Owner() string

func (*Wallet) SendAR

func (w *Wallet) SendAR(amount *big.Float, target string,
	tags []types.Tag) (types.Transaction, error)

func (*Wallet) SendARSpeedUp

func (w *Wallet) SendARSpeedUp(amount *big.Float, target string,
	tags []types.Tag, speedFactor int64) (types.Transaction, error)

func (*Wallet) SendBundleTx

func (w *Wallet) SendBundleTx(ctx context.Context, concurrentNum int,
	bundleBinary []byte, tags []types.Tag) (types.Transaction, error)

func (*Wallet) SendBundleTxSpeedUp

func (w *Wallet) SendBundleTxSpeedUp(ctx context.Context, concurrentNum int,
	bundleBinary interface{}, tags []types.Tag,
	txSpeed int64) (types.Transaction, error)

func (*Wallet) SendBundleTxStream

func (w *Wallet) SendBundleTxStream(ctx context.Context, concurrentNum int,
	bundleReader *os.File, tags []types.Tag) (types.Transaction, error)

func (*Wallet) SendData

func (w *Wallet) SendData(data []byte, tags []types.Tag) (types.Transaction,
	error)

func (*Wallet) SendDataConcurrentSpeedUp

func (w *Wallet) SendDataConcurrentSpeedUp(ctx context.Context,
	concurrentNum int, data interface{}, tags []types.Tag,
	speedFactor int64) (types.Transaction, error)

func (*Wallet) SendDataSpeedUp

func (w *Wallet) SendDataSpeedUp(data []byte, tags []types.Tag,
	speedFactor int64) (types.Transaction, error)

SendDataSpeedUp set speedFactor for speed up eg: speedFactor = 10, reward = 1.1 * reward

func (*Wallet) SendDataStream

func (w *Wallet) SendDataStream(data *os.File,
	tags []types.Tag) (types.Transaction, error)

func (*Wallet) SendDataStreamSpeedUp

func (w *Wallet) SendDataStreamSpeedUp(data *os.File, tags []types.Tag,
	speedFactor int64) (types.Transaction, error)

func (*Wallet) SendPst

func (w *Wallet) SendPst(contractId string, target string, qty *big.Int,
	customTags []types.Tag, speedFactor int64) (types.Transaction, error)

func (*Wallet) SendTransaction

func (w *Wallet) SendTransaction(tx *types.Transaction) (types.Transaction,
	error)

SendTransaction: if send success, should return pending

func (*Wallet) SendTransactionConcurrent

func (w *Wallet) SendTransactionConcurrent(ctx context.Context,
	concurrentNum int, tx *types.Transaction) (types.Transaction, error)

func (*Wallet) SendWinston

func (w *Wallet) SendWinston(amount *big.Int, target string,
	tags []types.Tag) (types.Transaction, error)

func (*Wallet) SendWinstonSpeedUp

func (w *Wallet) SendWinstonSpeedUp(amount *big.Int, target string,
	tags []types.Tag, speedFactor int64) (types.Transaction, error)

func (*Wallet) WarpTransfer

func (w *Wallet) WarpTransfer(contractId, target string, qty int64) (id string,
	err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL