TrueChain development preparation — build the environment(VSCode & Vim)

System Version: Ubuntu 18.04

  1. The installation steps in other System are a little different, e.g. for CentOS, RHEL should use “yum” instead of “apt-get”.
  2. In other Ubuntu version, the output may have a little difference.


$ sudo apt-get install cmake
$ sudo apt-get install python-dev python3-dev
$ sudo apt-get install build-essential
$ cd path/to/deb_file		// change to the direction where contains deb  
$ sudo dpkg -i code_1.26.1-1534444688_amd64.deb // install
  1. From terminal:
$ nohup code & 	// Don’t forget “&”
  1. Press “Win” key, then search “vscode”, you can find it.
    Then , you can install some extensions. Open “extensions” from sidebar, then search “Go”, then install.
    Now, VSCode is installed.

Compile TrueChain with VSCode

$ cd $GOPATH/src/truechain
$ git clone

(Option) Process the FAILED

  1. Process the extensions in “\x\tools”
    Choose a directory, then download “tools” source code:
    $ git clone
  1. Process the extensions about “
    it is also download it from github and then install.
    For example, the error message “Installing FAILED”, we can process it like this:
$ cd $GOPATH/src/
$ git clone
package mainimport (
func main() {
fmt.Println("Hello, TrueChain")

Continue compile TrueChain

"version": "0.2.0",
"configurations": [
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"remotePath": "",
"port": 2345,
"host": "",
"program": "${fileDirname}",
"env": {},
"args": ["init", "./genesis.json"], // ### need to change ###
"showLog": false
"config": {
"chainId": 10,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
"0xbd54a6c8298a70e9636d0555a77ffa412abdd71a" : { "balance" : 90000000000000000000000},
"0x3c2e0a65a023465090aaedaa6ed2975aec9ef7f9" : { "balance" : 10000000000000000000000}
"address": "0x76ea2f3a002431fede1141b660dbb75c26ba6d97",
"publickey": "0x04044308742b61976de7344edb8662d6d10be1c477dd46e8e4c433c128
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x100",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
"args": ["--nodiscover", "--singlenode", "--mine", "--etherbase", "0x8a45d70f096d3581866ed27a5017a4eeec0db2a1", "--bftkeyhex", "c1581e25937d9ab91421a3e1a2667c85b0397c75a195e643109938e987acecfc", "--bftip", "", "--bftport", "10080"],
  1. Fatal: Failed to write fast genesis block: database already contains an incompatible genesis block (have 1acaa8c23f22e0ae, new bc72c21faf0bc5b9), like this:
  1. reason:
    You must have pressed F5 before configuring the “args” of “lanuch.json”
    $ rm -rf ~/.truechain/

Make Vim to be a powerful IDE

  1. Auto complete
  2. Show folder contents
  3. Code folding
    other features, you also can find a plugins.
  1. Vim
  2. Vundle: A plugin for managing Vim plugin
  3. NERDTree: A plugin for showing folder contents
  4. YouCompleteMe: A plugin for auto complement
" set indent as 4 spaces
set tabstop=4
set shiftwidth=4
set expandtab

" show line numbers
set nu

" solve unreadable chinese characters
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set encoding=utf-8

" auto fold code when open files
set fdm=indent
$ git clone 
""""""""""""""" Vundle configuration"""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

"""""""""""""""END Vundle configuration"""""""""""""""""
$ git clone ~/.vim/bundle/YouCompleteMe
$ cd ~/.vim/bundle/YouCompleteMe
$ git submodule update --init --recursive
$ cd ~/.vim/bundle/YouCompleteMe
$ ./ --go-completer // you can choose different program language
// by different parameter, reference here:
set runtimepath+=~/.vim/bundle/YouCompleteMe
let g:ycm_collect_identifiers_from_tags_files = 1 " Turn on YCM tag-based engine
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " Comments and contents in strings are also used to complete
let g:syntastic_ignore_files=[".*\.py$"]
let g:ycm_seed_identifiers_with_syntax = 1 " Grammatical keyword completion
let g:ycm_complete_in_comments = 1
let g:ycm_confirm_extra_conf = 0
"let g:ycm_key_list_select_completion = ['<c-n>', '<Down>'] " key mapping, no this will block the tab, causing the tabs of other plugins not to use.
"let g:ycm_key_list_previous_completion = ['<c-p>', '<Up>']
let g:ycm_complete_in_comments = 1 " completed in the input comments
let g:ycm_complete_in_strings = 1 " Can also be completed when input string
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " Comments and contents in strings are also be collected to complete
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/'
let g:ycm_show_diagnostics_ui = 0 " diable grammar check
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | " enter to choose
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>| " go to definition place
let g:ycm_min_num_of_chars_for_completion=2 " List the matches starting with the second typed character

""""""""END YouCompleteMe"""""""""""""""""""""""""""""""""""

let g:NERDTreeDirArrows = 1
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
let g:NERDTreeGlyphReadOnly = "RO"
autocm vimenter * NERDTree

""""""""END NERDTree""""""""""""""""""""""""""""""""""""""""



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Next Generation Public Blockchain with Hybrid Consensus combining DPoS and fPoW