Documentation ¶
Index ¶
- Constants
- Variables
- func DeepHash(data []any) [48]byte
- type Base64String
- func (self Base64String) Base64() string
- func (self Base64String) Bytes() []byte
- func (self *Base64String) Decode(s string) error
- func (self Base64String) Head(i int) []byte
- func (self Base64String) MarshalJSON() (out []byte, err error)
- func (self *Base64String) MarshalTo(buf []byte) (n int, err error)
- func (self *Base64String) Scan(src interface{}) error
- func (self Base64String) Size() int
- func (self *Base64String) Unmarshal(buf []byte) error
- func (self *Base64String) UnmarshalJSON(data []byte) error
- func (self Base64String) Value() (driver.Value, error)
- type BaseClient
- type BigInt
- type Block
- type Chunk
- type ChunkData
- type Chunks
- type Client
- func (self *Client) CheckPeerConnection(ctx context.Context, peer string) (out *NetworkInfo, duration time.Duration, err error)
- func (self *Client) GetBlockByHash(ctx context.Context, hash string) (out *Block, resp *resty.Response, err error)
- func (self *Client) GetBlockByHeight(ctx context.Context, height int64) (out *Block, resp *resty.Response, err error)
- func (self *Client) GetChunks(ctx context.Context, tx *Transaction) (out bytes.Buffer, err error)
- func (self *Client) GetNetworkInfo(ctx context.Context) (out *NetworkInfo, err error)
- func (self *Client) GetPeerList(ctx context.Context) (out []string, err error)
- func (self *Client) GetTransactionById(ctx context.Context, id string) (out *Transaction, err error)
- func (self *Client) GetTransactionDataById(ctx context.Context, tx *Transaction) (out bytes.Buffer, err error)
- func (self *Client) GetTransactionOffsetInfo(ctx context.Context, id string) (out *OffsetInfo, err error)
- func (self *Client) WithTagValidator(v func(*Tag) error) *Client
- type DoubleSigningProof
- type Encoder
- func (self Encoder) Base64() string
- func (self Encoder) RawWrite(val any)
- func (self Encoder) RawWriteBase64StringSlice(val []Base64String)
- func (self Encoder) RawWriteSize(val any, sizeBytes int)
- func (self Encoder) RawWriteUint64(val uint64)
- func (self Encoder) Trim(val []byte) []byte
- func (self Encoder) Write(val any, sizeBytes int)
- func (self Encoder) WriteBase64StringSlice(bins []Base64String, lenBytes, elemSizeBytes int)
- func (self Encoder) WriteBigInt(val BigInt, sizeBytes int)
- func (self Encoder) WriteBuffer(val []byte, sizeBytes int)
- func (self Encoder) WriteSlice(val any, lenBytes, elemSizeBytes int)
- func (self Encoder) WriteSliceAny(bins []any, lenBytes, elemSizeBytes int)
- func (self Encoder) WriteSliceByte(bins [][]byte, lenBytes, elemSizeBytes int)
- func (self Encoder) WriteUint(val uint, sizeBytes int)
- func (self Encoder) WriteUint16(val uint16, sizeBytes int)
- func (self Encoder) WriteUint64(val uint64, sizeBytes int)
- func (self Encoder) WriteUint8(val uint8, sizeBytes int)
- type Error
- type Logger
- type NetworkInfo
- type NonceLimiterInfo
- type OffsetInfo
- type POA
- type PeerList
- type Proof
- type RewardAddr
- type Tag
- type Transaction
- func (tx *Transaction) GetTag(name string) (value string, ok bool)
- func (tx Transaction) MarshalJSON() ([]byte, error)
- func (tx Transaction) MarshalTo(buf []byte) (int, error)
- func (tx *Transaction) Size() int
- func (tx *Transaction) Unmarshal(data []byte) error
- func (tx *Transaction) UnmarshalJSON(data []byte) error
- func (tx *Transaction) Verify() (err error)
Constants ¶
const ( HEIGHT_2_5 = int64(812970) HEIGHT_2_6 = int64(1132210) HEIGHT_2_7 = int64(1275480) )
const ( // Setting this flag disables retrying request with peers ContextDisablePeers = value("disablePeers") // Forces the URL of the peer, otherwise the default one is picked ContextForcePeer = value("forcePeer") // CancelFunc = value("cancelFunc") )
Variables ¶
Functions ¶
Types ¶
type Base64String ¶
type Base64String []byte
func (Base64String) Base64 ¶
func (self Base64String) Base64() string
func (Base64String) Bytes ¶
func (self Base64String) Bytes() []byte
func (*Base64String) Decode ¶
func (self *Base64String) Decode(s string) error
func (Base64String) Head ¶
func (self Base64String) Head(i int) []byte
func (Base64String) MarshalJSON ¶
func (self Base64String) MarshalJSON() (out []byte, err error)
func (*Base64String) MarshalTo ¶ added in v0.1.200
func (self *Base64String) MarshalTo(buf []byte) (n int, err error)
func (*Base64String) Scan ¶
func (self *Base64String) Scan(src interface{}) error
func (Base64String) Size ¶ added in v0.1.200
func (self Base64String) Size() int
func (*Base64String) Unmarshal ¶ added in v0.1.200
func (self *Base64String) Unmarshal(buf []byte) error
func (*Base64String) UnmarshalJSON ¶
func (self *Base64String) UnmarshalJSON(data []byte) error
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
func (*BaseClient) CleanupContext ¶
func (self *BaseClient) CleanupContext(ctx context.Context) error
Converts HTTP status to errors
func (*BaseClient) GetCachedPeers ¶ added in v0.1.219
func (self *BaseClient) GetCachedPeers() []string
func (*BaseClient) Request ¶
func (self *BaseClient) Request(ctx context.Context) (*resty.Request, context.CancelFunc)
func (*BaseClient) Reset ¶
func (self *BaseClient) Reset()
func (*BaseClient) SetPeers ¶
func (self *BaseClient) SetPeers(peers []string)
Set the list of potential peers in order they should be used Uses only peers that are proper urls
type Block ¶
type Block struct { MerkleRebaseSupportThreshold BigInt `json:"merkle_rebase_support_threshold"` ChunkHash Base64String `json:"chunk_hash"` Chunk2Hash Base64String `json:"chunk2_hash"` BlockTimeHistoryHash Base64String `json:"block_time_history_hash"` Nonce Base64String `json:"nonce"` PreviousBlock Base64String `json:"previous_block"` Timestamp int64 `json:"timestamp"` LastRetarget int64 `json:"last_retarget"` Diff BigInt `json:"diff"` Height int64 `json:"height"` Hash Base64String `json:"hash"` IndepHash Base64String `json:"indep_hash"` Txs []Base64String `json:"txs"` TxRoot Base64String `json:"tx_root"` TxTree interface{} `json:"tx_tree"` HashList interface{} `json:"hash_list"` HashListMerkle Base64String `json:"hash_list_merkle"` WalletList Base64String `json:"wallet_list"` RewardAddr RewardAddr `json:"reward_addr"` Tags []interface{} `json:"tags"` RewardPool BigInt `json:"reward_pool"` WeaveSize BigInt `json:"weave_size"` BlockSize BigInt `json:"block_size"` CumulativeDiff BigInt `json:"cumulative_diff"` SizeTaggedTxs interface{} `json:"size_tagged_txs"` Poa POA `json:"poa"` UsdToArRate []BigInt `json:"usd_to_ar_rate"` ScheduledUsdToArRate []BigInt `json:"scheduled_usd_to_ar_rate"` Packing25Threshold BigInt `json:"packing_2_5_threshold"` StrictDataSplitThreshold BigInt `json:"strict_data_split_threshold"` // Fields added in v2.6 HashPreimage Base64String `json:"hash_preimage"` RecallByte BigInt `json:"recall_byte"` Reward BigInt `json:"reward"` PreviousSolutionHash Base64String `json:"previous_solution_hash"` PartitionNumber uint64 `json:"partition_number"` NonceLimiterInfo NonceLimiterInfo `json:"nonce_limiter_info"` Poa2 POA `json:"poa2"` RecallByte2 BigInt `json:"recall_byte2"` Signature Base64String `json:"signature"` RewardKey Base64String `json:"reward_key"` PricePerGibMinute BigInt `json:"price_per_gib_minute"` ScheduledPricePerGibMinute BigInt `json:"scheduled_price_per_gib_minute"` RewardHistoryHash Base64String `json:"reward_history_hash"` DebtSupply BigInt `json:"debt_supply"` KryderPlusRateMultiplier BigInt `json:"kryder_plus_rate_multiplier"` KryderPlusRateMultiplierLatch BigInt `json:"kryder_plus_rate_multiplier_latch"` Denomination BigInt `json:"denomination"` RedenominationHeight uint64 `json:"redenomination_height"` DoubleSigningProof DoubleSigningProof `json:"double_signing_proof"` PreviousCumulativeDiff BigInt `json:"previous_cumulative_diff"` }
func (*Block) IsValid_2_5 ¶
func (*Block) IsValid_2_6 ¶
func (*Block) IsValid_2_7 ¶ added in v0.2.40
type ChunkData ¶
type ChunkData struct { Chunk Base64String `json:"chunk"` TxPath string `json:"tx_path"` DataPath string `json:"data_path"` }
type Client ¶
type Client struct { *BaseClient // contains filtered or unexported fields }
func (*Client) CheckPeerConnection ¶
func (*Client) GetBlockByHash ¶ added in v0.2.40
func (*Client) GetBlockByHeight ¶
func (self *Client) GetBlockByHeight(ctx context.Context, height int64) (out *Block, resp *resty.Response, err error)
https://docs.arweave.org/developers/server/http-api#get-block-by-height
func (*Client) GetNetworkInfo ¶
func (self *Client) GetNetworkInfo(ctx context.Context) (out *NetworkInfo, err error)
https://docs.arweave.org/developers/server/http-api#network-info
func (*Client) GetTransactionById ¶
func (self *Client) GetTransactionById(ctx context.Context, id string) (out *Transaction, err error)
https://docs.arweave.org/developers/server/http-api#get-transaction-by-id
func (*Client) GetTransactionDataById ¶
func (self *Client) GetTransactionDataById(ctx context.Context, tx *Transaction) (out bytes.Buffer, err error)
https://docs.arweave.org/developers/server/http-api#get-transaction-field
func (*Client) GetTransactionOffsetInfo ¶
func (self *Client) GetTransactionOffsetInfo(ctx context.Context, id string) (out *OffsetInfo, err error)
https://docs.arweave.org/developers/server/http-api#get-transaction-offset-and-size
type DoubleSigningProof ¶
type DoubleSigningProof struct { Key Base64String `json:"pub_key"` Sig1 Base64String `json:"sig1"` CumulativeDiff1 BigInt `json:"cdiff1"` PreviousCumulativeDiff1 BigInt `json:"prev_cdiff1"` Preimage1 Base64String `json:"preimage1"` Sig2 Base64String `json:"sig2"` CumulativeDiff2 BigInt `json:"cdiff2"` PreviousCumulativeDiff2 BigInt `json:"prev_cdiff2"` Preimage2 Base64String `json:"preimage2"` }
func (DoubleSigningProof) Bytes ¶
func (d DoubleSigningProof) Bytes() []byte
type Encoder ¶
func NewEncoder ¶
func NewEncoder() Encoder
func (Encoder) RawWriteBase64StringSlice ¶
func (self Encoder) RawWriteBase64StringSlice(val []Base64String)
func (Encoder) RawWriteSize ¶
func (Encoder) RawWriteUint64 ¶
Erlang's binary:encode_unsigned
func (Encoder) WriteBase64StringSlice ¶
func (self Encoder) WriteBase64StringSlice(bins []Base64String, lenBytes, elemSizeBytes int)
func (Encoder) WriteBigInt ¶
Erlang's ar_serialize:encode_int but for big int
func (Encoder) WriteBuffer ¶
Erlang's ar_serialize:encode_bin
func (Encoder) WriteSlice ¶
func (Encoder) WriteSliceAny ¶
func (Encoder) WriteSliceByte ¶
func (Encoder) WriteUint16 ¶
func (Encoder) WriteUint64 ¶
Erlang's ar_serialize:encode_int
func (Encoder) WriteUint8 ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Transforms all logs to debug
type NetworkInfo ¶
type NetworkInfo struct { Network string `json:"network"` Version int64 `json:"version"` Release int64 `json:"release"` Height int64 `json:"height"` Current string `json:"current"` Blocks int64 `json:"blocks"` Peers int64 `json:"peers"` QueueLength int64 `json:"queue_length"` NodeStateLatency int64 `json:"node_state_latency"` }
type NonceLimiterInfo ¶
type NonceLimiterInfo struct { Output Base64String `json:"output"` GlobalStepNumber uint64 `json:"global_step_number"` Seed Base64String `json:"seed"` NextSeed Base64String `json:"next_seed"` ZoneUpperBound uint64 `json:"zone_upper_bound"` NextZoneUpperBound uint64 `json:"next_zone_upper_bound"` PrevOutput Base64String `json:"prev_output"` LastStepCheckpoints []Base64String `json:"last_step_checkpoints"` Checkpoints []Base64String `json:"checkpoints"` VdfDifficulty BigInt `json:"vdf_difficulty"` NextVdfDifficulty BigInt `json:"next_vdf_difficulty"` }
type OffsetInfo ¶
type POA ¶
type POA struct { Option string `json:"option"` TxPath Base64String `json:"tx_path"` DataPath Base64String `json:"data_path"` Chunk Base64String `json:"chunk"` }
type RewardAddr ¶
type RewardAddr []byte
func (RewardAddr) Bytes ¶
func (self RewardAddr) Bytes() []byte
func (*RewardAddr) IsUnclaimed ¶
func (self *RewardAddr) IsUnclaimed() bool
func (*RewardAddr) UnmarshalJSON ¶
func (self *RewardAddr) UnmarshalJSON(data []byte) error
type Tag ¶
type Tag struct { Name Base64String `json:"name"` Value Base64String `json:"value"` }
type Transaction ¶
type Transaction struct { Format int `json:"format"` ID Base64String `json:"id"` LastTx Base64String `json:"last_tx"` Owner Base64String `json:"owner"` // utils.Base64Encode(wallet.PubKey.N.Bytes()) Tags []Tag `json:"tags"` Target Base64String `json:"target"` Quantity string `json:"quantity"` Data Base64String `json:"data"` DataSize BigInt `json:"data_size"` DataRoot Base64String `json:"data_root"` Reward string `json:"reward"` Signature Base64String `json:"signature"` // Computed when needed. Chunks *Chunks `json:"-"` }
func (Transaction) MarshalJSON ¶ added in v0.2.26
func (tx Transaction) MarshalJSON() ([]byte, error)
func (Transaction) MarshalTo ¶ added in v0.2.24
func (tx Transaction) MarshalTo(buf []byte) (int, error)
func (*Transaction) Size ¶ added in v0.2.24
func (tx *Transaction) Size() int
func (*Transaction) Unmarshal ¶ added in v0.2.24
func (tx *Transaction) Unmarshal(data []byte) error
func (*Transaction) UnmarshalJSON ¶ added in v0.2.26
func (tx *Transaction) UnmarshalJSON(data []byte) error
func (*Transaction) Verify ¶
func (tx *Transaction) Verify() (err error)
https://docs.arweave.org/developers/server/http-api#transaction-signing Transaction signatures are generated by computing a merkle root of the SHA-384 hashes of transaction fields: format, owner, target, data_root, data_size, quantity, reward, last_tx, tags, then signing the hash. Signatures are RSA-PSS with SHA-256 as the hashing function.