-
Notifications
You must be signed in to change notification settings - Fork 247
Notes on Bindings
Exported method:
func CreateAccount(password *C.char) *C.char
Internally relies on:
// createAccount creates an internal geth account
// BIP44-compatible keys are generated: CKD#1 is stored as account key, CKD#2 stored as sub-account root
// Public key of CKD#1 is returned, with CKD#2 securely encoded into account key file (to be used for
// sub-account derivations)
func createAccount(password string) (address, pubKey, mnemonic string, err error)
Sample response:
{
"Address": "0xdeadbeef..",
"PubKey": "0xdeadbeef..",
"Mnemonic": "stupid lazy fox jump crazy..",
"Error": ""
}
Exported method:
func CreateChildAccount(parentAddress, password *C.char) *C.char
Internally relies on:
// createChildAccount creates sub-account for an account identified by parent address.
// CKD#2 is used as root for master accounts (when parentAddress is "").
// Otherwise (when parentAddress != ""), child is derived directly from parent.
func createChildAccount(parentAddress, password string) (address, pubKey string, err error)
Sample Response:
{
"Address": "0xdeadbeef..",
"PubKey": "0xdeadbeef..",
"Error": ""
}
Exported Method:
func RecoverAccount(password, mnemonic *C.char) *C.char
Internally relies on:
// recoverAccount re-creates master key using given details.
// Once master key is re-generated, it is inserted into keystore (if not already there).
func recoverAccount(password, mnemonic string) (address, pubKey string, err error)
Sample Response: (same as on main account creation)
{
"Address": "0xdeadbeef..",
"PubKey": "0xdeadbeef..",
"Mnemonic": "stupid lazy fox jump crazy..",
"Error": ""
}
Binding:
func Login(address, password *C.char) *C.char
Internally:
// selectAccount selects current account, by verifying that address has corresponding account which can be decrypted
// using provided password. Once verification is done, decrypted key is injected into Whisper (as a single identity,
// all previous identities are removed).
func selectAccount(address, password string) error
Every time somebody unlocks Ethereum account Cthulhu kills kittens (🐱 😸 ), dozens of them. So, don't use this method.
This method is deprecated, and will return error, asking you to rely Login()
instead (if kittens weren't enough for you!)
Every time transaction is sent to geth node (via SendTransaction
) it is intercepted and queued (more on queues will be added to this doc once we implement our twisted logic in https://github.com/status-im/status-go/issues/26).
Anyway, in order to complete transaction
CompleteTransaction(hash, password string)
needs to be called. Transaction is signed with password, and if this signing works transaction is executed (sent to execution pool).
StartNode(datadir string) // starts node with a given data directory
addPeer(url string) // adds peer geth will listen to
To manage observers:
addWhisperFilter(filterJson string)
removeWhisperFilter(id int)
cleanWhisperFilters()
Project Information
Getting started
Developers
Support
Internal