- Go SDK For Ontology
- 1. Overview
- 2. How to use?
- 2.1 Block Chain API
- 2.1.1 Get current block height
- 2.1.2 Get current block hash
- 2.1.3 Get block by height
- 2.1.4 Get block by hash
- 2.1.5 Get transaction by transaction hash
- 2.1.6 Get block hash by block height
- 2.1.7 Get block height by transaction hash
- 2.1.8 Get transaction hashes of block by block height
- 2.1.9 Get storage value of smart contract key
- 2.1.10 Get smart contract by contract address
- 2.1.11 Get smart contract event by transaction hash
- 2.1.12 Get all of smart contract events of block by block height
- 2.1.13 Get block merkle proof by transaction hash
- 2.1.14 Get transaction state of transaction pool
- 2.1.15 Get transaction count in transaction pool
- 2.1.16 Get version of Ontology
- 2.1.17 Get network id of Ontology
- 2.1.18 Send transaction to Ontology
- 2.19 Prepare execute transaction
- 2.2 Wallet API
- 2.2.1 Create or Open Wallet
- 2.2.2 Save Wallet
- 2.2.3 New account
- 2.2.4 New default setting account
- 2.2.5 New account from wif private key
- 2.2.5 Delete account
- 2.2.5 Get default account
- 2.2.6 Set default account
- 2.2.7 Get account by address
- 2.2.8 Get account by label
- 2.2.9 Get account by index
- 2.2.10 Get account count of wallet
- 2.2.11 Get default account data
- 2.2.12 Get account data by address
- 2.2.13 Get account data by label
- 2.2.14 Get account data by index
- 2.2.15 Set account label
- 2.2.16 Set signature scheme of account
- 2.2.17 Change account password
- 2.2.18 Import account to wallet
- 2.2.19 Export account to a new wallet
- 2.3 ONT Contract API
- 2.4 ONG Contract API
- 2.4.1 Get balance
- 2.4.2 Transfer
- 2.4.3 Multiple Transfer
- 2.4.4 Approve
- 2.4.5 Approve Balance
- 2.4.6 TransferFrom
- 2.4.7 Withdraw ONG
- 2.4.8 Get unbound ONG
- 2.4.9 Get balance V2
- 2.4.10 Transfer V2
- 2.4.11 Multiple Transfer V2
- 2.4.12 Approve V2
- 2.4.13 Approve Balance V2
- 2.4.14 TransferFrom V2
- 2.4.15 Withdraw ONG V2
- 2.4.16 Get unbound ONG V2
- 2.5 ONT ID API
- 2.5.1 RegID With PublicKey
- 2.5.2 RegID With Controller
- 2.5.3 Revoke ID
- 2.5.4 Revoke ID By Controller
- 2.5.5 Remove Controller
- 2.5.6 RegID With Attributes
- 2.5.7 Add Key
- 2.5.8 Add Key By Index
- 2.5.9 Remove Key
- 2.5.10 Remove Key By Index
- 2.5.11 Set Recovery
- 2.5.12 Update Recovery
- 2.5.13 Remove Recovery
- 2.5.14 AddKey By Controller
- 2.5.15 RemoveKey By Controller
- 2.5.16 AddKey By Recovery
- 2.5.17 RemoveKey By Recovery
- 2.5.18 Add Attributes
- 2.5.19 Add Attributes By Index
- 2.5.20 Remove Attribute
- 2.5.21 Remove Attribute By Index
- 2.5.22 Add Attributes By Controller
- 2.5.23 Remove Attributes By Controller
- 2.5.24 Add New AuthKey
- 2.5.25 Add NewAuth Key By Recovery
- 2.5.26 Add New AuthKey By Controller
- 2.5.27 Set AuthKey
- 2.5.28 Set AuthKey By Recovery
- 2.5.29 Set AuthKey By Controller
- 2.5.30 Remove AuthKey
- 2.5.31 Remove AuthKey By Recovery
- 2.5.32 Remove AuthKey By Controller
- 2.5.33 Add Service
- 2.5.34 Update Service
- 2.5.35 Remove Service
- 2.5.36 Add Context
- 2.5.37 Remove Context
- 2.5.38 Verify Signature
- 2.5.39 Verify Controller
- 2.5.40 Get PublicKeys Json
- 2.5.41 Get Attributes Json
- 2.5.42 Get Attributes
- 2.5.43 Get Attribute ByKey
- 2.5.44 Get Service Json
- 2.5.45 Get KeyState
- 2.5.46 Get Controller Json
- 2.5.47 Get Document Json
- 2.6 Credential API
- 2.1 Block Chain API
- Contributing
This is a comprehensive Go library for the Ontology blockchain. Currently, it supports local wallet management, digital asset management, deployment/invoking of smart contracts and communication with the Ontology Blockchain. In the future it will also support more rich functions and applications.
First, create an OntologySDK
instance with the NewOntologySdk
method.
ontSdk := NewOntologySdk()
Next, create an rpc, rest or websocket client.
ontSdk.NewRpcClient().SetAddress("http://localhost:20336")
Then, call the rpc server through the sdk instance.
ontSdk.GetCurrentBlockHeight() (uint32, error)
ontSdk.GetCurrentBlockHash() (common.Uint256, error)
ontSdk.GetBlockByHeight(height uint32) (*types.Block, error)
ontSdk.GetBlockByHash(blockHash string) (*types.Block, error)
ontSdk.GetTransaction(txHash string) (*types.Transaction, error)
ontSdk.GetBlockHash(height uint32) (common.Uint256, error)
ontSdk.GetBlockHeightByTxHash(txHash string) (uint32, error)
ontSdk.GetBlockTxHashesByHeight(height uint32) (*sdkcom.BlockTxHashes, error)
ontSdk.GetStorage(contractAddress string, key []byte) ([]byte, error)
ontSdk.GetSmartContract(contractAddress string) (*sdkcom.SmartContract, error)
ontSdk.GetSmartContractEvent(txHash string) (*sdkcom.SmartContactEvent, error)
ontSdk.GetSmartContractEventByHeight(height uint32) ([]*sdkcom.SmartContactEvent, error)
ontSdk.GetMerkleProof(txHash string) (*sdkcom.MerkleProof, error)
ontSdk.GetMemPoolTxState(txHash string) (*sdkcom.MemPoolTxState, error)
ontSdk.GetMemPoolTxCount() (*sdkcom.MemPoolTxCount, error)
ontSdk.GetVersion() (string, error)
ontSdk.GetNetworkId() (uint32, error)
ontSdk.SendTransaction(mutTx *types.MutableTransaction) (common.Uint256, error)
ontSdk.PreExecTransaction(mutTx *types.MutableTransaction) (*sdkcom.PreExecResult, error)
wa, err := OpenWallet(path string) (*Wallet, error)
If the path is for an existing wallet file, then open the wallet, otherwise return error.
wa.Save() error
Note that any modifications of the wallet require calling Save()
in order for the changes to persist.
wa.NewAccount(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte) (*Account, error)
Ontology supports three type of keys: ecdsa, sm2 and ed25519, and support 224, 256, 384, 521 bits length of key in ecdsa, but only support 256 bits length of key in sm2 and ed25519.
Ontology support multiple signature scheme.
For ECDSA support SHA224withECDSA, SHA256withECDSA, SHA384withECDSA, SHA512withEdDSA, SHA3-224withECDSA, SHA3-256withECDSA, SHA3-384withECDSA, SHA3-512withECDSA, RIPEMD160withECDSA;
For SM2 support SM3withSM2, and for SHA512withEdDSA.
wa.NewDefaultSettingAccount(passwd []byte) (*Account, error)
The default settings for an account uses ECDSA with SHA256withECDSA as signature scheme.
wa.NewAccountFromWIF(wif, passwd []byte) (*Account, error)
wa.DeleteAccount(address string) error
wa.GetDefaultAccount(passwd []byte) (*Account, error)
wa.SetDefaultAccount(address string) error
wa.GetAccountByAddress(address string, passwd []byte) (*Account, error)
wa.GetAccountByLabel(label string, passwd []byte) (*Account, error)
wa.GetAccountByIndex(index int, passwd []byte) (*Account, error)
Note that indexes start from 1.
wa.GetAccountCount() int
wa.GetDefaultAccountData() (*AccountData, error)
wa.GetAccountDataByAddress(address string) (*AccountData, error)
wa.GetAccountDataByLabel(label string) (*AccountData, error)
wa.GetAccountDataByIndex(index int) (*AccountData, error)
Note that indexes start from 1.
wa.SetLabel(address, newLabel string) error
Note that label cannot duplicate.
wa.SetSigScheme(address string, sigScheme s.SignatureScheme) error
wa.ChangeAccountPassword(address string, oldPassword, newPassword []byte) error
wa.ImportAccounts(accountDatas []*AccountData, passwds [][]byte) error
wa.ExportAccounts(path string, accountDatas []*AccountData, passwds [][]byte, newScrypts ...*keypair.ScryptParam) (*Wallet, error)
ontSdk.Native.Ont.BalanceOf(address common.Address) (uint64, error)
ontSdk.Native.Ont.Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
ontSdk.Native.Ont.MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
A multi transfer does more than one transfer of ONT in one transaction.
ontSdk.Native.Ont.Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
ontSdk.Native.Ont.Allowance(from, to common.Address) (uint64, error)
ontSdk.Native.Ont.TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, amount uint64) (common.Uint256, error)
ontSdk.Native.Ont.BalanceOfV2(address common.Address) (*big.Int, error)
ontSdk.Native.Ont.TransferV2(gasPrice, gasLimit uint64, from *Account, to common.Address, amount *big.Int) (common.Uint256, error)
ontSdk.Native.Ont.MultiTransferV2(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
A multi transfer does more than one transfer of ONT in one transaction.
ontSdk.Native.Ont.ApproveV2(gasPrice, gasLimit uint64, from *Account, to common.Address, amount *big.Int) (common.Uint256, error)
ontSdk.Native.Ont.AllowanceV2(from, to common.Address) (*big.Int, error)
ontSdk.Native.Ont.TransferFromV2(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, amount *big.Int) (common.Uint256, error)
ontSdk.Native.Ong.BalanceOf(address common.Address) (uint64, error)
ontSdk.Native.Ong.Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
ontSdk.Native.Ong.MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
A multi transfer does more than one transfer of ONG in one transaction.
ontSdk.Native.Ong.Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
ontSdk.Native.Ong.Allowance(from, to common.Address) (uint64, error)
ontSdk.Native.Ong.TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, amount uint64) (common.Uint256, error)
ontSdk.Native.Ong.WithdrawONG(gasPrice, gasLimit uint64, address *Account, amount uint64) (common.Uint256, error)
ontSdk.Native.Ong.UnboundONG(address common.Address) (uint64, error)
ontSdk.Native.Ong.BalanceOfV2(address common.Address) (*big.Int, error)
ontSdk.Native.Ong.TransferV2(gasPrice, gasLimit uint64, from *Account, to common.Address, amount *big.Int) (common.Uint256, error)
ontSdk.Native.Ong.MultiTransferV2(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
A multi transfer does more than one transfer of ONG in one transaction.
ontSdk.Native.Ong.ApproveV2(gasPrice, gasLimit uint64, from *Account, to common.Address, amount *big.Int) (common.Uint256, error)
ontSdk.Native.Ong.AllowanceV2(from, to common.Address) (*big.Int, error)
ontSdk.Native.Ong.TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, amount *big.Int) (common.Uint256, error)
ontSdk.Native.Ong.WithdrawONG(gasPrice, gasLimit uint64, address *Account, amount *big.Int) (common.Uint256, error)
ontSdk.Native.Ong.UnboundONGV2(address common.Address) (*big.Int, error)
ontSdk.Native.OntId.RegIDWithPublicKey(gasPrice, gasLimit uint64, payer *Account, ontId string, signer *Account) (common.Uint256, error)
ontId
: registered ONT ID
signer
: public key of ONT ID and signer account
ontSdk.Native.OntId.RegIDWithController(gasPrice, gasLimit uint64, payer *Account, ontId string, controller *ontid.Group, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: registered ONT ID
controller
:a group of ONT ID
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.RevokeID(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signer *Account) (common.Uint256, error)
ontId
: revoked ONT ID
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.RevokeIDByController(gasPrice, gasLimit uint64, payer *Account, ontId string, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: revoked ONT ID
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.RemoveController(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.RegIDWithAttributes(gasPrice, gasLimit uint64, payer *Account, ontId string, attributes []*DDOAttribute, signer *Account) (common.Uint256, error)
ontId
: registered ONT ID
attributes
: attributes of ONT ID
signer
: public key of ONT ID and signer account
ontSdk.Native.OntId.AddKey(gasPrice, gasLimit uint64, payer *Account, ontId string, newPubKey []byte, controller string, signer *Account) (common.Uint256, error)
ontId
: ONT ID
newPubKey
: new public key added
controller
: controller ONT ID of this public key
signer
: public key of ONT ID and signer account
ontSdk.Native.OntId.AddKeyByIndex(gasPrice, gasLimit uint64, payer *Account, ontId string, newPubKey []byte, index uint32, controller string, signer *Account) (common.Uint256, error)
ontId
: ONT ID
newPubKey
: new public key added
index
: key index of ONT ID
controller
: controller ONT ID of this public key
signer
: signer account
ontSdk.Native.OntId.RemoveKey(gasPrice, gasLimit uint64, payer *Account, ontId string, removedPubKey []byte, signer *Account) (common.Uint256, error)
ontId
: ONT ID
removedPubKey
: public key removed
signer
: public key of ONT ID and signer account
ontSdk.Native.OntId.RemoveKeyByIndex(gasPrice, gasLimit uint64, payer *Account, ontId string, removedPubKey []byte, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
removedPubKey
: public key removed
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.SetRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, recovery *ontid.Group, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
recovery
: group of recovery of ONT ID
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.UpdateRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, newRecovery *ontid.Group, signers []ontid.Signer, recoverySigners []*Account) (common.Uint256, error)
ontId
: ONT ID
newRecovery
: new group of recovery of ONT ID
signers
: signer ONT IDs and its key index
recoverySigners
: signer accounts
ontSdk.Native.OntId.RemoveRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.AddKeyByController(gasPrice, gasLimit uint64, payer *Account, ontId string, publicKey []byte, signers []ontid.Signer, controller string, controllerSigners []*Account) (common.Uint256, error)
ontId
: ONT ID
publicKey
: new public key of ONT ID
signers
: signer ONT IDs and its key index
controller
: controller ONT ID of this public key
controllerSigners
: signer accounts
ontSdk.Native.OntId.RemoveKeyByController(gasPrice, gasLimit uint64, payer *Account, ontId string, publicKeyIndex []byte, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: ONT ID
publicKeyIndex
: public key index of ONT ID removed
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.AddKeyByRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, publicKey []byte, signers []ontid.Signer, controller string, recoverySigners []*Account) (common.Uint256, error)
ontId
: ONT ID
publicKey
: new public key of ONT ID
signers
: signer ONT IDs and its key index
controller
: controller ONT ID of this public key
recoverySigners
: signer accounts
ontSdk.Native.OntId.RemoveKeyByRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, publicKeyIndex uint32, signers []ontid.Signer, recoverySigners []*Account) (common.Uint256, error)
ontId
: ONT ID
publicKeyIndex
: public key index of ONT ID removed
signers
: signer ONT IDs and its key index
recoverySigners
: signer accounts
ontSdk.Native.OntId.AddAttributes(gasPrice, gasLimit uint64, payer *Account, ontId string, attributes []*DDOAttribute, signer *Account) (common.Uint256, error)
ontId
: ONT ID
attributes
: attributes of ONT ID
signer
: public key of ONT ID and signer account
ontSdk.Native.OntId.AddAttributesByIndex(gasPrice, gasLimit uint64, payer *Account, ontId string, attributes []*DDOAttribute, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
attributes
: attributes of ONT ID
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.RemoveAttribute(gasPrice, gasLimit uint64, payer *Account, ontId string, removeKey []byte, signer *Account) (common.Uint256, error)
ontId
: ONT ID
removeKey
: key of attribute want to remove
signer
: public key of ONT ID and signer account
ontSdk.Native.OntId.RemoveAttributeByIndex(gasPrice, gasLimit uint64, payer *Account, ontId, removeKey []byte, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
removeKey
: key of attribute want to remove
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.AddAttributesByController(gasPrice, gasLimit uint64, payer *Account, ontId string, attributes []*DDOAttribute, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: ONT ID
attributes
: attributes of ONT ID
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.RemoveAttributesByController(gasPrice, gasLimit uint64, payer *Account, ontId string, key []byte, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: ONT ID
key
: key of attribute want to remove
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.AddNewAuthKey(gasPrice, gasLimit uint64, payer *Account, ontId string, publicKey []byte, controller string, signIndex uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
publicKey
: public key of ONT ID
controller
: controller ONT ID of this public key
signIndex
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.AddNewAuthKeyByRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, publicKey []byte, controller string, signers []ontid.Signer, recoverySigners []*Account) (common.Uint256, error)
ontId
: ONT ID
publicKey
: public key of ONT ID
controller
: controller ONT ID of this public key
signers
: signer ONT IDs and its key index
recoverySigners
: signer accounts
ontSdk.Native.OntId.AddNewAuthKeyByController(gasPrice, gasLimit uint64, payer *Account, ontId string, publicKey []byte, controller string, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: ONT ID
publicKey
: public key of ONT ID
controller
: controller ONT ID of this public key
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.SetAuthKey(gasPrice, gasLimit uint64, payer *Account, ontId string, index, signIndex uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of public key want to set to auth
signIndex
: key index of ONT ID of signer
signer
: signer account
ontSdk.Native.OntId.SetAuthKeyByRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signers []ontid.Signer, recoverySigners []*Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of public key want to set to auth
signers
: signer ONT IDs and its key index
recoverySigners
: signer accounts
ontSdk.Native.OntId.SetAuthKeyByController(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of public key want to set to auth
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.RemoveAuthKey(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signIndex uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of public key want to remove from auth
signIndex
: key index of ONT ID of signer
signer
: signer account
ontSdk.Native.OntId.RemoveAuthKeyByRecovery(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signers []ontid.Signer, recoverySigners []*Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of public key want to remove from auth
signers
: signer ONT IDs and its key index
recoverySigners
: signer accounts
ontSdk.Native.OntId.RemoveAuthKeyByController(gasPrice, gasLimit uint64, payer *Account, ontId string, index uint32, signers []ontid.Signer, controllerSigners []*Account) (common.Uint256, error)
ontId
: ONT ID
index
: key index of public key want to remove from auth
signers
: signer ONT IDs and its key index
controllerSigners
: signer accounts
ontSdk.Native.OntId.AddService(gasPrice, gasLimit uint64, payer *Account, ontId string, serviceId, type_, serviceEndpint []byte, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
serviceId
: service Id
type_
: service type
serviceEndpint
: service endpint
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.UpdateService(gasPrice, gasLimit uint64, payer *Account, ontId string, serviceId, type_, serviceEndpint []byte, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
serviceId
: service Id
type_
: service type
serviceEndpint
: service endpint
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.RemoveService(gasPrice, gasLimit uint64, payer *Account, ontId string, serviceId []byte, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
serviceId
: service Id want to remove
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.AddContext(gasPrice, gasLimit uint64, payer *Account, ontId string, contexts [][]byte, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
contexts
: contexts want to add
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.RemoveContext(gasPrice, gasLimit uint64, payer *Account, ontId string, contexts [][]byte, index uint32, signer *Account) (common.Uint256, error)
ontId
: ONT ID
contexts
: contexts want to remove
index
: key index of ONT ID
signer
: signer account
ontSdk.Native.OntId.VerifySignature(ontId string, keyIndex uint64, account *Account) (bool, error)
ontId
: ONT ID
keyIndex
: key index of ONT ID
account
: signer account
ontSdk.Native.OntId.VerifyController(ontId string, signers []ontid.Signer, accounts []*Account) (bool, error)
ontId
: ONT ID
signers
: signer ONT IDs and its key index
accounts
: signer accounts
ontSdk.Native.OntId.GetPublicKeysJson(ontId string) ([]byte, error)
ontId
: ONT ID
ontSdk.Native.OntId.GetAttributesJson(ontId string) ([]byte, error)
ontId
: ONT ID
ontSdk.Native.OntId.GetAttributes(ontId string) ([]byte, error)
ontId
: ONT ID
ontSdk.Native.OntId.GetAttributeByKey(ontId, key string) ([]byte, error)
ontId
: ONT ID
key
: key of attribute want to query
ontSdk.Native.OntId.GetServiceJson(ontId string, serviceId string) ([]byte, error)
ontId
: ONT ID
serviceId
: service Id want to query
ontSdk.Native.OntId.GetKeyState(ontId string, keyIndex int) (string, error)
ontId
: ONT ID
keyIndex
: key index of ONT ID
ontSdk.Native.OntId.GetControllerJson(ontId string) ([]byte, error)
ontId
: ONT ID
ontSdk.Native.OntId.GetDocumentJson(ontId string) ([]byte, error)
ontId
: ONT ID
ontSdk.Credential.GenSignReq(credentialSubject interface{}, ontId string, signer *Account) (*Request, error)
credentialSubject
: credentialSubject of Credential
ontId
: holder ONT ID
signer
: signer account
ontSdk.Credential.VerifySignReq(request *Request) error
request
: result of GenSignReq
ontSdk.Credential.CreateCredential(contexts []string, types []string, credentialSubject interface{}, issuerId string, expirationDateTimestamp int64, signer *Account) (*VerifiableCredential, uint32, error)
contexts
: definition
types
: definition
credentialSubject
: credentialSubject of Credential
issuerId
: ONT ID of issuer
expirationDateTimestamp
: unix of expiration date timestamp
signer
: signer account
ontSdk.Credential.CommitCredential(gasPrice, gasLimit uint64, credentialId, issuerId, holderId string, index uint32, signer, payer *Account) (common.Uint256, error)
credentialId
: Id of credential
issuerId
: ONT ID of issuer
holderId
: ONT ID of holder
index
: key index of issuer used to sign tx
signer
: signer account
ontSdk.Credential.VerifyCredibleOntId(credibleOntIds []string, credential *VerifiableCredential) error
credibleOntIds
: credible ONT ID list
credential
: definition
ontSdk.Credential.VerifyNotExpired(credential *VerifiableCredential) error
credential
: definition
ontSdk.Credential.VerifyIssuerSignature(credential *VerifiableCredential) error
credential
: definition
ontSdk.Credential.VerifyStatus(credential *VerifiableCredential) error
credential
: definition
ontSdk.Credential.CreatePresentation(credentials []*VerifiableCredential, contexts, types []string, holder string, signers []*Account) (*Presentation, error)
credentials
: credential list
contexts
: definition
types
: definition
holder
: ONTID of holder
signers
: signer accounts
ontSdk.Credential.VerifyPresentation(presentation *Presentation, credibleOntIds []string) error
presentation
: definition
credibleOntIds
: credible ONT ID list
Can I contribute patches to the Ontology project?
Yes! We appreciate your help!
Please open a pull request with signed-off commits. This means adding a line that says "Signed-off-by: Name " at the end of each commit, indicating that you wrote the code and have the right to pass it on as an open source patch. If you don't sign off your patches, we will not accept them.
You can also send your patches as emails to the developer mailing list. Please join the Ontology mailing list or forum and talk to us about it.
Also, please write good git commit messages. A good commit message looks like this:
Header line: explain the commit in one line
The body of the commit message should be a few lines of text, explaining things in more detail, possibly giving some background about the issue being fixed, etc.
The body of the commit message can be several paragraphs long, and should use proper word-wrapping and keep the columns shorter than about 74 characters or so. That way "git log" will show things nicely even when it's indented.
Make sure you explain your solution and why you're doing what you're doing, and not just what you're doing. Reviewers (and your future self) can read the patch, but might not understand why a particular solution was implemented.
Reported-by: whoever-reported-it Signed-off-by: Your Name [email protected]
The Ontology library (i.e. all of the code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the License file.