0

I am doing a project which is related to the Ethereum. But I faced the problem, so I want to ask you something.

I’ll explain my project briefly. After a team meeting or purchase of materials, the application will be used to recognize receipts issued and deploy them in a block chain using Etherium's smart contract. I use centOS10 server and maria database. I want to build a smart contract on a private network with browser solidity using the Remix platform.

We use the application to register the team and save it as a server. At this time, I would like to know whether it is possible to automatically create a user in the block chain every time a server is registered on the server, and if possible, please tell me a brief idea.

0

In web3.py latest version there is a method called create in account module.

w3.eth.account.create()

Returns:

  • an object with private key and convenience methods

Example:

>>> from web3.auto import w3
>>> acct = w3.eth.account.create('KEYSMASH FJAFJKLDSKF7JKFDJ 1530')
>>> acct.address
'0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E'
>>> acct.privateKey
b"\xb2\\}\xb3\x1f\xee\xd9\x12''\xbf\t9\xdcv\x9a\x96VK-\xe4\xc4rm\x03[6\xec\xf1\xe5\xb3d"

In JavaScript API web3.js v1.0 there is a method called create in account module.

web3.eth.accounts.create();

Returns:

Object - The account object with the following structure:

  • address - string: The account address.
  • privateKey - string: The accounts private key.
  • signTransaction(tx [, callback]) - Function: The function to sign transactions.
  • sign(data) - Function: The function to sign transactions.

Example of returned object:

{
    address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
    privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}
}
  • Thank's for your comment :) I really appreciate. But can I ask something more? I want to know how to make a private network in the same situation. – Hyunji Song Jan 31 '18 at 8:29
  • In Geth & tools there is a tool Puppeth. It helps to create custom genesis file. After genesis file created you will only have to find how to start a network from geth console. There are many good articles about that. – Roman Frolov Jan 31 '18 at 9:14
  • @HyunjiSong glad to help. As you are new to StackExchange sites please have a read: What should I do when someone answers my question? – Roman Frolov Feb 2 '18 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.