Skip to content

Personal

Entity Version
Source 1.12.14-unstable/generated-at:2023-09-04T08:02:34-06:00
OpenRPC 1.2.6

personal_deriveAccount

DeriveAccount requests an HD wallet to derive a new account, optionally pinning it for later reuse.

Params (3)

Parameters must be given by position.

1: url string

  • Required: ✓ Yes

2: path string

  • Required: ✓ Yes

3: pin *bool

  • Required: ✓ Yes

Result

accounts.Account

  • Required: ✓ Yes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
- additionalProperties: `false`
- properties: 
    - address: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - url: 
        - additionalProperties: `false`
        - properties: 
            - Path: 
                - type: `string`

            - Scheme: 
                - type: `string`


        - type: `object`


- type: object
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "additionalProperties": false,
    "properties": {
        "address": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "url": {
            "additionalProperties": false,
            "properties": {
                "Path": {
                    "type": "string"
                },
                "Scheme": {
                    "type": "string"
                }
            },
            "type": "object"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_deriveAccount", "params": [<url>, <path>, <pin>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_deriveAccount", "params": [<url>, <path>, <pin>]}'
1
personal.deriveAccount(url,path,pin);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *PersonalAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error) {
    wallet, err := s.am.Wallet(url)
    if err != nil {
        return accounts.Account{}, err
    }
    derivPath, err := accounts.ParseDerivationPath(path)
    if err != nil {
        return accounts.Account{}, err
    }
    if pin == nil {
        pin = new(bool)
    }
    return wallet.Derive(derivPath, *pin)
}// DeriveAccount requests an HD wallet to derive a new account, optionally pinning
// it for later reuse.
View on GitHub →


personal_ecRecover

EcRecover returns the address for the account that was used to create the signature. Note, this function is compatible with eth_sign and personal_sign. As such it recovers the address of: hash = keccak256(“\x19Ethereum Signed Message:\n”${message length}${message}) addr = ecrecover(hash, signature)

Note, the signature must conform to the secp256k1 curve R, S and V values, where the V value must be 27 or 28 for legacy reasons.

https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover

Params (2)

Parameters must be given by position.

1: data hexutil.Bytes

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

2: sig hexutil.Bytes

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Result

common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_ecRecover", "params": [<data>, <sig>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_ecRecover", "params": [<data>, <sig>]}'
1
personal.ecRecover(data,sig);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
func (s *PersonalAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) {
    if len(sig) != crypto.SignatureLength {
        return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength)
    }
    if sig[crypto.RecoveryIDOffset] != 27 && sig[crypto.RecoveryIDOffset] != 28 {
        return common.Address{}, errors.New("invalid Ethereum signature (V is not 27 or 28)")
    }
    sig[crypto.RecoveryIDOffset] -= 27
    rpk, err := crypto.SigToPub(accounts.TextHash(data), sig)
    if err != nil {
        return common.Address{}, err
    }
    return crypto.PubkeyToAddress(*rpk), nil
}// EcRecover returns the address for the account that was used to create the signature.
// Note, this function is compatible with eth_sign and personal_sign. As such it recovers
// the address of:
// hash = keccak256("\x19Ethereum Signed Message:\n"${message length}${message})
// addr = ecrecover(hash, signature)
//
// Note, the signature must conform to the secp256k1 curve R, S and V values, where
// the V value must be 27 or 28 for legacy reasons.
//
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
View on GitHub →


personal_importRawKey

ImportRawKey stores the given hex encoded ECDSA key into the key directory, encrypting it with the passphrase.

Params (2)

Parameters must be given by position.

1: privkey string

  • Required: ✓ Yes

2: password string

  • Required: ✓ Yes

Result

common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_importRawKey", "params": [<privkey>, <password>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_importRawKey", "params": [<privkey>, <password>]}'
1
personal.importRawKey(privkey,password);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
func (s *PersonalAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error) {
    key, err := crypto.HexToECDSA(privkey)
    if err != nil {
        return common.Address{}, err
    }
    ks, err := fetchKeystore(s.am)
    if err != nil {
        return common.Address{}, err
    }
    acc, err := ks.ImportECDSA(key, password)
    return acc.Address, err
}// ImportRawKey stores the given hex encoded ECDSA key into the key directory,
// encrypting it with the passphrase.
View on GitHub →


personal_initializeWallet

InitializeWallet initializes a new wallet at the provided URL, by generating and returning a new private key.

Params (1)

Parameters must be given by position.

1: url string

  • Required: ✓ Yes

Result

string

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_initializeWallet", "params": [<url>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_initializeWallet", "params": [<url>]}'
1
personal.initializeWallet(url);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
func (s *PersonalAccountAPI) InitializeWallet(ctx context.Context, url string) (string, error) {
    wallet, err := s.am.Wallet(url)
    if err != nil {
        return "", err
    }
    entropy, err := bip39.NewEntropy(256)
    if err != nil {
        return "", err
    }
    mnemonic, err := bip39.NewMnemonic(entropy)
    if err != nil {
        return "", err
    }
    seed := bip39.NewSeed(mnemonic, "")
    switch wallet := wallet.( // InitializeWallet initializes a new wallet at the provided URL, by generating and returning a new private key.
    type) {
    case *scwallet.Wallet:
        return mnemonic, wallet.Initialize(seed)
    default:
        return "", errors.New("specified wallet does not support initialization")
    }
}
View on GitHub →


personal_listAccounts

ListAccounts will return a list of addresses for accounts this node manages.

Params (0)

None

Result

commonAddress []common.Address

  • Required: ✓ Yes
1
2
3
4
5
6
7
8
9
- items: 

        - description: `Hex representation of a Keccak 256 hash POINTER`
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: string


- type: array
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
    "items": [
        {
            "description": "Hex representation of a Keccak 256 hash POINTER",
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": [
                "string"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_listAccounts", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_listAccounts", "params": []}'
1
personal.listAccounts();
Source code

1
2
3
4
func (s *PersonalAccountAPI) ListAccounts() [ // ListAccounts will return a list of addresses for accounts this node manages.
]common.Address {
    return s.am.Accounts()
}
View on GitHub →


personal_listWallets

ListWallets will return a list of wallets this node manages.

Params (0)

None

Result

rawWallet []rawWallet

  • Required: ✓ Yes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
- items: 

        - additionalProperties: `false`
        - properties: 
            - accounts: 
                - items: 
                    - additionalProperties: `false`
                    - properties: 
                        - address: 
                            - pattern: `^0x[a-fA-F\d]{64}$`
                            - title: `keccak`
                            - type: `string`

                        - url: 
                            - additionalProperties: `false`
                            - properties: 
                                - Path: 
                                    - type: `string`

                                - Scheme: 
                                    - type: `string`


                            - type: `object`


                    - type: `object`

                - type: `array`

            - failure: 
                - type: `string`

            - status: 
                - type: `string`

            - url: 
                - type: `string`


        - type: object


- type: array
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
    "items": [
        {
            "additionalProperties": false,
            "properties": {
                "accounts": {
                    "items": {
                        "additionalProperties": false,
                        "properties": {
                            "address": {
                                "pattern": "^0x[a-fA-F\\d]{64}$",
                                "title": "keccak",
                                "type": "string"
                            },
                            "url": {
                                "additionalProperties": false,
                                "properties": {
                                    "Path": {
                                        "type": "string"
                                    },
                                    "Scheme": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    },
                    "type": "array"
                },
                "failure": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "url": {
                    "type": "string"
                }
            },
            "type": [
                "object"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_listWallets", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_listWallets", "params": []}'
1
personal.listWallets();
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
func (s *PersonalAccountAPI) ListWallets() [ // ListWallets will return a list of wallets this node manages.
]rawWallet {
    wallets := make([]rawWallet, 0)
    for _, wallet := range s.am.Wallets() {
        status, failure := wallet.Status()
        raw := rawWallet{URL: wallet.URL().String(), Status: status, Accounts: wallet.Accounts()}
        if failure != nil {
            raw.Failure = failure.Error()
        }
        wallets = append(wallets, raw)
    }
    return wallets
}
View on GitHub →


personal_lockAccount

LockAccount will lock the account associated with the given address when it’s unlocked.

Params (1)

Parameters must be given by position.

1: addr common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_lockAccount", "params": [<addr>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_lockAccount", "params": [<addr>]}'
1
personal.lockAccount(addr);
Source code

1
2
3
4
5
6
func (s *PersonalAccountAPI) LockAccount(addr common.Address) bool {
    if ks, err := fetchKeystore(s.am); err == nil {
        return ks.Lock(addr) == nil
    }
    return false
}// LockAccount will lock the account associated with the given address when it's unlocked.
View on GitHub →


personal_newAccount

NewAccount will create a new account and returns the address for the new account.

Params (1)

Parameters must be given by position.

1: password string

  • Required: ✓ Yes

Result

common.AddressEIP55

  • Required: ✓ Yes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
- items: 

        - description: `Hex representation of the integer`
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: string


- maxItems: `20`
- minItems: `20`
- type: array
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
    "items": [
        {
            "description": "Hex representation of the integer",
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": [
                "string"
            ]
        }
    ],
    "maxItems": 20,
    "minItems": 20,
    "type": [
        "array"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_newAccount", "params": [<password>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_newAccount", "params": [<password>]}'
1
personal.newAccount(password);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *PersonalAccountAPI) NewAccount(password string) (common.AddressEIP55, error) {
    ks, err := fetchKeystore(s.am)
    if err != nil {
        return common.AddressEIP55{}, err
    }
    acc, err := ks.NewAccount(password)
    if err == nil {
        addrEIP55 := common.AddressEIP55(acc.Address)
        log.Info("Your new key was generated", "address", addrEIP55.String())
        log.Warn("Please backup your key file!", "path", acc.URL.Path)
        log.Warn("Please remember your password!")
        return addrEIP55, nil
    }
    return common.AddressEIP55{}, err
}// NewAccount will create a new account and returns the address for the new account.
View on GitHub →


personal_openWallet

OpenWallet initiates a hardware wallet opening procedure, establishing a USB connection and attempting to authenticate via the provided passphrase. Note, the method may return an extra challenge requiring a second open (e.g. the Trezor PIN matrix challenge).

Params (2)

Parameters must be given by position.

1: url string

  • Required: ✓ Yes

2: passphrase *string

  • Required: ✓ Yes

Result

None

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_openWallet", "params": [<url>, <passphrase>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_openWallet", "params": [<url>, <passphrase>]}'
1
personal.openWallet(url,passphrase);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (s *PersonalAccountAPI) OpenWallet(url string, passphrase *string) error {
    wallet, err := s.am.Wallet(url)
    if err != nil {
        return err
    }
    pass := ""
    if passphrase != nil {
        pass = *passphrase
    }
    return wallet.Open(pass)
}// OpenWallet initiates a hardware wallet opening procedure, establishing a USB
// connection and attempting to authenticate via the provided passphrase. Note,
// the method may return an extra challenge requiring a second open (e.g. the
// Trezor PIN matrix challenge).
View on GitHub →


personal_sendTransaction

SendTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.From. If the given passwd isn’t able to decrypt the key it fails.

Params (2)

Parameters must be given by position.

1: args TransactionArgs

  • Required: ✓ Yes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - data: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`


- type: object
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "data": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

2: passwd string

  • Required: ✓ Yes

Result

common.Hash

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_sendTransaction", "params": [<args>, <passwd>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_sendTransaction", "params": [<args>, <passwd>]}'
1
personal.sendTransaction(args,passwd);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (s *PersonalAccountAPI) SendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error) {
    if args.Nonce == nil {
        s.nonceLock.LockAddr(args.from())
        defer s.nonceLock.UnlockAddr(args.from())
    }
    signed, err := s.signTransaction(ctx, &args, passwd)
    if err != nil {
        log.Warn("Failed transaction send attempt", "from", args.from(), "to", args.To, "value", args.Value.ToInt(), "err", err)
        return common.Hash{}, err
    }
    return SubmitTransaction(ctx, s.b, signed)
}// SendTransaction will create a transaction from the given arguments and
// tries to sign it with the key associated with args.From. If the given
// passwd isn't able to decrypt the key it fails.
View on GitHub →


personal_sign

Sign calculates an Ethereum ECDSA signature for: keccak256(“\x19Ethereum Signed Message:\n” + len(message) + message))

Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.

The key used to calculate the signature is decrypted with the given password.

https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign

Params (3)

Parameters must be given by position.

1: data hexutil.Bytes

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

2: addr common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

3: passwd string

  • Required: ✓ Yes

Result

hexutil.Bytes

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_sign", "params": [<data>, <addr>, <passwd>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_sign", "params": [<data>, <addr>, <passwd>]}'
1
personal.sign(data,addr,passwd);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
func (s *PersonalAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error) {
    account := accounts.Account{Address: addr}
    wallet, err := s.b.AccountManager().Find(account)
    if err != nil {
        return nil, err
    }
    signature, err := wallet.SignTextWithPassphrase(account, passwd, data)
    if err != nil {
        log.Warn("Failed data sign attempt", "address", addr, "err", err)
        return nil, err
    }
    signature[crypto.RecoveryIDOffset] += 27
    return signature, nil
}// Sign calculates an Ethereum ECDSA signature for:
// keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))
//
// Note, the produced signature conforms to the secp256k1 curve R, S and V values,
// where the V value will be 27 or 28 for legacy reasons.
//
// The key used to calculate the signature is decrypted with the given password.
//
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
View on GitHub →


personal_signTransaction

SignTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.From. If the given passwd isn’t able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast to other nodes

Params (2)

Parameters must be given by position.

1: args TransactionArgs

  • Required: ✓ Yes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - data: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`


- type: object
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "data": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

2: passwd string

  • Required: ✓ Yes

Result

*SignTransactionResult

  • Required: ✓ Yes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
- additionalProperties: `false`
- properties: 
    - raw: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - tx: 
        - additionalProperties: `false`
        - type: `object`


- type: object
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
    "additionalProperties": false,
    "properties": {
        "raw": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "tx": {
            "additionalProperties": false,
            "type": "object"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_signTransaction", "params": [<args>, <passwd>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_signTransaction", "params": [<args>, <passwd>]}'
1
personal.signTransaction(args,passwd);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args TransactionArgs, passwd string) (*SignTransactionResult, error) {
    if args.From == nil {
        return nil, errors.New("sender not specified")
    }
    if args.Gas == nil {
        return nil, errors.New("gas not specified")
    }
    if args.GasPrice == nil && (args.MaxFeePerGas == nil || args.MaxPriorityFeePerGas == nil) {
        return nil, errors.New("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas")
    }
    if args.Nonce == nil {
        return nil, errors.New("nonce not specified")
    }
    tx := args.toTransaction()
    if err := checkTxFee(tx.GasPrice(), tx.Gas(), s.b.RPCTxFeeCap()); err != nil {
        return nil, err
    }
    signed, err := s.signTransaction(ctx, &args, passwd)
    if err != nil {
        log.Warn("Failed transaction sign attempt", "from", args.from(), "to", args.To, "value", args.Value.ToInt(), "err", err)
        return nil, err
    }
    data, err := signed.MarshalBinary()
    if err != nil {
        return nil, err
    }
    return &SignTransactionResult{data, signed}, nil
}// SignTransaction will create a transaction from the given arguments and
// tries to sign it with the key associated with args.From. If the given passwd isn't
// able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast
// to other nodes
View on GitHub →


personal_unlockAccount

UnlockAccount will unlock the account associated with the given address with the given password for duration seconds. If duration is nil it will use a default of 300 seconds. It returns an indication if the account was unlocked.

Params (3)

Parameters must be given by position.

1: addr common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: password string

  • Required: ✓ Yes

3: duration *uint64

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_unlockAccount", "params": [<addr>, <password>, <duration>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_unlockAccount", "params": [<addr>, <password>, <duration>]}'
1
personal.unlockAccount(addr,password,duration);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
func (s *PersonalAccountAPI) UnlockAccount(ctx context.Context, addr common.Address, password string, duration *uint64) (bool, error) {
    if s.b.ExtRPCEnabled() && !s.b.AccountManager().Config().InsecureUnlockAllowed {
        return false, errors.New("account unlock with HTTP access is forbidden")
    }
    const max = uint64(time.Duration(math.MaxInt64) / time.Second)
    var d time.Duration
    if duration == nil {
        d = 300 * time.Second
    } else if *duration > max {
        return false, errors.New("unlock duration too large")
    } else {
        d = time.Duration(*duration) * time.Second
    }
    ks, err := fetchKeystore(s.am)
    if err != nil {
        return false, err
    }
    err = ks.TimedUnlock(accounts.Account{Address: addr}, password, d)
    if err != nil {
        log.Warn("Failed account unlock attempt", "address", addr, "err", err)
    }
    return err == nil, err
}// UnlockAccount will unlock the account associated with the given address with
// the given password for duration seconds. If duration is nil it will use a
// default of 300 seconds. It returns an indication if the account was unlocked.
View on GitHub →


personal_unpair

Unpair deletes a pairing between wallet and geth.

Params (2)

Parameters must be given by position.

1: url string

  • Required: ✓ Yes

2: pin string

  • Required: ✓ Yes

Result

None

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "personal_unpair", "params": [<url>, <pin>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "personal_unpair", "params": [<url>, <pin>]}'
1
personal.unpair(url,pin);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
func (s *PersonalAccountAPI) Unpair(ctx context.Context, url string, pin string) error {
    wallet, err := s.am.Wallet(url)
    if err != nil {
        return err
    }
    switch wallet := wallet.( // Unpair deletes a pairing between wallet and geth.
    type) {
    case *scwallet.Wallet:
        return wallet.Unpair([]byte(pin))
    default:
        return errors.New("specified wallet does not support pairing")
    }
}
View on GitHub →



Last update: 2024-06-10