Skip to content

TrustedDataFramework/SunFlowerCore

Repository files navigation

Docker Java CI

Sunflower developer guide

  1. git subtree usage
git remote add someorigin https://github.com/someproject # add remote
git subtree add --prefix=foldername someorigin master # add folder MonadJ as subtree code directory
git subtree push --prefix=foldername someorigin master # push subtree local change to remote
git subtree pull --prefix=foldername someorigin master # pull from remote 
  1. spring data jpa usage

https://docs.spring.io/spring-data/jpa/docs/current/reference/html/

  1. lombok usage

https://jingyan.baidu.com/article/0a52e3f4e53ca1bf63ed725c.html

  1. configurations override

-Dspring.config.location=classpath:\application.yml,some-path\custom-config.yml

  1. web assembly text format compiler

https://github.com/WebAssembly/wabt/releases

  1. smart contract development
  1. RLP Encoding/Decoding see https://github.com/TrustedDataFramework/java-rlp

Benchmark compare to EthereumJ:

decoding list 10000000 times:

ethereumJ: 3698ms our: 2515ms

  1. github package

    1. set GITHUB_USERNAME environment as your github login name
    2. generate a token for github package: https://github.com/settings/tokens
    3. set GITHUB_TOKEN environment as the token generated above.
  2. vscode debug config example

{
    "configurations": [
        {
            "type": "java",
            "name": "sunflower-core",
            "request": "launch",
            "mainClass": "org.tdf.sunflower.Start",
            "projectName": "sunflower-core-sunflower-core",
            "vmArgs": "-Dspring.config.location=sunflower-core/local/local-0.yml"
        }
    ]
}

Commands

  1. start application: (Windows)

.\gradlew sunflower-core:bootRun

  1. clear builds (Windows)

.\gradlew clean

  1. build and run fat jar (Windows)
.\gradlew sunflowe-core:bootJar       

# override default spring config with your custom config                     
java -jar sunflower-core\build\libs\sunflower*.jar -Dspring.config.location=classpath:\application.yml,some-path\custom-config.yml

# you can also load your config by environment
set SPRING_CONFIG_LOCATION=classpath:\application.yml,some-path\custom-config.yml 
java -jar consortium\build\libs\consortium-0.0.1-SNAPSHOT.jar
  1. build docker and push
bash sunflower-core/docker/build.sh -i your_name_space/your_repository_name:tag --push
  1. rest apis
  • /rpc/account/{address} display account
  • /rpc/config display application configuration