moonet_en

Casker edited this page Oct 25, 2018 · 9 revisions

Usechain Public Blockchain Testing Network Moonet Documentation

Introduction

Usechain is the world's first mirror identity blockchain that achieves the correspondence between addresses on-chain and real identity off-chain, while maintains full privacy protection. On the basis of anonymity, Usechain vests the blockchain network with legality by identity mapping, fundamentally promote the mass application of blockchain technology. Usechain has a natural advantage on financial decentralized applications. The real-identity mapping and isolating satisfy the requirements of legality of the financial activities. The technical innovations from basic-layer to top-layer of the infrastructure lower the threshold to use blockchain technology, and promote the development of decentralized applications. Usechain will eventually construct a Wall Street on blockchain.

The Usechain public blockchain testing network (testnet) goes online on October 2018. At present, it implements identity verification, encryption algorithm, stealth function, committee, alpha version of RPOW algorithm and block explorer, etc.

Usechain is developed based on Ethereum and is well compatible with Ethereum. Most of the operations, if not specified, can refer to the [Ethereum Documentation].(https://github.com/ethereum/wiki/wiki).

In the future, we will make better optimization in terms of identity, to achieve higher transaction performance and provide basic financial functions to support large-scale ecological applications.

The official document link is https://github.com/usechain/doc/wiki, Other official documents will be synchronized, but may not be up-to-date.

Reader

  • Blockchain developers with definite technical basis
  • Users who concern for the Usechain project progress. if readers find some parts hard to understand, we sugguest to skip.

Resources

Testnet Nodes

At present, over 20 nodes are running on the testnet. You can download the corresponding version of your operating system to test, or build your private network for testing.

We welcome developers and users who are interested in Usechain to build the technology community together. We will reward outstanding developers, or offer work opportunities to build a truly decentralized world together.

  • Source Code go-usechain
  • Forum discord
  • Please submit bugs and your requirement directly on github's issues.

Pre-Condition

Hardware

  • CPU 1GHz single core or above- Free Memory 4 GB or above, 8GB is recommended- Broadband 1MBps or above - Hard Disk 10GB free hard disk or above

Supported Operating Systems

We welcome you to provide reports on compatibility issues and operation testing document.

  • Mac OSX 10 or above
  • Redhat/Centos 6 or above
  • Ubuntu 14.4 or above
  • Windows 7 or above
  • Other Linux distributions

Software The build enviroment may rely on the following languages

  • go 1.9 or above
  • node.js 8.11 or above
  • npm 5 or above
  • python 3.5 or above
  • bash
  • git

Convention

Account and Address are the same concept in this document. Both account and address are the abbreviation of account address, so we mix use in this document. For example, one-time account equals to one-time address.

Quick Start

This tutorial, if not specified,execute commands in console after executing ./used. The demo commands are all tested on ubuntu 18.04.

Download

Get Certificate In this step, you will get your CA credential automatically, the testnet won't do the manual review. To get your credential, run the following command on Command Prompt:

$ ./used verify --id=[your id number] --photo=[your photo path]
# Then you will see idKey in your terminal.
$ ./used verify --query=[idKey]

Open console

Open console

--moonet equals to --networkid=2

$ ./used --moonet console

Create Account For security purpose, we devide accounts into one-time account, main account and sub-account. One-time account is just for sending CA credential to Usechain public chain to verify identiyt.

Main account is generated by one-time account, and sub-account is generated by main account. General users can not chase down the correspondence between these accounts.

This document sets the following conventions:

  • Set eth.accounts[0] as one-time account
  • Set eth.accounts[1] as main account
  • Set eth.accounts[2] as sub-account After openning console, you can execute the following commands.

One-time address(single):

> personal.newAccount()

Main address(single):

> personal.newABaccount(eth.accounts[0])

Sub-address(multiple):

> personal.newABaccount(eth.accounts[1])
> personal.newABaccount(eth.accounts[1])
> personal.newABaccount(eth.accounts[1])

Join the TestnetOpen console and use admin.addPeer() to join the testnet

> admin.addPeer("enode://6289703f7cd8f370c1e7a822c164d733de27e549e0c3dc18cb21db174dec475ac65f10dba1a68809d7f9c5b19fb50366538ec5b2e541dc619c0e6acac1c25daf@39.107.67.179:30303")
true

Get Test Coin

Access http://moonet.usechain.net/#/gettoken ,type address to get test coins. The coins is used to register on Usechain public chain testing network. You will get 10 USE each time.

Register Usechain Account User needs to register and verify to become unrestricted user.

Register on Usechain public chain

Must be done in console in sequence. Set up address variables of CA contract in console.

> sc="0xfffffffffffffffffffffffffffffffff0000001"
  1. One-time account registration
> use.sendOneTimeTransaction({from:eth.accounts[0],to:sc,gas:'0x332423'})
  1. Main account registration
> use.sendMainTransaction(eth.accounts[0],{from:eth.accounts[1],to:sc,gas:'0x332423'})
  1. Sub-account registration
> use.sendSubTransaction(eth.accounts[1],{from:eth.accounts[2],to:sc, gas:'0x332423'}

Transaction

Hui is the basic unit of Usechain public chain token. USE is the common unit of Usechain public chain, 1 USE equals to 10^18 Hui.

> eth.sendTransaction({"from": eth.accounts[1],"to": eth.accounts[2], "value":web3.toHui("100", "USE")})

Mining

  1. Miner registration
use.minerRegister({from: eth.accounts[1]})

  1. Mining

Start mining

> miner.setUsebase(eth.accounts[1])
> personal.unlockAccount(eth.coinbase, passphrase, 5000000)
true

> miner.start(2)

Stop mining

> miner.stop()

Search Transaction

  1. Search transaction or address on Blockchain Explorer2. Search transaction or address in console
> eth.getBalance(address)

Usechain Client## go-usechain

go-usechainclient, aka used, is a CLI implemented in Go language to run Usechain nodes. By installing and running used, users are allowed to participate and experience the Usechain network and:

  1. Complete identity verification and registration

  2. Generate one-time account, main account and sub-account

  3. Get Usechain token through mining

  4. Transfer among accounts

  5. Create smart contract and send transaction

  6. View blockchain history

Related Links

Website: http://www.usechain.net/

GitHub: https://github.com/usechain/go-usechain

Discord: https://discord.gg/33ZTkV3

Testnet: http://moonet.usechain.net

Compilation Process

Windows

You need to configure Go language and git environment in local, we suggest use Go 1.10 and the latest version of git. Then download Usechain source code from Usechain official github:

$ git clone http://git.usechain.cn/usechain/go-usechain.git

Access go-usechain directory:

$ cd %GOPATH%/src/github.com/usechain/go-usechain

Compile used:

$ go install -v ./cmd/used

The compiled used file is stored in %GOPATH%/bin directory

Linux

After configuring Go language and git environment, you can download the source code. Just access go-usechain directory and use make used command to compile. The compiled used file is stored in go-usechain/build/bin directory

Run Nodes

The user can follow the above tutorial to generate used file by compiling source code. Usechain team has offer different versions of binary downloads for different operating systems on github, too. Once the executable used file is generated, the user can initialize nodes and start operating.

For Windows and Linux systems users, the operation is as follows:

First, set use genesis.json file under build/config file to init:

$ ./used --moonet --datadir=usechainData init ./genesis.json

Then, start the nodes:

$ ./used --moonet --datadir=usechainData --rpc --rpcaddr=0.0.0.0 --rpcapi "eth,use,net,web3,txpool" --rpccorsdomain '*'  console

Basic Opreation

  1. Generate general account address
> personal.newAccount("passwd")
  1. Start mining You need to unlock the account first
> personal.unlockAccount(eth.accounts[0],"passwd")
  1. Register to be a miner
> use.minerRegister({from: eth.accounts[0]})
  1. Start mining
> miner.start()
  1. Stop mining
> miner.stop()

Build Public Chain Testing Network

  • NodeIP:
    • 39.105.102.190
    • 39.105.89.191
    • 39.107.67.179

static-nodes.json

[""enode://3b56784fb7c72963a78301de99cc51f79439f4acdb0473ef71d05d1f6ed4dc5eaa9d3413dcb2befc869ce5c9ec1c97125fe664eb45563607a41ee52437cfe497@39.105.102.190:30303", "enode://d53bb4ef27ca41ef397464ad41930d69f029001e9a75ef1d93a1694788f32093748a67c0b0b8d955827bc10dd55567c94b09be238578f8d2d90065f866467647@39.105.89.191:30303", "enode://6289703f7cd8f370c1e7a822c164d733de27e549e0c3dc18cb21db174dec475ac65f10dba1a68809d7f9c5b19fb50366538ec5b2e541dc619c0e6acac1c25daf@39.107.67.179:30303"]


Usechain Address Management## Address In Usechain network, addresses are divided into one-time address, main address and sub-address.

One-time address is a intermediate address generated when user apply to verify an address at the first time. When sending transaction, it verifies user’s CA credential in CA contract. Each user can only generate one one-time address. The only function of one-time address is to do transaction verification, transactions other than that or to receive tokens are not supported.

Main address is an affiliate address generated from one-time address, each one-time address can only generate one main address, which means each user can only own one main address. The main address supports mining, voting, etc..

Sub-address is an affiliate address generated from main address or other sub-addresses. There is no limitation on the amount of sub-address, for each non-one-time address, it can generate multiple sub-addresses.

Address Document Each address consists of public key and private key. For each Usechain address, it is Hash computed with public key, then take the last 20 bytes. Each pair of public and private key is encrypted and stored in Keystore. The address storage file is in the sub-directory of keystore under nodes data storage directory.

Create address

After installing used client, the user can generate address as follows:

$ used account new

Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase: 
Repeat passphrase: 
Address: {5cb3fe4272240e8a0d99fcabf7d4eda213ae0230}
Console Command Line Tools
> used --moonet console 2>>usechain.log
> personal.newAccount()
Passphrase: 
Repeat passphrase: 
"0x9dd3ce8a01c4ec57f7df8afb9052ffa777d609b1"
Check Account
> eth.accounts
["0xad4ab8ec514f94655c8c350f2c0791c6371b4161", "0xb8f720b0cb6175eb34fc430aa0ccb2c62ae4c052", "0x9dd3ce8a01c4ec57f7df8afb9052ffa777d609b1"]

RPOW

Mining The Bitcoin, Ethereum and other existing blockchain network use mining to generate blocks. Mining itself can be incentive. On the basis of distributive consensus algorithm(POW), it chooses blocks with high general difficulty. Transactions in the network are packed and sent by miners, thus generate blocks, and other nodes will verify the transactions. Usechain shares similarities with Bitcoin and Ethereum network in consensus algorithm. The key of Randomized Proof of Work (RPOW) is to find out a random number that makes the difficulty of the whole block reasonable.

RPOW Introduction

RPOW consensus algorithm is an optimized version of POW. Currently we have implemented the basic structure which capture the header information of blocks with the miner’s private key signature to get special field MinerTag. The difficulty is reduced when the matching numbers between MinerTag and the miner's binary string of coinbase address reaches a certain threshold. To participate mining, you have to register in the network. For the convenience of testing and using,** if there is no registered miners on the chain, then anyone will be able to mine. **。Also, the mining address is not necessary must be a main address at present.

ROPW Mining

Unlock Account

Unlock account in Keystore with the given password.

The unlocking format is as follows, password and time are optional.

Client Method
Console personal.unlockAccount(address, passphrase, duration)
JSON-RPC {"method": "personal_unlockAccount", "params": [address, passphrase, duration]}
Example
> personal.unlockAccount(eth.coinbase, passphrase, 500)
true

Miner registration In the testnet, miners are not asked for registration, so everyone can be a miner.

If you want to be registered, launch a registration application to the miner registration contract, and miner will send a registration transaction.

Client Method
Console use.minerRegister({from: address})
JSON-RPC {"method": "use_minerRegister", "params": [{from: address}]}
Example
> use.minerRegister({from: address})

Start Mining

In the future mainnet, miners are required to register in the network, but here in testnet, registration is not required. To start mining with CPU, you can choose to type the thread of mining.

Client Method
Console miner.start(threads number)
JSON-PRC {"method": "miner_start", "params": [number]}
Example
> miner.start(2)

Stop Mining To stop CPU mining.

Client Method
Console miner.stop()
JSON-PRC {"method": "miner_stop", "params": []}
Example
> miner.stop()
true

Miner Logout

It requires the same as registration to logout miner, the user need to launch a logout application to the miner registration contract, as well as sending a transaction.

Client Method
Console use.minerUnRegister({from: address})
JSON-PRC {"method": "use_minerUnRegister", "params": [{from: address}]}
Example
> use.minerUnRegister({from: address})

Identity Verification Usechain is a mirror identity public chain that born with identity verification, it is the cornerstone of the blockchain ecosystem infrastructure. Different from other blockchain networks that emphasis full anonymity, addresses on the Usechain public chain will be verified and corresponded to the one, and the only one real identity. Being verified does not mean to disclose personal identity and privacy. In the identity verification module, Usechain balances the professional of third-party CA agencies and the decentralization of the network. Meanwhile, Usechain combines main-sub address, ring signature, threshold key distribution and identity data encryption to protect user’s identity privacy. Only when it is authorized by the owner or voted by the community, can the identity information be disclosed.

Apart from user themselves, the identity verification process involves three main roles: third-party CA agency, CA contract and Usechain committee. The main functions of each role are as follows:

  • CA agency: Verify user’s identity information and issue certificate.

  • CA contract: Verify information provided by one-time account, store application of identity verification, record verification status of address.

  • Committee: Verify the validity of main address and sub-address, modify user status in CA contract.

Usechain Address

Usechain Usechain account includes one-time address, main address and sub-address.

  • One-time address is a intermediate address generated when user apply to verify an address at the first time. When sending transaction, it verifies user’s CA credential in CA contract. Each user can only generate one one-time address. The only function of one-time address is to do transaction verification, transactions other than that or to receive tokens are not supported.

  • Main address is an affiliate address generated from one-time address, each one-time address can only generate one main address, which means each user can only own one main address. The main address supports mining, voting, etc..

  • Sub-address is an affiliate address generated from main address or other sub-addresses. There is no limitation on the amount of sub-address, for each non-one-time address, it can generate multiple sub-addresses.

The main address is the user’s main account, which is created when the user generates the wallet. Every user has only one main address that is linked one-to-one with identity. The main address uses the Elliptical Curve Secp256k1 to generate the public and private key, and then uses the public key to generate the address. Both main and sub addresses require verification to start transactions. There’s not limit on the number of sub addresses, which will be generated based on the user’s needs, using the user’s main account public key, and are kept separately from the main address. Therefore, the dependence relation between main addresses and sub addresses are not visible.

Example of generating

One-time address (single):

> personal.newAccount()

Main address (single):

> personal.newABaccount(eth.accounts[0])

Sub-address (multiple):

> personal.newABaccount(eth.accounts[1])
> personal.newABaccount(eth.accounts[1])
> personal.newABaccount(eth.accounts[1])

Verification Process

  • Usechain will cooperate with world’s professional CA agencies. The user applies for the CA certificate to the third-party agencies, and the third party verifies and returns to the user the certificate. The certificate does not contain any personal information.

  • Then, the user can generate a one-time address using the CA certificate, and send a transaction from this address to the CA contract. The transaction data includes CA certificate information and the corresponding private key signature. Usechain verifies the address through the CA contract, determines whether the transaction is legal, then CA contract will modify the status of the one-time address to verified.

  • After generating a one-time address, the user can generate a main address from the one-time address, send transaction from the main address to CA contract, the transaction data includes ring signature generated by the one-time address and public key of main address. CA contract stores the transaction information, the committee verifies if the ring signature is valid through reading contract data, and verifies whether the main address is generated by a legal one-time address at the same time. When it verifies successfully, the committee member modify the verification status of main address in CA contract as legal through multi signature.

The verification of sub-address is similar to the verification of main-address, the only difference is that the ring signature of sub-address is not signed by one-time address, but any other legal main addresses and sub-addresses.

One-time Address Verification The user can import legal CA certificate they get from CA agency to Usechain node client. The user can click to generate a one-time address, this process is similar to the generating process of Ethereum general address based on Elliptic curve encryption standard, call use.sendOneTimeTransaction interface to send transaction. When the one-time address verification transaction packaged to the transaction buffer pool in client, check the transaction validity of the packaged transaction, invalid transactions will be dumped directly, the node client won’t transfer them, and these invalid transactions will not be took into the block. It mainly verifies the transaction fee, transaction signature, target address, data format, correctness of ABI, validity of certificate’s private key signature and whether the CA certificate is issued by CA agencies.

  1. Set eth.accounts[0] as one-time account
  2. Set eth.accounts[1] as main account
  3. Set eth.accounts[2] as sub-account
> use.sendOneTimeTransaction({from:eth.accounts[0],to:sc,gas:'0x332423'})

** Main account verification **

After verifying one-time account, the user can process to verify the main account. Send verification transaction from main account to CA contract, the payload data of the transaction includes: ring signature, public key mirroring, ABI.

The generating process of ring signature is as follows:

  1. According to the main account’s private key, the user calculates the public key’s mirroring on (pk, sk) , I = sk * Hash(pk)
  2. Randomly choose n-1 legal one-time addresses’ public key to comprise a public key set with the user’s public key pk:
    S = {p1, p2, ..., pk, ..., pn}
  3. Use the public key set S to sign pk,and generate ring signature. When the transaction packaging completed, the node client verifies if the format of the main account’s verification transaction is correct or not, the ring signature is valid or not and both the ring signature and public key set are generated by legal one-time account’s public key or not. Invalid main account verification will be dumped. When the CA contract received application of main account verification, it checks if the public key’s mirroring is used or not. If being used, then reject the application. If not, it will store the verification information of the main account transaction to the storage of contract. Due to the uniqueness of the public key’s mirroring generated from one address, one one-time account can only generate one valid main account.
> use.sendMainTransaction(eth.accounts[0],{from:eth.accounts[1],to:sc,gas:'0x332423'})

Sub-account Verification

The sub-account verification process is similar to the main account process, the difference is that sub-account can be generated from a main account address or sub-account address, meanwhile, the public key’ s mirroring of sub-account can be used repeatedly.

> use.sendSubTransaction(eth.accounts[1],{from:eth.accounts[2],to:sc, gas:'0x332423'})

Send Transaction & Contract

Transaction

Usechain 中,In Usechain, transaction is a data signed by address’s private key. The signed transaction can be broadcast selectively by nodes to adjacent nodes, which continue to broadcast until they are packed into blocks by miners.

Gas

In Usechain, the validity verification of transaction and the execution of contract cost certain Gas. To send a transaction, it requires the user to pay a certain transaction fee to the miner, in Usechain, the fee is: TXfee = GasPrice * GasUsed

Original Transaction

  • from: USE sending address
  • To: USE receiving address
  • value: Transfer amount of USE
  • Optional parameters
    • GasPrice: The fee to send a transaction
    • GasLimit: the maximum amount of gas you're willing to spend on a particular transaction. Gas

Example

> eth.sendTransaction({"from": "0xe0f7556cf57751fa447ee0b4a1cfdebf805fb87b","to": "0x3866b65c5dd12bbcba367c45d33677475e44524c","gas": "0x5208", "gasPrice": "0x9184e72a000", "value": "0x874ef557a00f00000"})

"0x507d9671630c1524e76208b08d22cdf74a42d3eb8efebadc0cd9e4d2a163cde2"

Contract

In Usechain, contract is a bytecode stored on the chain. A certain status is stored in the contract, and the change of the contract status is triggered by the miner's package of transaction. The bytecodes computed by Usechain virtual machine that supports Turing complete. The bytecodes of contracts are usually written in high-level languages and compiled by the compiler into bytecodes that can be executed by the virtual machine. Usechain virtual machine is compatible with Ethereum bytecodes. The source code of contract is similar to:

pragma solidity ^0.4.24;
contract HelloWorld {
    function () public {
        revert();
    }
    event SayHello();
    function sayHello() public pure returns(string) {
        return "Hello, World!";
    }  
    constructor() public {}
}

Bytecodes generated:

608060405234801561001057600080fd5b5061013f806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663ef5fb05b8114610052575b34801561004c57600080fd5b50600080fd5b34801561005e57600080fd5b506100676100dc565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100a1578181015183820152602001610089565b50505050905090810190601f1680156100ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051808201909152600d81527f48656c6c6f2c20576f726c6421000000000000000000000000000000000000006020820152905600a165627a7a72305820534ba9759bc36d93879fcbeecb1bb3870615cd6058342a77cca4f87cdde8a18e0029

Deploy contract:

> eth.sendTransaction({"from": "0xe0f7556cf57751fa447ee0b4a1cfdebf805fb87b","gas": "0x2146b", "gasPrice": "0x9184e72a000", "value": 0, "data":"0x608060405234801561001057600080fd5b5061013f806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663ef5fb05b8114610052575b34801561004c57600080fd5b50600080fd5b34801561005e57600080fd5b506100676100dc565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100a1578181015183820152602001610089565b50505050905090810190601f1680156100ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051808201909152600d81527f48656c6c6f2c20576f726c6421000000000000000000000000000000000000006020820152905600a165627a7a72305820534ba9759bc36d93879fcbeecb1bb3870615cd6058342a77cca4f87cdde8a18e0029"})

Submitted contract creation              fullhash=0x0a516c8612ab9d8548805080c12b64018cbce18035d576ad6b12791ef1b32c19 contract=0x58e74C32389507DD7d87Dc782434b56b3cA03A13

Obtain transaction & contract information

Console Usechain console is a JavaScript supported CLT. It loads the web3.js file to implement operations such as the Usechain identity verification, RPOW miner registration and sending transactions.

Obtain block information

> eth.getBlock(1691)
{
  difficulty: 252742,
  extraData: "0xd501846765746888676f312e31302e31856c696e7578",
  gasLimit: 823058598,
  gasUsed: "0x1976b",
  gasuse: 0,
  hash: "0xf1494dc23a3b820b767859c2a95aaf247e75dc8ed5a7fe896031670845ce0a2f",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0xe0f7556cf57751fa447ee0b4a1cfdebf805fb87b",
  minerNum: 0,
  minerTag: "najiaLL8hDWHu8T3KvVVL5daEtg=",
  mixHash: "0x2b7ad161801599a7742154462828a5b09c04d420bd6433dfe3e320fbe04285d4",
  nonce: "0x2639edb7eb7d1bf4",
  number: 1691,
  parentHash: "0x10b52550ba4c436fe76f56888f52ef481cde6567250f29ac87a30a44d004f994",
  receiptsRoot: "0xe6540dbf1654978c6987f691438078ea05ac7f6b6abcf6cd751cfca29c780a39",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 1001,
  stateRoot: "0x37d1f6c17500b9f9a406fd7611efc799e4e8533ce6dee4017e8c5d291452b805",
  timestamp: 1538053532,
  totalDifficulty: 338434314,
  transactions: ["0x0a516c8612ab9d8548805080c12b64018cbce18035d576ad6b12791ef1b32c19"],
  transactionsRoot: "0x6a2c5f5e59167253276a813bda81cdc6712dba7e8912a90c3c02455bde84fc7c",
  uncles: []
}

Obtain transaction information```javascript

eth.getTransaction("0x507d9671630c1524e76208b08d22cdf74a42d3eb8efebadc0cd9e4d2a163cde2")

{ blockHash: "0x75e89b949e44fd045ea1a095414707aa34f698ad23508452f00baed05bea3264", blockNumber: 1689, from: "0xe0f7556cf57751fa447ee0b4a1cfdebf805fb87b", gas: 21000, gasPrice: 10000000000000, hash: "0x507d9671630c1524e76208b08d22cdf74a42d3eb8efebadc0cd9e4d2a163cde2", input: "0x", nonce: 22, r: "0x785b1c916773e1a7aa2161938ee28095fba92f73c67c10c9572487b385c95f7c", s: "0x570b01c35afa8b66ad5d66cd19fd95257a3cfc75ba9da69927427836d58a5f07", to: "0x3866b65c5dd12bbcba367c45d33677475e44524c", transactionIndex: 0, v: "0x1b", value: 156000000000000000000 }


Obtain the code of contract, which is corresponding to the generated bytecode.

```javascript
> eth.getCode("0x58e74C32389507DD7d87Dc782434b56b3cA03A13")

608060405234801561001057600080fd5b5061013f806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663ef5fb05b8114610052575b34801561004c57600080fd5b50600080fd5b34801561005e57600080fd5b506100676100dc565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100a1578181015183820152602001610089565b50505050905090810190601f1680156100ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051808201909152600d81527f48656c6c6f2c20576f726c6421000000000000000000000000000000000000006020820152905600a165627a7a72305820534ba9759bc36d93879fcbeecb1bb3870615cd6058342a77cca4f87cdde8a18e0029

Web3.js

Via web3.js, you can use JavaScript to interact with Usechain nodes, and obtain the data. To use web3.js, you need to enable the JSON-RPC interface of nodes.

Enable RPC Interface of Nodes

> used --moonet --rpc --rpcapi="web3, eth, use" console 2>>usechain.log

Initialize Web3.js

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

Search Transaction

Example

var transaction = web3.eth.getTransaction('0x507d9671630c1524e76208b08d22cdf74a42d3eb8efebadc0cd9e4d2a163cde2');
console.log(transaction);

Blockchain Explorer

Get token

  • Step1: Click 'Get Moonet Token' on the navigation bar to enter the test coin page.

step1

  • Step2: Type your wallet address and click 'Get Token'.

step2

  • Step3: If it prompt Send request successfully!, then you are succeeded to get test coin.step3

Check Token Balance

  • Method 1: Type your wallet address in the input box at the top right corner of ‘Get Moonet Token’ page, then click search button🔍。

step4

  • Method 2: Type your wallet address in the input box of the homepage to search.

step5

Confirmed to check the balance. step6

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.