Documentation ¶
Overview ¶
WARNING: not finish
Index ¶
- Constants
- func BigScriptHashToNEOAddress(scriptHash string) string
- func BuildOntologyInvocationTransaction(contract string, method string, args string, gasPrice int, gasLimit int, ...) (string, error)
- func BytesToHex(b []byte) string
- func Ceiling(n int64) int64
- func ClaimONG(endpoint string, gasPrice int, gasLimit int, wif string) (string, error)
- func ConvertByteArrayToBigInt(hexString string) *big.Int
- func DecodeBase58(ba []byte) []byte
- func DecodeBase58WithChecksum(ba []byte) ([]byte, bool)
- func Decrypt(key []byte, encryptedText string) string
- func DeploySmartContractScript(contractInfo SmartContractInfo, wallet Wallet, asset smartcontract.NativeAsset, ...) ([]byte, error)
- func EncodeBase58(ba []byte) []byte
- func EncodeBase58WithChecksum(ba []byte) ([]byte, []byte)
- func Encrypt(key []byte, text string) string
- func GenerateNEP6FromEncryptedKey(walletName, addressLabel, address, encryptedKey string) string
- func GetVarUInt(value int64) []byte
- func Hash160(data []byte) []byte
- func Hash256(b []byte) []byte
- func HexTobytes(hexstring string) (b []byte)
- func Int64ToBytes(n int64) []byte
- func LittleScriptHashToNEOAddress(scriptHash string) string
- func NEOAddressToScriptHashWithEndian(neoAddress string, endian binary.ByteOrder) string
- func NEOAddresstoScriptHashBigEndian(neoAddress string) string
- func NEP2Decrypt(key, passphrase string) (s string, err error)
- func NeonJSTXSerializer(tx NeonJSTransaction) []byte
- func OEP4Transfer(endpoint string, contract string, fromAddress string, toAddress string, ...) (string, error)
- func ONTAddressFromPublicKey(publicKey []byte) string
- func OntologyBuildGetDDO(ontid string) (string, error)
- func OntologyGetBlockCount(endpoint string) (int, error)
- func OntologyGetBlockWithHash(endpoint string, blockHash string) (string, error)
- func OntologyGetBlockWithHeight(endpoint string, blockHeight int) (string, error)
- func OntologyGetRawTransaction(endpoint string, txID string) (string, error)
- func OntologyGetStorage(endpoint string, scriptHash string, key string) (string, error)
- func OntologyGetUnboundONG(endpoint string, address string) (string, error)
- func OntologyInvoke(endpoint string, contract string, method string, args string, gasPrice int, ...) (string, error)
- func OntologyMakeRegister(gasPrice int, gasLimit int, ontidWif string, payerWif string) (string, error)
- func OntologySendPreExecRawTransaction(endpoint string, raw string) (string, error)
- func OntologySendRawTransaction(endpoint string, raw string) (string, error)
- func OntologyTransfer(endpoint string, gasPrice int, gasLimit int, wif string, asset string, ...) (string, error)
- func PublicKeyToNEOAddress(publicKeyBytes []byte) string
- func RecoverFromSharedSecret(first []byte, second []byte) (string, error)
- func ReverseBytes(b []byte) []byte
- func ReverseString(input string) string
- func SerializeTX(jsonString string) []byte
- func ShortenBytes(b []byte) []byte
- func Sign(data []byte, key string) ([]byte, error)
- func Uint32ToBytes(n uint32) []byte
- func VMCodeToNEOAddress(vmCode []byte) string
- func ValidateNEOAddress(address string) bool
- func Verify(publicKey []byte, signature []byte, hash []byte) bool
- func WriteVarUint(w io.Writer, val uint64) error
- type BlockCountResponse
- type FetchSeedRequest
- type HASH160
- type HASH256
- type MultiSig
- type MultiSigInterface
- type NEP2
- type NEP5
- type NEP5Interface
- type NativeAsset
- type NativeAssetInterface
- type NeonJSTransaction
- type NodeList
- type ONTAccount
- type OntologyBalances
- type RawTransaction
- type SeedNodeResponse
- type SharedSecret
- type SimplifiedNEP9
- type SmartCodeEvent
- type SmartContract
- type SmartContractInfo
- type SmartContractInterface
- type VarInt
- type Wallet
Constants ¶
const (
VERSION = "1.3.0"
)
Variables ¶
This section is empty.
Functions ¶
func BigScriptHashToNEOAddress ¶
Convert script hash to NEO address This method takes Big Endian Script hash
func ConvertByteArrayToBigInt ¶
Convert byte array to big int
func DecodeBase58WithChecksum ¶
DecodeBase58WithChecksum 将数据ba进行Base58解码,并且校验后4 bytes是否是前面数据的HASH256 返回的数据移除了最后4 bytes 的 Checksum
func DeploySmartContractScript ¶
func DeploySmartContractScript(contractInfo SmartContractInfo, wallet Wallet, asset smartcontract.NativeAsset, amount float64, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte) ([]byte, error)
func EncodeBase58WithChecksum ¶
EncodeBase58WithChecksum 在数据ba后面添加4 bytes的HASH256的校验数据,然后整体进行Base58编码 同时返回添加4 byte校验数据之后的数据
func GetVarUInt ¶
func LittleScriptHashToNEOAddress ¶
Convert script hash to NEO address This method takes Little Endian Script hash
func NEOAddressToScriptHashWithEndian ¶
Convert NEO address to script hash
func NEP2Decrypt ¶
func NeonJSTXSerializer ¶
func NeonJSTXSerializer(tx NeonJSTransaction) []byte
func OEP4Transfer ¶
func OEP4Transfer(endpoint string, contract string, fromAddress string, toAddress string, amount float64, tokenDecimals int, gasPrice int, gasLimit int, wif string) (string, error)
OEP4Transfer : Transfer OEP4 token
func ONTAddressFromPublicKey ¶
func OntologyBuildGetDDO ¶
func OntologyGetBlockCount ¶
func OntologyGetStorage ¶
func OntologyGetUnboundONG ¶
func OntologyInvoke ¶
func OntologyInvoke(endpoint string, contract string, method string, args string, gasPrice int, gasLimit int, wif string, payer string) (string, error)
OntologyInvoke : Invoke a neovm contract in Ontology
func OntologyMakeRegister ¶
func OntologyTransfer ¶
func PublicKeyToNEOAddress ¶
PublicKeyToNEOAddress ...
func RecoverFromSharedSecret ¶
Recover the secret from shared secrets.
func ReverseBytes ¶
func ReverseString ¶
func SerializeTX ¶
func ShortenBytes ¶
func Uint32ToBytes ¶
Types ¶
type BlockCountResponse ¶
type FetchSeedRequest ¶
type FetchSeedRequest struct { Response *BlockCountResponse URL string }
type HASH160 ¶
type HASH160 []byte
HASH160 is the type of script hash value in neo. Usually used as an account address. The address in string format is Base58 coded script hash with some checksum bytes.
type HASH256 ¶
type HASH256 []byte
Added HASH256 and HASH160 HASH256 the type of hash value in neo. It's a unit256 big number that length 32 byte PublicKey, BlockHash, TransactionHash and other hashes are in HASH256 format
type MultiSig ¶
func (*MultiSig) CreateMultiSigRedeemScript ¶
type MultiSigInterface ¶
type NEP5 ¶
type NEP5 struct { ScriptHash smartcontract.ScriptHash NetworkFeeAmount smartcontract.NetworkFeeAmount //allow users to override the network fee here }
func UseNEP5WithNetworkFee ¶
func UseNEP5WithNetworkFee(scriptHashHex string, networkFeeAmount smartcontract.NetworkFeeAmount) *NEP5
func (*NEP5) MintTokensRawTransaction ¶
func (n *NEP5) MintTokensRawTransaction(wallet Wallet, assetToSend smartcontract.NativeAsset, amount float64, unspent smartcontract.Unspent, remark string) ([]byte, string, error)
func (*NEP5) TransferNEP5RawTransaction ¶
func (n *NEP5) TransferNEP5RawTransaction(wallet Wallet, toAddress smartcontract.NEOAddress, amount float64, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte) ([]byte, string, error)
type NEP5Interface ¶
type NEP5Interface interface { MintTokensRawTransaction(wallet Wallet, assetToSend smartcontract.NativeAsset, amount float64, unspent smartcontract.Unspent, remark string) ([]byte, string, error) TransferNEP5RawTransaction(wallet Wallet, toAddress smartcontract.NEOAddress, amount float64, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte) ([]byte, string, error) }
type NativeAsset ¶
type NativeAsset struct {
NetworkFeeAmount smartcontract.NetworkFeeAmount //allow users to override the network fee here
}
func UseNativeAsset ¶
func UseNativeAsset(networkFeeAmount smartcontract.NetworkFeeAmount) NativeAsset
func (*NativeAsset) GenerateRawTx ¶
func (n *NativeAsset) GenerateRawTx(fromAddress string, asset smartcontract.NativeAsset, amount float64, to smartcontract.NEOAddress, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte) ([]byte, string, error)
func (*NativeAsset) SendNativeAssetRawTransaction ¶
func (n *NativeAsset) SendNativeAssetRawTransaction(wallet Wallet, asset smartcontract.NativeAsset, amount float64, to smartcontract.NEOAddress, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte) ([]byte, string, error)
type NativeAssetInterface ¶
type NativeAssetInterface interface { SendNativeAssetRawTransaction(wallet Wallet, asset smartcontract.NativeAsset, amount float64, to smartcontract.NEOAddress, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte) ([]byte, string, error) GenerateRawTx(fromAddress string, asset smartcontract.NativeAsset, amount float64, to smartcontract.NEOAddress, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte) ([]byte, string, error) }
type NeonJSTransaction ¶
type NeonJSTransaction struct { Sha256 string `json:"sha256"` Hash string `json:"hash"` Inputs []struct { PrevIndex int `json:"prevIndex"` PrevHash string `json:"prevHash"` } `json:"inputs"` Outputs []struct { AssetID string `json:"assetId"` ScriptHash string `json:"scriptHash"` Value interface{} `json:"value"` } `json:"outputs"` Script string `json:"script"` Version int `json:"version"` Type int `json:"type"` Attributes []struct { Usage int `json:"usage"` Data string `json:"data"` } `json:"attributes"` Scripts []interface{} `json:"scripts"` Gas int `json:"gas"` }
type ONTAccount ¶
func ONTAccountFromPrivateKey ¶
func ONTAccountFromPrivateKey(privateKeyBytes []byte) *ONTAccount
func ONTAccountFromWIF ¶
func ONTAccountFromWIF(wif string) *ONTAccount
func ONTCreateAccount ¶
func ONTCreateAccount() *ONTAccount
type OntologyBalances ¶
func OntologyGetBalance ¶
func OntologyGetBalance(endpoint string, address string) (*OntologyBalances, error)
type RawTransaction ¶
type SeedNodeResponse ¶
func SelectBestSeedNode ¶
func SelectBestSeedNode(commaSeparatedURLs string) *SeedNodeResponse
type SharedSecret ¶
type SharedSecret struct {}
Shared Secret with 2 parts.
func GenerateShamirSharedSecret ¶
func GenerateShamirSharedSecret(secret string) (*SharedSecret, error)
Generate Shamir shared secret to SharedSecret struct.
type SimplifiedNEP9 ¶
type SimplifiedNEP9 struct { To string `json:"to"` Asset string `json:"assetID"` Amount float64 `json:"amount"` }
func ParseNEP9URI ¶
func ParseNEP9URI(uri string) (*SimplifiedNEP9, error)
type SmartCodeEvent ¶
func OntologyGetSmartCodeEvent ¶
func OntologyGetSmartCodeEvent(endpoint string, txHash string) (*SmartCodeEvent, error)
type SmartContract ¶
type SmartContract struct { ScriptHash smartcontract.ScriptHash NetworkFeeAmount smartcontract.NetworkFeeAmount //allow users to override the network fee here }
func (*SmartContract) GenerateInvokeFunctionRawTransaction ¶
func (s *SmartContract) GenerateInvokeFunctionRawTransaction(wallet Wallet, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte, operation string, args []interface{}) ([]byte, error)
func (*SmartContract) GenerateInvokeFunctionRawTransactionWithAmountToSend ¶
func (s *SmartContract) GenerateInvokeFunctionRawTransactionWithAmountToSend(wallet Wallet, asset smartcontract.NativeAsset, amount float64, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte, operation string, args []interface{}) ([]byte, error)
type SmartContractInfo ¶
type SmartContractInfo struct { AVMHEX string Name string Version string Author string Email string Description string Properties smartcontract.Properties InputTypes []smartcontract.ParameterType ReturnType smartcontract.ParameterType }
func (*SmartContractInfo) GetScriptHash ¶
func (s *SmartContractInfo) GetScriptHash() string
func (*SmartContractInfo) Serialize ¶
func (s *SmartContractInfo) Serialize() []byte
type SmartContractInterface ¶
type SmartContractInterface interface { //NOTE: these two methods are actually pretty similar in implementation. //the only difference is GenerateInvokeFunctionRawTransactionWithAmountToSend is used to send NEO/GAS to SmartContract //however, I want to keep them separated GenerateInvokeFunctionRawTransaction(wallet Wallet, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte, operation string, args []interface{}) ([]byte, error) GenerateInvokeFunctionRawTransactionWithAmountToSend(wallet Wallet, asset smartcontract.NativeAsset, amount float64, unspent smartcontract.Unspent, attributes map[smartcontract.TransactionAttribute][]byte, operation string, args []interface{}) ([]byte, error) }
func UseSmartContract ¶
func UseSmartContract(scriptHashHex string) SmartContractInterface
func UseSmartContractWithNetworkFee ¶
func UseSmartContractWithNetworkFee(scriptHashHex string, feeAmount smartcontract.NetworkFeeAmount) SmartContractInterface
type VarInt ¶
type VarInt struct {
Value uint64
}
VarInt 变长整数,可以根据表达的值进行编码以节省空间。 最长表示64位无符号整数,通常用于表示数组长度
func ParseVarInt ¶
ParseVarInt parse the serialized bytes of the var int and return VarInt
type Wallet ¶
type Wallet struct { PublicKey []byte PrivateKey []byte Address string WIF string HashedSignature []byte }
func GenerateFromPrivateKey ¶
Generate a wallet from a private key
func GenerateFromWIF ¶
Generate a wallet from a WIF
func NEP2DecryptToWallet ¶
func (*Wallet) ComputeSharedSecret ¶
Compute shared secret using ECDH
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
https://github.com/CityOfZion/neo-go/ https://github.com/CityOfZion/neo-go/
|
https://github.com/CityOfZion/neo-go/ https://github.com/CityOfZion/neo-go/ |
Package rfc6979 is an implementation of RFC 6979's deterministic DSA.
|
Package rfc6979 is an implementation of RFC 6979's deterministic DSA. |
Package sss implements Shamir's Secret Sharing algorithm over GF(2^8).
|
Package sss implements Shamir's Secret Sharing algorithm over GF(2^8). |